mount: ensure ordered file handle lock and unlock

This commit is contained in:
chrislu
2022-09-11 19:44:34 -07:00
parent b9112747b5
commit 22064c3425
6 changed files with 26 additions and 19 deletions

View File

@@ -1,6 +1,7 @@
package mount
import (
"context"
"io"
"github.com/hanwen/go-fuse/v2/fuse"
@@ -39,8 +40,8 @@ func (wfs *WFS) Read(cancel <-chan struct{}, in *fuse.ReadIn, buff []byte) (fuse
return nil, fuse.ENOENT
}
fh.Lock()
defer fh.Unlock()
fh.orderedMutex.Acquire(context.Background(), 1)
defer fh.orderedMutex.Release(1)
offset := int64(in.Offset)
totalRead, err := readDataByFileHandle(buff, fh, offset)