mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
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>
This commit is contained in:
committed by
Anna Schumaker
parent
f7550318b2
commit
94b8886510
+10
-13
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user