diff options
author | J. Bruce Fields <bfields@redhat.com> | 2011-09-09 11:54:57 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2011-09-13 18:30:36 -0400 |
commit | 69064a2764fe195f1478be3ea83d15abe5d71025 (patch) | |
tree | 7db5da71f823e8ca1fae8963a5c47f51c3af159f | |
parent | 97b7e3b6d4ae838694b43f66b4f0b32b5ec7635b (diff) |
nfsd4: use deleg changes to cleanup preprocess_stateid_op
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
-rw-r--r-- | fs/nfsd/nfs4state.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 30387f3d9881..ea338d0c62a1 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -3290,6 +3290,7 @@ __be32 | |||
3290 | nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate, | 3290 | nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate, |
3291 | stateid_t *stateid, int flags, struct file **filpp) | 3291 | stateid_t *stateid, int flags, struct file **filpp) |
3292 | { | 3292 | { |
3293 | struct nfs4_stid *s; | ||
3293 | struct nfs4_ol_stateid *stp = NULL; | 3294 | struct nfs4_ol_stateid *stp = NULL; |
3294 | struct nfs4_delegation *dp = NULL; | 3295 | struct nfs4_delegation *dp = NULL; |
3295 | struct svc_fh *current_fh = &cstate->current_fh; | 3296 | struct svc_fh *current_fh = &cstate->current_fh; |
@@ -3314,13 +3315,14 @@ nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate, | |||
3314 | * but that we can't find, is expired: | 3315 | * but that we can't find, is expired: |
3315 | */ | 3316 | */ |
3316 | status = nfserr_expired; | 3317 | status = nfserr_expired; |
3317 | if (is_delegation_stateid(stateid)) { | 3318 | s = find_stateid(stateid); |
3318 | dp = find_deleg_stateid(stateid); | 3319 | if (!s) |
3319 | if (!dp) | 3320 | goto out; |
3320 | goto out; | 3321 | status = check_stateid_generation(stateid, &s->sc_stateid, nfsd4_has_session(cstate)); |
3321 | status = check_stateid_generation(stateid, &dp->dl_stid.sc_stateid, nfsd4_has_session(cstate)); | 3322 | if (status) |
3322 | if (status) | 3323 | goto out; |
3323 | goto out; | 3324 | if (s->sc_type == NFS4_DELEG_STID) { |
3325 | dp = delegstateid(s); | ||
3324 | status = nfs4_check_delegmode(dp, flags); | 3326 | status = nfs4_check_delegmode(dp, flags); |
3325 | if (status) | 3327 | if (status) |
3326 | goto out; | 3328 | goto out; |
@@ -3330,19 +3332,13 @@ nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate, | |||
3330 | BUG_ON(!*filpp); | 3332 | BUG_ON(!*filpp); |
3331 | } | 3333 | } |
3332 | } else { /* open or lock stateid */ | 3334 | } else { /* open or lock stateid */ |
3333 | stp = find_ol_stateid(stateid); | 3335 | stp = openlockstateid(s); |
3334 | if (!stp) | ||
3335 | goto out; | ||
3336 | status = nfserr_bad_stateid; | 3336 | status = nfserr_bad_stateid; |
3337 | if (nfs4_check_fh(current_fh, stp)) | 3337 | if (nfs4_check_fh(current_fh, stp)) |
3338 | goto out; | 3338 | goto out; |
3339 | if (stp->st_stateowner->so_is_open_owner | 3339 | if (stp->st_stateowner->so_is_open_owner |
3340 | && !openowner(stp->st_stateowner)->oo_confirmed) | 3340 | && !openowner(stp->st_stateowner)->oo_confirmed) |
3341 | goto out; | 3341 | goto out; |
3342 | status = check_stateid_generation(stateid, &stp->st_stid.sc_stateid, | ||
3343 | nfsd4_has_session(cstate)); | ||
3344 | if (status) | ||
3345 | goto out; | ||
3346 | status = nfs4_check_openmode(stp, flags); | 3342 | status = nfs4_check_openmode(stp, flags); |
3347 | if (status) | 3343 | if (status) |
3348 | goto out; | 3344 | goto out; |