fix(mount): skip metadata flush for unlinked-while-open files (#9027)

When a file is unlinked while still open (open-unlink-close pattern),
the synchronous doFlush path would recreate the entry on the filer
during close. Check fh.isDeleted before flushing metadata, matching
the async flush path which already had this check.
This commit is contained in:
Chris Lu
2026-04-10 16:37:36 -07:00
committed by GitHub
parent ef30d91b7d
commit 2e64c0fe2a
+7
View File
@@ -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)
}