diff options
author | J. Bruce Fields <bfields@redhat.com> | 2011-08-31 15:47:21 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2011-08-31 17:56:01 -0400 |
commit | 73997dc4183c580278ea8cb41c7a9655940801e0 (patch) | |
tree | fc1c3acac955975d876035501be6b4d5d50090be /fs/nfsd | |
parent | 81b829655d418316f0707b3656b45cff7a1dbf12 (diff) |
nfsd4: make delegation stateid's seqid start at 1
Thanks to Casey for reminding me that 5661 gives a special meaning to a
value of 0 in the stateid's seqid field, so all stateid's should start
out with si_generation 1. We were doing that in the open and lock
cases for minorversion 1, but not for the delegation stateid, and not
for openstateid's with v4.0.
It doesn't *really* matter much for v4.0 or for delegation stateid's
(which never get the seqid field incremented), but we may as well do the
same for all of them.
Reported-by: Casey Bodley <cbodley@citi.umich.edu>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd')
-rw-r--r-- | fs/nfsd/nfs4state.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 106e8fa63cdf..80af79ee5d51 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -250,7 +250,7 @@ alloc_init_deleg(struct nfs4_client *clp, struct nfs4_stateid *stp, struct svc_f | |||
250 | dp->dl_stateid.si_boot = boot_time; | 250 | dp->dl_stateid.si_boot = boot_time; |
251 | dp->dl_stateid.si_stateownerid = current_delegid++; | 251 | dp->dl_stateid.si_stateownerid = current_delegid++; |
252 | dp->dl_stateid.si_fileid = 0; | 252 | dp->dl_stateid.si_fileid = 0; |
253 | dp->dl_stateid.si_generation = 0; | 253 | dp->dl_stateid.si_generation = 1; |
254 | fh_copy_shallow(&dp->dl_fh, ¤t_fh->fh_handle); | 254 | fh_copy_shallow(&dp->dl_fh, ¤t_fh->fh_handle); |
255 | dp->dl_time = 0; | 255 | dp->dl_time = 0; |
256 | atomic_set(&dp->dl_count, 1); | 256 | atomic_set(&dp->dl_count, 1); |
@@ -2291,6 +2291,7 @@ init_stateid(struct nfs4_stateid *stp, struct nfs4_file *fp, struct nfsd4_open * | |||
2291 | stp->st_stateid.si_boot = boot_time; | 2291 | stp->st_stateid.si_boot = boot_time; |
2292 | stp->st_stateid.si_stateownerid = sop->so_id; | 2292 | stp->st_stateid.si_stateownerid = sop->so_id; |
2293 | stp->st_stateid.si_fileid = fp->fi_id; | 2293 | stp->st_stateid.si_fileid = fp->fi_id; |
2294 | /* note will be incremented before first return to client: */ | ||
2294 | stp->st_stateid.si_generation = 0; | 2295 | stp->st_stateid.si_generation = 0; |
2295 | stp->st_access_bmap = 0; | 2296 | stp->st_access_bmap = 0; |
2296 | stp->st_deny_bmap = 0; | 2297 | stp->st_deny_bmap = 0; |
@@ -2894,7 +2895,6 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf | |||
2894 | status = nfs4_upgrade_open(rqstp, fp, current_fh, stp, open); | 2895 | status = nfs4_upgrade_open(rqstp, fp, current_fh, stp, open); |
2895 | if (status) | 2896 | if (status) |
2896 | goto out; | 2897 | goto out; |
2897 | update_stateid(&stp->st_stateid); | ||
2898 | } else { | 2898 | } else { |
2899 | status = nfs4_new_open(rqstp, &stp, fp, current_fh, open); | 2899 | status = nfs4_new_open(rqstp, &stp, fp, current_fh, open); |
2900 | if (status) | 2900 | if (status) |
@@ -2905,9 +2905,8 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf | |||
2905 | release_open_stateid(stp); | 2905 | release_open_stateid(stp); |
2906 | goto out; | 2906 | goto out; |
2907 | } | 2907 | } |
2908 | if (nfsd4_has_session(&resp->cstate)) | ||
2909 | update_stateid(&stp->st_stateid); | ||
2910 | } | 2908 | } |
2909 | update_stateid(&stp->st_stateid); | ||
2911 | memcpy(&open->op_stateid, &stp->st_stateid, sizeof(stateid_t)); | 2910 | memcpy(&open->op_stateid, &stp->st_stateid, sizeof(stateid_t)); |
2912 | 2911 | ||
2913 | if (nfsd4_has_session(&resp->cstate)) | 2912 | if (nfsd4_has_session(&resp->cstate)) |
@@ -3893,6 +3892,7 @@ alloc_init_lock_stateid(struct nfs4_stateowner *sop, struct nfs4_file *fp, struc | |||
3893 | stp->st_stateid.si_boot = boot_time; | 3892 | stp->st_stateid.si_boot = boot_time; |
3894 | stp->st_stateid.si_stateownerid = sop->so_id; | 3893 | stp->st_stateid.si_stateownerid = sop->so_id; |
3895 | stp->st_stateid.si_fileid = fp->fi_id; | 3894 | stp->st_stateid.si_fileid = fp->fi_id; |
3895 | /* note will be incremented before first return to client: */ | ||
3896 | stp->st_stateid.si_generation = 0; | 3896 | stp->st_stateid.si_generation = 0; |
3897 | stp->st_access_bmap = 0; | 3897 | stp->st_access_bmap = 0; |
3898 | stp->st_deny_bmap = open_stp->st_deny_bmap; | 3898 | stp->st_deny_bmap = open_stp->st_deny_bmap; |