From 3976264391d88f529d81fc3329c05b53c67f038e Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Mon, 25 May 2026 00:00:34 -0700 Subject: [PATCH] mount: keep the posix-lock hint until the release RPC succeeds (#9670) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit routedReleasePosixOwner dropped the local owner hint before sending RELEASE_POSIX_OWNER, so a transient RPC failure left the lock held on the owner filer with no local record to retry from — stranded until session-lease reaping. Drop the hint only after a successful release; on failure keep it so a later flush retries, with lease reaping as the backstop. --- weed/mount/weedfs_posix_lock_routed.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/weed/mount/weedfs_posix_lock_routed.go b/weed/mount/weedfs_posix_lock_routed.go index 4dcfc2ee1..279d7dbc2 100644 --- a/weed/mount/weedfs_posix_lock_routed.go +++ b/weed/mount/weedfs_posix_lock_routed.go @@ -287,7 +287,6 @@ func (wfs *WFS) routedReleasePosixOwner(inode, owner uint64) { if !wfs.posixHint.has(inode, owner) { return } - wfs.posixHint.drop(inode, owner) key, ok := wfs.posixLockKeyForInode(inode) if !ok { return @@ -295,8 +294,13 @@ func (wfs *WFS) routedReleasePosixOwner(inode, owner uint64) { ctx, cancel := context.WithTimeout(context.Background(), posixLockReleaseTimeout) defer cancel() if _, err := wfs.callPosixLock(ctx, key, filer_pb.PosixLockOp_RELEASE_POSIX_OWNER, posixlock.Range{Sid: wfs.posixSid, Owner: owner}); err != nil { + // Keep the hint so a later flush retries the release; dropping it on a + // transient failure would strand the lock until the owner filer's + // session-lease reaping expires it. glog.Warningf("routed release posix owner %s: %v", key, err) + return } + wfs.posixHint.drop(inode, owner) } func (wfs *WFS) routedReleaseFlockOwner(inode, owner uint64) {