Skip to content

Commit 1cbc11a

Browse files
bcodding-rhTrond Myklebust
authored andcommitted
NFSv4: Fix dropped lock for racing OPEN and delegation return
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>
1 parent 5b4a82a commit 1cbc11a

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
@@ -7181,8 +7181,15 @@ static void nfs4_lock_done(struct rpc_task *task, void *calldata)
71817181
} else if (!nfs4_update_lock_stateid(lsp, &data->res.stateid))
71827182
goto out_restart;
71837183
break;
7184-
case -NFS4ERR_BAD_STATEID:
71857184
case -NFS4ERR_OLD_STATEID:
7185+
if (data->arg.new_lock_owner != 0 &&
7186+
nfs4_refresh_open_old_stateid(&data->arg.open_stateid,
7187+
lsp->ls_state))
7188+
goto out_restart;
7189+
if (nfs4_refresh_lock_old_stateid(&data->arg.lock_stateid, lsp))
7190+
goto out_restart;
7191+
fallthrough;
7192+
case -NFS4ERR_BAD_STATEID:
71867193
case -NFS4ERR_STALE_STATEID:
71877194
case -NFS4ERR_EXPIRED:
71887195
if (data->arg.new_lock_owner != 0) {

0 commit comments

Comments
 (0)