diff options
author | Jeff Layton <jlayton@primarydata.com> | 2014-07-10 14:07:35 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2014-07-11 11:06:38 -0400 |
commit | a46cb7f2878d22b5df190970416cea40982ec2fb (patch) | |
tree | 80c1e2dbe7b1968d057587486b8fe70be4fd7562 /fs/nfsd/nfs4state.c | |
parent | baeb4ff0e50281db6925223a096a506f02993b88 (diff) |
nfsd: cleanup and rename nfs4_check_open
Rename it to better describe what it does, and have it just return the
stateid instead of a __be32 (which is now always nfs_ok). Also, do the
search for an existing stateid after the delegation check, to reduce
cleanup if the delegation check returns error.
Signed-off-by: Jeff Layton <jlayton@primarydata.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r-- | fs/nfsd/nfs4state.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index da88b31c0afe..225f98c7d00d 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -3297,10 +3297,10 @@ out: | |||
3297 | return nfs_ok; | 3297 | return nfs_ok; |
3298 | } | 3298 | } |
3299 | 3299 | ||
3300 | static __be32 | 3300 | static struct nfs4_ol_stateid * |
3301 | nfs4_check_open(struct nfs4_file *fp, struct nfsd4_open *open, struct nfs4_ol_stateid **stpp) | 3301 | nfsd4_find_existing_open(struct nfs4_file *fp, struct nfsd4_open *open) |
3302 | { | 3302 | { |
3303 | struct nfs4_ol_stateid *local; | 3303 | struct nfs4_ol_stateid *local, *ret = NULL; |
3304 | struct nfs4_openowner *oo = open->op_openowner; | 3304 | struct nfs4_openowner *oo = open->op_openowner; |
3305 | 3305 | ||
3306 | spin_lock(&fp->fi_lock); | 3306 | spin_lock(&fp->fi_lock); |
@@ -3308,14 +3308,13 @@ nfs4_check_open(struct nfs4_file *fp, struct nfsd4_open *open, struct nfs4_ol_st | |||
3308 | /* ignore lock owners */ | 3308 | /* ignore lock owners */ |
3309 | if (local->st_stateowner->so_is_open_owner == 0) | 3309 | if (local->st_stateowner->so_is_open_owner == 0) |
3310 | continue; | 3310 | continue; |
3311 | /* remember if we have seen this open owner */ | ||
3312 | if (local->st_stateowner == &oo->oo_owner) { | 3311 | if (local->st_stateowner == &oo->oo_owner) { |
3313 | *stpp = local; | 3312 | ret = local; |
3314 | break; | 3313 | break; |
3315 | } | 3314 | } |
3316 | } | 3315 | } |
3317 | spin_unlock(&fp->fi_lock); | 3316 | spin_unlock(&fp->fi_lock); |
3318 | return nfs_ok; | 3317 | return ret; |
3319 | } | 3318 | } |
3320 | 3319 | ||
3321 | static inline int nfs4_access_to_access(u32 nfs4_access) | 3320 | static inline int nfs4_access_to_access(u32 nfs4_access) |
@@ -3658,12 +3657,10 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf | |||
3658 | */ | 3657 | */ |
3659 | fp = find_or_add_file(ino, open->op_file); | 3658 | fp = find_or_add_file(ino, open->op_file); |
3660 | if (fp != open->op_file) { | 3659 | if (fp != open->op_file) { |
3661 | status = nfs4_check_open(fp, open, &stp); | ||
3662 | if (status) | ||
3663 | goto out; | ||
3664 | status = nfs4_check_deleg(cl, open, &dp); | 3660 | status = nfs4_check_deleg(cl, open, &dp); |
3665 | if (status) | 3661 | if (status) |
3666 | goto out; | 3662 | goto out; |
3663 | stp = nfsd4_find_existing_open(fp, open); | ||
3667 | } else { | 3664 | } else { |
3668 | open->op_file = NULL; | 3665 | open->op_file = NULL; |
3669 | status = nfserr_bad_stateid; | 3666 | status = nfserr_bad_stateid; |