aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2022-12-05 23:19:38 -0800
committerchrislu <chris.lu@gmail.com>2022-12-05 23:19:38 -0800
commit659f28b8552e2635b2bc4566e525f1fe098204da (patch)
treecb11c1b5bffe28fff53accd7af6851849ec4c633
parentca49ef8ed868ec41a2f386221ae0bc18c1081624 (diff)
downloadseaweedfs-659f28b8552e2635b2bc4566e525f1fe098204da.tar.xz
seaweedfs-659f28b8552e2635b2bc4566e525f1fe098204da.zip
simple refactoring
-rw-r--r--weed/mount/weedfs_file_sync.go10
1 files changed, 3 insertions, 7 deletions
diff --git a/weed/mount/weedfs_file_sync.go b/weed/mount/weedfs_file_sync.go
index a08a37f9c..7b7c66680 100644
--- a/weed/mount/weedfs_file_sync.go
+++ b/weed/mount/weedfs_file_sync.go
@@ -55,9 +55,6 @@ func (wfs *WFS) Flush(cancel <-chan struct{}, in *fuse.FlushIn) fuse.Status {
return fuse.ENOENT
}
- fh.orderedMutex.Acquire(context.Background(), 1)
- defer fh.orderedMutex.Release(1)
-
return wfs.doFlush(fh, in.Uid, in.Gid)
}
@@ -87,14 +84,14 @@ func (wfs *WFS) Fsync(cancel <-chan struct{}, in *fuse.FsyncIn) (code fuse.Statu
return fuse.ENOENT
}
- fh.orderedMutex.Acquire(context.Background(), 1)
- defer fh.orderedMutex.Release(1)
-
return wfs.doFlush(fh, in.Uid, in.Gid)
}
func (wfs *WFS) doFlush(fh *FileHandle, uid, gid uint32) fuse.Status {
+ fh.orderedMutex.Acquire(context.Background(), 1)
+ defer fh.orderedMutex.Release(1)
+
// flush works at fh level
fileFullPath := fh.FullPath()
dir, name := fileFullPath.DirAndName()
@@ -117,7 +114,6 @@ func (wfs *WFS) doFlush(fh *FileHandle, uid, gid uint32) fuse.Status {
}
err := wfs.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {
-
fh.entryLock.Lock()
defer fh.entryLock.Unlock()