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
fix(mount): avoid self-notify deadlock in Link and CopyFileRange handlers (#9110)
Chris Lu7916e61c0893
diff --git a/weed/mount/weedfs_file_copy_range.go b/weed/mount/weedfs_file_copy_range.goindex f77330a7bc..5123a320c6 100644--- a/weed/mount/weedfs_file_copy_range.go+++ b/weed/mount/weedfs_file_copy_range.go@@ -251,7 +251,11 @@ func (wfs *WFS) applyServerSideWholeFileCopyResult(fhIn, fhOut *FileHandle, dstP}fhOut.dirtyMetadata = falsewfs.updateServerSideWholeFileCopyMetaCache(dstPath, entry)- wfs.invalidateCopyDestinationCache(fhOut.inode, dstPath)+ // Note: we intentionally skip fuseServer.InodeNotify/EntryNotify here.+ // This runs inside the CopyFileRange request handler; those notifies+ // would write onto the same /dev/fuse fd the kernel is still waiting+ // on for this request's reply, deadlocking the mount. The kernel will+ // re-read attrs once its attr-cache TTL expires.}func (wfs *WFS) updateServerSideWholeFileCopyMetaCache(dstPath util.FullPath, entry *filer_pb.Entry) {@@ -501,16 +505,3 @@ func (wfs *WFS) filerCopyJWT() security.EncodedJwt {return security.GenJwtForFilerServer(wfs.option.FilerSigningKey, wfs.option.FilerSigningExpiresAfterSec)}-func (wfs *WFS) invalidateCopyDestinationCache(inode uint64, fullPath util.FullPath) {- if wfs.fuseServer != nil {- if status := wfs.fuseServer.InodeNotify(inode, 0, -1); status != fuse.OK {- glog.V(4).Infof("CopyFileRange invalidate inode %d: %v", inode, status)- }- dir, name := fullPath.DirAndName()- if parentInode, found := wfs.inodeToPath.GetInode(util.FullPath(dir)); found {- if status := wfs.fuseServer.EntryNotify(parentInode, name); status != fuse.OK {- glog.V(4).Infof("CopyFileRange invalidate entry %s: %v", fullPath, status)- }- }- }-}diff --git a/weed/mount/weedfs_link.go b/weed/mount/weedfs_link.goindex 9413705c93..16952a33df 100644--- a/weed/mount/weedfs_link.go+++ b/weed/mount/weedfs_link.go@@ -231,9 +231,9 @@ func (wfs *WFS) syncHardLinkSiblings(inode uint64, authoritativeEntry *filer_pb.glog.V(4).Infof("syncHardLinkSiblings update %s: %v", p, err)}}- if wfs.fuseServer != nil {- if status := wfs.fuseServer.InodeNotify(inode, 0, -1); status != fuse.OK {- glog.V(4).Infof("syncHardLinkSiblings invalidate inode %d: %v", inode, status)- }- }+ // Note: we deliberately do NOT call fuseServer.InodeNotify here. That+ // call would be made from the FUSE Link request handler goroutine, and+ // writes onto the same /dev/fuse fd that the kernel is still waiting to+ // read the Link reply from — causing a self-notify deadlock. The kernel+ // will re-stat siblings once its attr-cache TTL expires.}