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 nill

Chris Ludeb249736e12
diff --git a/weed/filesys/dir.go b/weed/filesys/dir.go
index 8f1bc72a76..ad37d9ce04 100644
--- a/weed/filesys/dir.go
+++ b/weed/filesys/dir.go
@@ -41,10 +41,12 @@ func (dir *Dir) Attr(ctx context.Context, attr *fuse.Attr) error {
}
item := dir.wfs.listDirectoryEntriesCache.Get(dir.Path)
+ var entry *filer_pb.Entry
if item != nil && !item.Expired() {
+ entry = item.Value().(*filer_pb.Entry)
+ }
- glog.V(4).Infof("dir Attr cache hit %s", dir.Path)
-
+ if entry != nil {
entry := item.Value().(*filer_pb.Entry)
attr.Mtime = time.Unix(entry.Attributes.Mtime, 0)
diff --git a/weed/filesys/file.go b/weed/filesys/file.go
index d788956155..0a0090e3d2 100644
--- a/weed/filesys/file.go
+++ b/weed/filesys/file.go
@@ -141,11 +141,14 @@ func (file *File) Fsync(ctx context.Context, req *fuse.FsyncRequest) error {
func (file *File) maybeLoadAttributes(ctx context.Context) error {
if file.entry == nil || !file.isOpen {
item := file.wfs.listDirectoryEntriesCache.Get(file.fullpath())
+ var entry *filer_pb.Entry
if item != nil && !item.Expired() {
+ entry = item.Value().(*filer_pb.Entry)
+ }
+ if entry != nil {
glog.V(4).Infof("file read attr cache hit %s", file.fullpath())
- entry := item.Value().(*filer_pb.Entry)
file.setEntry(entry)
// glog.V(1).Infof("file attr read cached %v attributes", file.Name)
} else {