aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2010-07-28 12:21:23 -0400
committerJ. Bruce Fields <bfields@redhat.com>2010-07-29 16:34:29 -0400
commit21fb4016bd592409bc8f95737e365ac82413b795 (patch)
tree1d32bc2bc709dec0ffbd8453f6eb1f50871b99db /fs/nfsd
parentc3e480808685dd13f03af1a8fdda581dcb54d92c (diff)
nfsd4: miscellaneous process_open2 cleanup
Move more work into helper functions. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/nfs4state.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index c07c9885f580..d9c8232fc62f 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -2317,10 +2317,21 @@ nfs4_alloc_stateid(void)
2317 return kmem_cache_alloc(stateid_slab, GFP_KERNEL); 2317 return kmem_cache_alloc(stateid_slab, GFP_KERNEL);
2318} 2318}
2319 2319
2320static inline int nfs4_access_to_access(u32 nfs4_access)
2321{
2322 int flags = 0;
2323
2324 if (nfs4_access & NFS4_SHARE_ACCESS_READ)
2325 flags |= NFSD_MAY_READ;
2326 if (nfs4_access & NFS4_SHARE_ACCESS_WRITE)
2327 flags |= NFSD_MAY_WRITE;
2328 return flags;
2329}
2330
2320static __be32 2331static __be32
2321nfs4_new_open(struct svc_rqst *rqstp, struct nfs4_stateid **stpp, 2332nfs4_new_open(struct svc_rqst *rqstp, struct nfs4_stateid **stpp,
2322 struct nfs4_delegation *dp, 2333 struct nfs4_delegation *dp,
2323 struct svc_fh *cur_fh, int flags) 2334 struct svc_fh *cur_fh, struct nfsd4_open *open)
2324{ 2335{
2325 struct nfs4_stateid *stp; 2336 struct nfs4_stateid *stp;
2326 2337
@@ -2333,8 +2344,10 @@ nfs4_new_open(struct svc_rqst *rqstp, struct nfs4_stateid **stpp,
2333 stp->st_vfs_file = dp->dl_vfs_file; 2344 stp->st_vfs_file = dp->dl_vfs_file;
2334 } else { 2345 } else {
2335 __be32 status; 2346 __be32 status;
2336 status = nfsd_open(rqstp, cur_fh, S_IFREG, flags, 2347 int access = nfs4_access_to_access(open->op_share_access);
2337 &stp->st_vfs_file); 2348
2349 status = nfsd_open(rqstp, cur_fh, S_IFREG, access,
2350 &stp->st_vfs_file);
2338 if (status) { 2351 if (status) {
2339 if (status == nfserr_dropit) 2352 if (status == nfserr_dropit)
2340 status = nfserr_jukebox; 2353 status = nfserr_jukebox;
@@ -2531,12 +2544,7 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
2531 update_stateid(&stp->st_stateid); 2544 update_stateid(&stp->st_stateid);
2532 } else { 2545 } else {
2533 /* Stateid was not found, this is a new OPEN */ 2546 /* Stateid was not found, this is a new OPEN */
2534 int flags = 0; 2547 status = nfs4_new_open(rqstp, &stp, dp, current_fh, open);
2535 if (open->op_share_access & NFS4_SHARE_ACCESS_READ)
2536 flags |= NFSD_MAY_READ;
2537 if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE)
2538 flags |= NFSD_MAY_WRITE;
2539 status = nfs4_new_open(rqstp, &stp, dp, current_fh, flags);
2540 if (status) 2548 if (status)
2541 goto out; 2549 goto out;
2542 init_stateid(stp, fp, open); 2550 init_stateid(stp, fp, open);