NFSv4: Clean up nfs4_select_rw_stateid()

Ensure that we select delegation stateids first, then
lock stateids and then open stateids.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
Trond Myklebust
2012-03-08 17:42:01 -05:00
parent 0032a7a749
commit 4fc8796d23
4 changed files with 50 additions and 21 deletions

View File

@@ -1929,10 +1929,12 @@ static int _nfs4_do_setattr(struct inode *inode, struct rpc_cred *cred,
nfs_fattr_init(fattr);
if (nfs4_copy_delegation_stateid(&arg.stateid, inode, FMODE_WRITE)) {
if (state != NULL) {
nfs4_select_rw_stateid(&arg.stateid, state, FMODE_WRITE,
current->files, current->tgid);
} else if (nfs4_copy_delegation_stateid(&arg.stateid, inode,
FMODE_WRITE)) {
/* Use that stateid */
} else if (state != NULL) {
nfs4_select_rw_stateid(&arg.stateid, state, current->files, current->tgid);
} else
nfs4_stateid_copy(&arg.stateid, &zero_stateid);