Skip to content

Commit ced9f6b

Browse files
committed
NFSv4: Fix dropped lock for racing OPEN and delegation return
jira LE-2349 Rebuild_History Non-Buildable kernel-4.18.0-553.37.1.el8_10 commit-author Benjamin Coddington <bcodding@redhat.com> commit 1cbc11a Commmit f5ea161 ("NFSv4: Retry LOCK on OLD_STATEID during delegation return") attempted to solve this problem by using nfs4's generic async error handling, but introduced a regression where v4.0 lock recovery would hang. The additional complexity introduced by overloading that error handling is not necessary for this case. This patch expects that commit to be reverted. The problem as originally explained in the above commit is: There's a small window where a LOCK sent during a delegation return can race with another OPEN on client, but the open stateid has not yet been updated. In this case, the client doesn't handle the OLD_STATEID error from the server and will lose this lock, emitting: "NFS: nfs4_handle_delegation_recall_error: unhandled error -10024". Fix this by using the old_stateid refresh helpers if the server replies with OLD_STATEID. Suggested-by: Trond Myklebust <trondmy@hammerspace.com> Signed-off-by: Benjamin Coddington <bcodding@redhat.com> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> (cherry picked from commit 1cbc11a) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent b6f3b5c commit ced9f6b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

fs/nfs/nfs4proc.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7121,8 +7121,15 @@ static void nfs4_lock_done(struct rpc_task *task, void *calldata)
71217121
} else if (!nfs4_update_lock_stateid(lsp, &data->res.stateid))
71227122
goto out_restart;
71237123
break;
7124-
case -NFS4ERR_BAD_STATEID:
71257124
case -NFS4ERR_OLD_STATEID:
7125+
if (data->arg.new_lock_owner != 0 &&
7126+
nfs4_refresh_open_old_stateid(&data->arg.open_stateid,
7127+
lsp->ls_state))
7128+
goto out_restart;
7129+
if (nfs4_refresh_lock_old_stateid(&data->arg.lock_stateid, lsp))
7130+
goto out_restart;
7131+
fallthrough;
7132+
case -NFS4ERR_BAD_STATEID:
71267133
case -NFS4ERR_STALE_STATEID:
71277134
case -NFS4ERR_EXPIRED:
71287135
if (data->arg.new_lock_owner != 0) {

0 commit comments

Comments
 (0)