From ef3526b3b8d8f8ba50c46795d30e127f9bedd84a Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Thu, 13 Sep 2018 21:05:58 +0100 Subject: [PATCH] vfs: fix race condition detected by serve ftp tests --- vfs/file.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vfs/file.go b/vfs/file.go index fa2c7ac95..c4134d067 100644 --- a/vfs/file.go +++ b/vfs/file.go @@ -441,6 +441,8 @@ func (f *File) Sync() error { // Remove the file func (f *File) Remove() error { + f.mu.Lock() + defer f.mu.Unlock() f.muRW.Lock() defer f.muRW.Unlock() if f.d.vfs.Opt.ReadOnly {