Skip to content

Commit 94b8886

Browse files
Christoph HellwigAnna Schumaker
authored andcommitted
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 <hch@lst.de> Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
1 parent f755031 commit 94b8886

1 file changed

Lines changed: 10 additions & 13 deletions

File tree

fs/nfs/delegation.c

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -570,30 +570,27 @@ static int nfs_end_delegation_return(struct inode *inode,
570570
break;
571571
err = nfs_delegation_claim_opens(inode, &delegation->stateid,
572572
delegation->type);
573-
if (!issync || err != -EAGAIN)
573+
if (!err)
574574
break;
575+
if (err != -EAGAIN)
576+
goto abort;
577+
if (!issync)
578+
goto delay;
579+
575580
/*
576581
* Guard against state recovery
577582
*/
578583
err = nfs4_wait_clnt_recover(server->nfs_client);
579584
}
580585

581-
if (err)
582-
goto abort;
583-
584586
out_return:
585587
return nfs_do_return_delegation(inode, delegation, issync);
588+
delay:
589+
set_bit(NFS_DELEGATION_RETURN_DELAYED, &delegation->flags);
590+
set_bit(NFS4SERV_DELEGRETURN_DELAYED, &server->delegation_flags);
591+
set_bit(NFS4CLNT_DELEGRETURN_DELAYED, &server->nfs_client->cl_state);
586592
abort:
587-
spin_lock(&delegation->lock);
588593
clear_bit(NFS_DELEGATION_RETURNING, &delegation->flags);
589-
if (err == -EAGAIN) {
590-
set_bit(NFS_DELEGATION_RETURN_DELAYED, &delegation->flags);
591-
set_bit(NFS4SERV_DELEGRETURN_DELAYED,
592-
&server->delegation_flags);
593-
set_bit(NFS4CLNT_DELEGRETURN_DELAYED,
594-
&server->nfs_client->cl_state);
595-
}
596-
spin_unlock(&delegation->lock);
597594
return err;
598595
}
599596

0 commit comments

Comments
 (0)