Commit acaf3141 authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] nfsd4: simplify open_delegation 2

Simplify logic in nfs4_open_delegation, fix a small bug on allocation failure.
Signed-off-by: default avatarAndy Adamson <andros@citi.umich.edu>
Signed-off-by: default avatarJ. Bruce Fields <bfields@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 c6d7637d
......@@ -1664,20 +1664,21 @@ nfs4_open_delegation(struct svc_fh *fh, struct nfsd4_open *open, struct nfs4_sta
if (*flag == NFS4_OPEN_DELEGATE_NONE)
return;
/* set flag */
*flag = NFS4_OPEN_DELEGATE_NONE;
if (open->op_claim_type != NFS4_OPEN_CLAIM_NULL
|| !atomic_read(&cb->cb_set) || !sop->so_confirmed)
return;
if (!(open->op_share_access & NFS4_SHARE_ACCESS_WRITE))
*flag = NFS4_OPEN_DELEGATE_READ;
else if (!(open->op_share_access & NFS4_SHARE_ACCESS_READ))
if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE)
*flag = NFS4_OPEN_DELEGATE_WRITE;
else
*flag = NFS4_OPEN_DELEGATE_READ;
if (!(dp = alloc_init_deleg(sop->so_client, stp->st_file, fh, *flag)))
dp = alloc_init_deleg(sop->so_client, stp->st_file, fh, *flag);
if (dp == NULL) {
*flag = NFS4_OPEN_DELEGATE_NONE;
return;
}
locks_init_lock(&fl);
fl.fl_lmops = &nfsd_lease_mng_ops;
fl.fl_flags = FL_LEASE;
......
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