Commit 40ccba5f authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] knfsd: remove unnecessary stateowner existence check.

At OPEN:
Check for delegations in the process of being recalled.
Attempt to hand out a delegation.
Signed-off-by: default avatarAndy Adamson <andros@citi.umich.edu>
Signed-off-by: default avatarNeil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent a0e7d577
...@@ -1708,28 +1708,24 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf ...@@ -1708,28 +1708,24 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
{ {
struct nfs4_stateowner *sop = open->op_stateowner; struct nfs4_stateowner *sop = open->op_stateowner;
struct nfs4_file *fp = NULL; struct nfs4_file *fp = NULL;
struct inode *ino; struct inode *ino = current_fh->fh_dentry->d_inode;
unsigned int fi_hashval; unsigned int fi_hashval;
struct nfs4_stateid *stp = NULL; struct nfs4_stateid *stp = NULL;
int status; int status, delegflag = 0;
status = nfserr_resource;
if (!sop)
return status;
ino = current_fh->fh_dentry->d_inode;
status = nfserr_inval; status = nfserr_inval;
if (!TEST_ACCESS(open->op_share_access) || !TEST_DENY(open->op_share_deny)) if (!TEST_ACCESS(open->op_share_access) || !TEST_DENY(open->op_share_deny))
goto out; goto out;
/* /*
* Lookup file; if found, lookup stateid and check open request; * Lookup file; if found, lookup stateid and check open request,
* not found, create * and check for delegations in the process of being recalled.
* If not found, create the nfs4_file struct
*/ */
fi_hashval = file_hashval(ino); fi_hashval = file_hashval(ino);
if (find_file(fi_hashval, ino, &fp)) { if (find_file(fi_hashval, ino, &fp)) {
status = nfs4_check_open(fp, sop, open, &stp); if ((status = nfs4_check_open(fp, sop, open, &stp)))
if (status) goto out;
if ((status = nfs4_check_deleg_recall(fp, open, &delegflag)))
goto out; goto out;
} else { } else {
status = nfserr_resource; status = nfserr_resource;
...@@ -1769,14 +1765,20 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf ...@@ -1769,14 +1765,20 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
} }
} }
} }
dprintk("nfs4_process_open2: stateid=(%08x/%08x/%08x/%08x)\n",
stp->st_stateid.si_boot, stp->st_stateid.si_stateownerid,
stp->st_stateid.si_fileid, stp->st_stateid.si_generation);
memcpy(&open->op_stateid, &stp->st_stateid, sizeof(stateid_t)); memcpy(&open->op_stateid, &stp->st_stateid, sizeof(stateid_t));
open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE; /*
* Attempt to hand out a delegation. No error return, because the
* OPEN succeeds even if we fail.
*/
nfs4_open_delegation(current_fh, open, stp, &delegflag);
open->op_delegate_type = delegflag;
status = nfs_ok; status = nfs_ok;
dprintk("nfs4_process_open2: stateid=(%08x/%08x/%08x/%08x)\n",
stp->st_stateid.si_boot, stp->st_stateid.si_stateownerid,
stp->st_stateid.si_fileid, stp->st_stateid.si_generation);
out: out:
/* take the opportunity to clean up unused state */ /* take the opportunity to clean up unused state */
if (fp && list_empty(&fp->fi_perfile)) if (fp && list_empty(&fp->fi_perfile))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment