aboutsummaryrefslogtreecommitdiff
path: root/weed/mount/weedfs_dir_lookup.go
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2022-08-26 16:49:51 -0700
committerchrislu <chris.lu@gmail.com>2022-08-26 16:49:51 -0700
commit8dae81c5edaea2b25a79d49c4a08ffadfdc6fddc (patch)
treece1ef0be521398d06255a97eb531d97b7f940b47 /weed/mount/weedfs_dir_lookup.go
parente0f4366f4ca3259bfe582fb1dd8951f2005160ab (diff)
parent5df105b1f94b8776d18159ae213da39299e2ea37 (diff)
downloadseaweedfs-8dae81c5edaea2b25a79d49c4a08ffadfdc6fddc.tar.xz
seaweedfs-8dae81c5edaea2b25a79d49c4a08ffadfdc6fddc.zip
Merge branch 'master' of https://github.com/seaweedfs/seaweedfs
Diffstat (limited to 'weed/mount/weedfs_dir_lookup.go')
-rw-r--r--weed/mount/weedfs_dir_lookup.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/weed/mount/weedfs_dir_lookup.go b/weed/mount/weedfs_dir_lookup.go
index 7a9b7fecc..49e4b1b56 100644
--- a/weed/mount/weedfs_dir_lookup.go
+++ b/weed/mount/weedfs_dir_lookup.go
@@ -2,7 +2,9 @@ package mount
import (
"context"
+
"github.com/hanwen/go-fuse/v2/fuse"
+
"github.com/seaweedfs/seaweedfs/weed/filer"
"github.com/seaweedfs/seaweedfs/weed/glog"
"github.com/seaweedfs/seaweedfs/weed/mount/meta_cache"
@@ -55,9 +57,13 @@ func (wfs *WFS) Lookup(cancel <-chan struct{}, header *fuse.InHeader, name strin
inode := wfs.inodeToPath.Lookup(fullFilePath, localEntry.Crtime.Unix(), localEntry.IsDirectory(), len(localEntry.HardLinkId) > 0, localEntry.Inode, true)
- if fh, found := wfs.fhmap.FindFileHandle(inode); found && fh.entry != nil {
- glog.V(4).Infof("lookup opened file %s size %d", dirPath.Child(localEntry.Name()), filer.FileSize(fh.entry))
- localEntry = filer.FromPbEntry(string(dirPath), fh.entry)
+ if fh, found := wfs.fhmap.FindFileHandle(inode); found {
+ fh.entryLock.Lock()
+ if fh.entry != nil {
+ glog.V(4).Infof("lookup opened file %s size %d", dirPath.Child(localEntry.Name()), filer.FileSize(fh.entry))
+ localEntry = filer.FromPbEntry(string(dirPath), fh.entry)
+ }
+ fh.entryLock.Unlock()
}
wfs.outputFilerEntry(out, inode, localEntry)