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.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
mount: fix renaming a deep directory with unvisited directories
Chris Lu0ccdb937bba2
diff --git a/weed/filesys/dir.go b/weed/filesys/dir.goindex 9a791e013c..d2d58fda5c 100644--- a/weed/filesys/dir.go+++ b/weed/filesys/dir.go@@ -352,7 +352,7 @@ func (dir *Dir) ReadDirAll(ctx context.Context) (ret []fuse.Dirent, err error) {glog.Errorf("dir ReadDirAll %s: %v", dirPath, err)return nil, fuse.EIO}- listErr := dir.wfs.metaCache.ListDirectoryEntries(context.Background(), dirPath, "", false, int64(math.MaxInt32), func(entry *filer.Entry) bool {+ listErr := dir.wfs.metaCache.ListDirectoryEntries(context.Background(), dir.wfs, dirPath, "", false, int64(math.MaxInt32), func(entry *filer.Entry) bool {processEachEntryFn(entry, false)return true})diff --git a/weed/filesys/dir_rename.go b/weed/filesys/dir_rename.goindex dd76577b03..ff65bccd24 100644--- a/weed/filesys/dir_rename.go+++ b/weed/filesys/dir_rename.go@@ -131,7 +131,7 @@ func (dir *Dir) moveFolderSubEntries(ctx context.Context, oldParent util.FullPatglog.V(1).Infof("moving folder %s => %s", currentDirPath, newDirPath)var moveErr error- listErr := dir.wfs.metaCache.ListDirectoryEntries(ctx, currentDirPath, "", false, int64(math.MaxInt32), func(item *filer.Entry) bool {+ listErr := dir.wfs.metaCache.ListDirectoryEntries(ctx, dir.wfs, currentDirPath, "", false, int64(math.MaxInt32), func(item *filer.Entry) bool {moveErr = dir.moveEntry(ctx, currentDirPath, item, newDirPath, item.Name())if moveErr != nil {return falsediff --git a/weed/filesys/meta_cache/meta_cache.go b/weed/filesys/meta_cache/meta_cache.goindex 69d1655ee2..6630a7739f 100644--- a/weed/filesys/meta_cache/meta_cache.go+++ b/weed/filesys/meta_cache/meta_cache.go@@ -2,10 +2,10 @@ package meta_cacheimport ("context"- "fmt""github.com/chrislusf/seaweedfs/weed/filer""github.com/chrislusf/seaweedfs/weed/filer/leveldb""github.com/chrislusf/seaweedfs/weed/glog"+ "github.com/chrislusf/seaweedfs/weed/pb/filer_pb""github.com/chrislusf/seaweedfs/weed/util""github.com/chrislusf/seaweedfs/weed/util/bounded_tree""os"@@ -117,12 +117,15 @@ func (mc *MetaCache) DeleteEntry(ctx context.Context, fp util.FullPath) (err errreturn mc.localStore.DeleteEntry(ctx, fp)}-func (mc *MetaCache) ListDirectoryEntries(ctx context.Context, dirPath util.FullPath, startFileName string, includeStartFile bool, limit int64, eachEntryFunc filer.ListEachEntryFunc) error {+func (mc *MetaCache) ListDirectoryEntries(ctx context.Context, client filer_pb.FilerClient, dirPath util.FullPath, startFileName string, includeStartFile bool, limit int64, eachEntryFunc filer.ListEachEntryFunc) error {//mc.RLock()//defer mc.RUnlock()if !mc.visitedBoundary.HasVisited(dirPath) {- return fmt.Errorf("unsynchronized dir: %v", dirPath)+ glog.V(2).Infof("visit unsynchronized dir: %v", dirPath)+ // this should not happen often+ // unless, e.g., moving a deep directory+ EnsureVisited(mc, client, dirPath)}_, err := mc.localStore.ListDirectoryEntries(ctx, dirPath, startFileName, includeStartFile, limit, func(entry *filer.Entry) bool {