Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

fix listing with correct inode

chrislu65a19e3abc60
diff --git a/weed/mount/weedfs_dir_read.go b/weed/mount/weedfs_dir_read.go
index 49ac22574c..40726a6948 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