diff options
| author | chrislu <chris.lu@gmail.com> | 2022-07-28 16:32:00 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2022-07-28 16:32:00 -0700 |
| commit | e0eda52c5418f53fda895741a1878e66d8dffb44 (patch) | |
| tree | c9d8086f1e0e569e2617d3666ed5e22aa4d7dd33 /weed/mount/inode_to_path.go | |
| parent | ca836568ac3df79373225bf6b98334e641194cfc (diff) | |
| download | seaweedfs-e0eda52c5418f53fda895741a1878e66d8dffb44.tar.xz seaweedfs-e0eda52c5418f53fda895741a1878e66d8dffb44.zip | |
mount: ensure symlink parent directory is tracked
fix https://github.com/chrislusf/seaweedfs/issues/3373
Diffstat (limited to 'weed/mount/inode_to_path.go')
| -rw-r--r-- | weed/mount/inode_to_path.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/weed/mount/inode_to_path.go b/weed/mount/inode_to_path.go index 0c34b2ab4..f12121dd9 100644 --- a/weed/mount/inode_to_path.go +++ b/weed/mount/inode_to_path.go @@ -5,6 +5,7 @@ import ( "github.com/chrislusf/seaweedfs/weed/util" "github.com/hanwen/go-fuse/v2/fuse" "sync" + "time" ) type InodeToPath struct { @@ -52,6 +53,20 @@ func NewInodeToPath(root util.FullPath) *InodeToPath { return t } +// EnsurePath make sure the full path is tracked, used by symlink. +func (i *InodeToPath) EnsurePath(path util.FullPath, isDirectory bool) bool { + for { + dir, _ := path.DirAndName() + if dir == "/" { + return true + } + if i.EnsurePath(util.FullPath(dir), true) { + i.Lookup(path, time.Now().Unix(), isDirectory, false, 0, false) + } + } + return false +} + func (i *InodeToPath) Lookup(path util.FullPath, unixTime int64, isDirectory bool, isHardlink bool, possibleInode uint64, isLookup bool) uint64 { i.Lock() defer i.Unlock() |
