diff options
author | J. Bruce Fields <bfields@redhat.com> | 2011-08-31 15:25:46 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2011-08-31 17:55:59 -0400 |
commit | 5fa0bbb4ee5481a6b3e83c4968142ca433d71914 (patch) | |
tree | c49d35667fdbb86979b92f0c51c1492b45c47332 /fs/nfsd | |
parent | c2d8eb7ac645e1baba7205cb2631e2f21db3d6a9 (diff) |
nfsd4: simplify distinguishing lock & open stateid's
The trick free_stateid is using is a little cheesy, and we'll have more
uses for this field later.
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd')
-rw-r--r-- | fs/nfsd/nfs4state.c | 9 | ||||
-rw-r--r-- | fs/nfsd/state.h | 3 |
2 files changed, 6 insertions, 6 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index d2b637b717c3..7de214b860db 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -2285,6 +2285,7 @@ init_stateid(struct nfs4_stateid *stp, struct nfs4_file *fp, struct nfsd4_open * | |||
2285 | list_add(&stp->st_hash, &stateid_hashtbl[hashval]); | 2285 | list_add(&stp->st_hash, &stateid_hashtbl[hashval]); |
2286 | list_add(&stp->st_perstateowner, &sop->so_stateids); | 2286 | list_add(&stp->st_perstateowner, &sop->so_stateids); |
2287 | list_add(&stp->st_perfile, &fp->fi_stateids); | 2287 | list_add(&stp->st_perfile, &fp->fi_stateids); |
2288 | stp->st_type = NFS4_OPEN_STID; | ||
2288 | stp->st_stateowner = sop; | 2289 | stp->st_stateowner = sop; |
2289 | get_nfs4_file(fp); | 2290 | get_nfs4_file(fp); |
2290 | stp->st_file = fp; | 2291 | stp->st_file = fp; |
@@ -3201,11 +3202,6 @@ static int is_delegation_stateid(stateid_t *stateid) | |||
3201 | return stateid->si_fileid == 0; | 3202 | return stateid->si_fileid == 0; |
3202 | } | 3203 | } |
3203 | 3204 | ||
3204 | static int is_open_stateid(struct nfs4_stateid *stateid) | ||
3205 | { | ||
3206 | return stateid->st_openstp == NULL; | ||
3207 | } | ||
3208 | |||
3209 | __be32 nfs4_validate_stateid(stateid_t *stateid, bool has_session) | 3205 | __be32 nfs4_validate_stateid(stateid_t *stateid, bool has_session) |
3210 | { | 3206 | { |
3211 | struct nfs4_stateid *stp = NULL; | 3207 | struct nfs4_stateid *stp = NULL; |
@@ -3369,7 +3365,7 @@ nfsd4_free_stateid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
3369 | } | 3365 | } |
3370 | } | 3366 | } |
3371 | 3367 | ||
3372 | if (is_open_stateid(stp)) { | 3368 | if (stp->st_type == NFS4_OPEN_STID) { |
3373 | ret = nfserr_locks_held; | 3369 | ret = nfserr_locks_held; |
3374 | goto out; | 3370 | goto out; |
3375 | } else { | 3371 | } else { |
@@ -3928,6 +3924,7 @@ alloc_init_lock_stateid(struct nfs4_stateowner *sop, struct nfs4_file *fp, struc | |||
3928 | list_add(&stp->st_perfile, &fp->fi_stateids); | 3924 | list_add(&stp->st_perfile, &fp->fi_stateids); |
3929 | list_add(&stp->st_perstateowner, &sop->so_stateids); | 3925 | list_add(&stp->st_perstateowner, &sop->so_stateids); |
3930 | stp->st_stateowner = sop; | 3926 | stp->st_stateowner = sop; |
3927 | stp->st_type = NFS4_LOCK_STID; | ||
3931 | get_nfs4_file(fp); | 3928 | get_nfs4_file(fp); |
3932 | stp->st_file = fp; | 3929 | stp->st_file = fp; |
3933 | stp->st_stateid.si_boot = boot_time; | 3930 | stp->st_stateid.si_boot = boot_time; |
diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h index 6b706a60ce88..a06f55bd38b6 100644 --- a/fs/nfsd/state.h +++ b/fs/nfsd/state.h | |||
@@ -425,6 +425,9 @@ static inline struct file *find_any_file(struct nfs4_file *f) | |||
425 | */ | 425 | */ |
426 | 426 | ||
427 | struct nfs4_stateid { | 427 | struct nfs4_stateid { |
428 | #define NFS4_OPEN_STID 1 | ||
429 | #define NFS4_LOCK_STID 2 | ||
430 | char st_type; | ||
428 | struct list_head st_hash; | 431 | struct list_head st_hash; |
429 | struct list_head st_perfile; | 432 | struct list_head st_perfile; |
430 | struct list_head st_perstateowner; | 433 | struct list_head st_perstateowner; |