Skip to content

Commit f5ea161

Browse files
bcodding-rhamschuma-ntap
authored andcommitted
NFSv4: Retry LOCK on OLD_STATEID during delegation return
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>
1 parent cbdeaee commit f5ea161

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
@@ -7138,15 +7138,15 @@ static void nfs4_lock_done(struct rpc_task *task, void *calldata)
71387138
{
71397139
struct nfs4_lockdata *data = calldata;
71407140
struct nfs4_lock_state *lsp = data->lsp;
7141+
struct nfs_server *server = NFS_SERVER(d_inode(data->ctx->dentry));
71417142

71427143
if (!nfs4_sequence_done(task, &data->res.seq_res))
71437144
return;
71447145

71457146
data->rpc_status = task->tk_status;
71467147
switch (task->tk_status) {
71477148
case 0:
7148-
renew_lease(NFS_SERVER(d_inode(data->ctx->dentry)),
7149-
data->timestamp);
7149+
renew_lease(server, data->timestamp);
71507150
if (data->arg.new_lock && !data->cancelled) {
71517151
data->fl.fl_flags &= ~(FL_SLEEP | FL_ACCESS);
71527152
if (locks_lock_inode_wait(lsp->ls_state->inode, &data->fl) < 0)
@@ -7167,6 +7167,8 @@ static void nfs4_lock_done(struct rpc_task *task, void *calldata)
71677167
if (!nfs4_stateid_match(&data->arg.open_stateid,
71687168
&lsp->ls_state->open_stateid))
71697169
goto out_restart;
7170+
else if (nfs4_async_handle_error(task, server, lsp->ls_state, NULL) == -EAGAIN)
7171+
goto out_restart;
71707172
} else if (!nfs4_stateid_match(&data->arg.lock_stateid,
71717173
&lsp->ls_stateid))
71727174
goto out_restart;

0 commit comments

Comments
 (0)