aboutsummaryrefslogtreecommitdiff
path: root/weed/mount/weedfs_dir_read.go
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2022-02-16 17:01:39 -0800
committerchrislu <chris.lu@gmail.com>2022-02-16 17:01:39 -0800
commit65a19e3abc602ad829b427d3ec6813c7616aa7be (patch)
tree3e127103487742b3e0d9b96ab4e9cb70f4f4f9ca /weed/mount/weedfs_dir_read.go
parent6ac066d1dc03335adeacf17b923b8208418c9124 (diff)
downloadseaweedfs-65a19e3abc602ad829b427d3ec6813c7616aa7be.tar.xz
seaweedfs-65a19e3abc602ad829b427d3ec6813c7616aa7be.zip
fix listing with correct inode
Diffstat (limited to 'weed/mount/weedfs_dir_read.go')
-rw-r--r--weed/mount/weedfs_dir_read.go29
1 files changed, 12 insertions, 17 deletions
diff --git a/weed/mount/weedfs_dir_read.go b/weed/mount/weedfs_dir_read.go
index 49ac22574..40726a694 100644
--- a/weed/mount/weedfs_dir_read.go
+++ b/weed/mount/weedfs_dir_read.go
@@ -5,10 +5,8 @@ import (
"github.com/chrislusf/seaweedfs/weed/filer"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/mount/meta_cache"
- "github.com/chrislusf/seaweedfs/weed/util"
"github.com/hanwen/go-fuse/v2/fuse"
"math"
- "os"
"sync"
)
@@ -147,32 +145,29 @@ func (wfs *WFS) doReadDirectory(input *fuse.ReadIn, out *fuse.DirEntryList, isPl
dirPath := wfs.inodeToPath.GetPath(input.NodeId)
var dirEntry fuse.DirEntry
- if input.Offset == 0 && !isPlusMode {
- dirEntry.Ino = input.NodeId
- dirEntry.Name = "."
- dirEntry.Mode = toSystemMode(os.ModeDir)
- out.AddDirEntry(dirEntry)
-
- parentDir, _ := dirPath.DirAndName()
- parentInode := wfs.inodeToPath.GetInode(util.FullPath(parentDir))
- dirEntry.Ino = parentInode
- dirEntry.Name = ".."
- dirEntry.Mode = toSystemMode(os.ModeDir)
- out.AddDirEntry(dirEntry)
-
+ if input.Offset == 0 {
+ if !isPlusMode {
+ out.AddDirEntry(fuse.DirEntry{Mode: fuse.S_IFDIR, Name: "."})
+ out.AddDirEntry(fuse.DirEntry{Mode: fuse.S_IFDIR, Name: ".."})
+ } else {
+ out.AddDirLookupEntry(fuse.DirEntry{Mode: fuse.S_IFDIR, Name: "."})
+ out.AddDirLookupEntry(fuse.DirEntry{Mode: fuse.S_IFDIR, Name: ".."})
+ }
}
processEachEntryFn := func(entry *filer.Entry, isLast bool) bool {
dirEntry.Name = entry.Name()
- inode := wfs.inodeToPath.GetInode(dirPath.Child(dirEntry.Name))
- dirEntry.Ino = inode
dirEntry.Mode = toSystemMode(entry.Mode)
if !isPlusMode {
+ inode := wfs.inodeToPath.Lookup(dirPath.Child(dirEntry.Name), entry.IsDirectory(), false)
+ dirEntry.Ino = inode
if !out.AddDirEntry(dirEntry) {
isEarlyTerminated = true
return false
}
} else {
+ inode := wfs.inodeToPath.Lookup(dirPath.Child(dirEntry.Name), entry.IsDirectory(), true)
+ dirEntry.Ino = inode
entryOut := out.AddDirLookupEntry(dirEntry)
if entryOut == nil {
isEarlyTerminated = true