Skip to content

Commit 3fe433a

Browse files
committed
NFSv4: Retry LOCK on OLD_STATEID during delegation return
jira LE-1907 Rebuild_History Non-Buildable kernel-rt-5.14.0-284.30.1.rt14.315.el9_2 commit-author Benjamin Coddington <bcodding@redhat.com> commit f5ea161 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 sending the task through the nfs4 error handling in nfs4_lock_done() when we may have to reconcile our stateid with what the server believes it to be. For this case, the result is a retry of the LOCK operation with the updated stateid. Reported-by: Gonzalo Siero Humet <gsierohu@redhat.com> Signed-off-by: Benjamin Coddington <bcodding@redhat.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com> (cherry picked from commit f5ea161) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent 6831af1 commit 3fe433a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

fs/nfs/nfs4proc.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7108,15 +7108,15 @@ static void nfs4_lock_done(struct rpc_task *task, void *calldata)
71087108
{
71097109
struct nfs4_lockdata *data = calldata;
71107110
struct nfs4_lock_state *lsp = data->lsp;
7111+
struct nfs_server *server = NFS_SERVER(d_inode(data->ctx->dentry));
71117112

71127113
if (!nfs4_sequence_done(task, &data->res.seq_res))
71137114
return;
71147115

71157116
data->rpc_status = task->tk_status;
71167117
switch (task->tk_status) {
71177118
case 0:
7118-
renew_lease(NFS_SERVER(d_inode(data->ctx->dentry)),
7119-
data->timestamp);
7119+
renew_lease(server, data->timestamp);
71207120
if (data->arg.new_lock && !data->cancelled) {
71217121
data->fl.fl_flags &= ~(FL_SLEEP | FL_ACCESS);
71227122
if (locks_lock_inode_wait(lsp->ls_state->inode, &data->fl) < 0)
@@ -7137,6 +7137,8 @@ static void nfs4_lock_done(struct rpc_task *task, void *calldata)
71377137
if (!nfs4_stateid_match(&data->arg.open_stateid,
71387138
&lsp->ls_state->open_stateid))
71397139
goto out_restart;
7140+
else if (nfs4_async_handle_error(task, server, lsp->ls_state, NULL) == -EAGAIN)
7141+
goto out_restart;
71407142
} else if (!nfs4_stateid_match(&data->arg.lock_stateid,
71417143
&lsp->ls_stateid))
71427144
goto out_restart;

0 commit comments

Comments
 (0)