From: Christoph Hellwig Date: Wed, 28 Jan 2026 04:46:08 +0000 (+0100) Subject: NFS: simplify error handling in nfs_end_delegation_return X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=94b88865109c0ea10e5ba562a793673b4fb37113;p=thirdparty%2Fkernel%2Flinux.git NFS: simplify error handling in nfs_end_delegation_return Drop the pointless delegation->lock held over setting multiple atomic bits in different structures, and use separate labels for the delay vs abort cases. Signed-off-by: Christoph Hellwig Signed-off-by: Anna Schumaker --- diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index cf90aa7f922a0..cff49a934c9e4 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c @@ -570,30 +570,27 @@ static int nfs_end_delegation_return(struct inode *inode, break; err = nfs_delegation_claim_opens(inode, &delegation->stateid, delegation->type); - if (!issync || err != -EAGAIN) + if (!err) break; + if (err != -EAGAIN) + goto abort; + if (!issync) + goto delay; + /* * Guard against state recovery */ err = nfs4_wait_clnt_recover(server->nfs_client); } - if (err) - goto abort; - out_return: return nfs_do_return_delegation(inode, delegation, issync); +delay: + set_bit(NFS_DELEGATION_RETURN_DELAYED, &delegation->flags); + set_bit(NFS4SERV_DELEGRETURN_DELAYED, &server->delegation_flags); + set_bit(NFS4CLNT_DELEGRETURN_DELAYED, &server->nfs_client->cl_state); abort: - spin_lock(&delegation->lock); clear_bit(NFS_DELEGATION_RETURNING, &delegation->flags); - if (err == -EAGAIN) { - set_bit(NFS_DELEGATION_RETURN_DELAYED, &delegation->flags); - set_bit(NFS4SERV_DELEGRETURN_DELAYED, - &server->delegation_flags); - set_bit(NFS4CLNT_DELEGRETURN_DELAYED, - &server->nfs_client->cl_state); - } - spin_unlock(&delegation->lock); return err; }