From 0eba98614c18eda48d0104b18657928f82d2395a Mon Sep 17 00:00:00 2001
From: Kirill Smelkov <kirr@nexedi.com>
Date: Fri, 5 Jul 2019 11:48:23 +0300
Subject: [PATCH] .

---
 wcfs/wcfs.go | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/wcfs/wcfs.go b/wcfs/wcfs.go
index 8afdcac..e15a7a8 100644
--- a/wcfs/wcfs.go
+++ b/wcfs/wcfs.go
@@ -1513,7 +1513,9 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T
 	w := wlink.byfile[foid]	// XXX locking
 	if w == nil {
 		// watch was not previously established - set it up anew
-		f := bfdir.fileTab[foid]	// XXX locking
+		bfdir.fileMu.Lock()
+		f := bfdir.fileTab[foid]
+		bfdir.fileMu.Unlock()
 		if f == nil {
 			// by "invalidation protocol" watch is setup after data file was opened
 			return fmt.Errorf("file not yet known to wcfs or is not a ZBigFile")
-- 
2.30.9