2005-03-08 06:07:21

by NeilBrown

[permalink] [raw]
Subject: [PATCH kNFSd 19 of 54] nfsd4: simplify open_delegation 2



Simplify logic in nfs4_open_delegation, fix a small bug on allocation failure.

Signed-off-by: Andy Adamson <[email protected]>
Signed-off-by: J. Bruce Fields <[email protected]>
Signed-off-by: Neil Brown <[email protected]>

### Diffstat output
./fs/nfsd/nfs4state.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)

diff ./fs/nfsd/nfs4state.c~current~ ./fs/nfsd/nfs4state.c
--- ./fs/nfsd/nfs4state.c~current~ 2005-03-07 11:35:55.000000000 +1100
+++ ./fs/nfsd/nfs4state.c 2005-03-07 11:35:56.000000000 +1100
@@ -1664,20 +1664,21 @@ nfs4_open_delegation(struct svc_fh *fh,
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;


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs