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(mount): skip metadata flush for unlinked-while-open files (#9027)

Chris Lu2e64c0fe2aee
diff --git a/weed/mount/weedfs_file_sync.go b/weed/mount/weedfs_file_sync.go
index 88c88ea97b..adfefebd25 100644
--- a/weed/mount/weedfs_file_sync.go
+++ b/weed/mount/weedfs_file_sync.go
@@ -144,6 +144,13 @@ func (wfs *WFS) doFlush(fh *FileHandle, uid, gid uint32, allowAsync bool) fuse.S
return fuse.OK
}
+ // Skip metadata flush if the file was unlinked while open.
+ // The filer entry is already gone; flushing would recreate it.
+ if fh.isDeleted {
+ glog.V(3).Infof("doFlush %s fh %d: file was unlinked, skipping metadata flush", fileFullPath, fh.fh)
+ return fuse.OK
+ }
+
if isOverQuota {
return fuse.Status(syscall.ENOSPC)
}