diff options
author | J. Bruce Fields <bfields@redhat.com> | 2011-09-08 12:07:44 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2011-09-13 18:30:32 -0400 |
commit | d5477a8db8134c481ad7b4b745f6defa119253e1 (patch) | |
tree | dba3b9a52068041ddaa2bcdfb88dd181fb698c6e | |
parent | dcef0413da9a17bfca917d8b49baf309ce76b737 (diff) |
nfsd4: add common dl_stid field to delegation
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
-rw-r--r-- | fs/nfsd/nfs4callback.c | 2 | ||||
-rw-r--r-- | fs/nfsd/nfs4state.c | 20 | ||||
-rw-r--r-- | fs/nfsd/state.h | 20 |
3 files changed, 22 insertions, 20 deletions
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c index 02eb4edf0ece..93b5e405ad38 100644 --- a/fs/nfsd/nfs4callback.c +++ b/fs/nfsd/nfs4callback.c | |||
@@ -351,7 +351,7 @@ static void encode_cb_recall4args(struct xdr_stream *xdr, | |||
351 | __be32 *p; | 351 | __be32 *p; |
352 | 352 | ||
353 | encode_nfs_cb_opnum4(xdr, OP_CB_RECALL); | 353 | encode_nfs_cb_opnum4(xdr, OP_CB_RECALL); |
354 | encode_stateid4(xdr, &dp->dl_stateid); | 354 | encode_stateid4(xdr, &dp->dl_stid.sc_stateid); |
355 | 355 | ||
356 | p = xdr_reserve_space(xdr, 4); | 356 | p = xdr_reserve_space(xdr, 4); |
357 | *p++ = xdr_zero; /* truncate */ | 357 | *p++ = xdr_zero; /* truncate */ |
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index d0bb5a5613a9..3e3d605d3e73 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -247,10 +247,10 @@ alloc_init_deleg(struct nfs4_client *clp, struct nfs4_ol_stateid *stp, struct sv | |||
247 | get_nfs4_file(fp); | 247 | get_nfs4_file(fp); |
248 | dp->dl_file = fp; | 248 | dp->dl_file = fp; |
249 | dp->dl_type = type; | 249 | dp->dl_type = type; |
250 | dp->dl_stateid.si_boot = boot_time; | 250 | dp->dl_stid.sc_stateid.si_boot = boot_time; |
251 | dp->dl_stateid.si_stateownerid = current_delegid++; | 251 | dp->dl_stid.sc_stateid.si_stateownerid = current_delegid++; |
252 | dp->dl_stateid.si_fileid = 0; | 252 | dp->dl_stid.sc_stateid.si_fileid = 0; |
253 | dp->dl_stateid.si_generation = 1; | 253 | dp->dl_stid.sc_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); |
@@ -2572,7 +2572,7 @@ find_delegation_file(struct nfs4_file *fp, stateid_t *stid) | |||
2572 | 2572 | ||
2573 | spin_lock(&recall_lock); | 2573 | spin_lock(&recall_lock); |
2574 | list_for_each_entry(dp, &fp->fi_delegations, dl_perfile) | 2574 | list_for_each_entry(dp, &fp->fi_delegations, dl_perfile) |
2575 | if (dp->dl_stateid.si_stateownerid == stid->si_stateownerid) { | 2575 | if (dp->dl_stid.sc_stateid.si_stateownerid == stid->si_stateownerid) { |
2576 | spin_unlock(&recall_lock); | 2576 | spin_unlock(&recall_lock); |
2577 | return dp; | 2577 | return dp; |
2578 | } | 2578 | } |
@@ -2861,10 +2861,10 @@ nfs4_open_delegation(struct svc_fh *fh, struct nfsd4_open *open, struct nfs4_ol_ | |||
2861 | if (status) | 2861 | if (status) |
2862 | goto out_free; | 2862 | goto out_free; |
2863 | 2863 | ||
2864 | memcpy(&open->op_delegate_stateid, &dp->dl_stateid, sizeof(dp->dl_stateid)); | 2864 | memcpy(&open->op_delegate_stateid, &dp->dl_stid.sc_stateid, sizeof(dp->dl_stid.sc_stateid)); |
2865 | 2865 | ||
2866 | dprintk("NFSD: delegation stateid=" STATEID_FMT "\n", | 2866 | dprintk("NFSD: delegation stateid=" STATEID_FMT "\n", |
2867 | STATEID_VAL(&dp->dl_stateid)); | 2867 | STATEID_VAL(&dp->dl_stid.sc_stateid)); |
2868 | out: | 2868 | out: |
2869 | if (open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS | 2869 | if (open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS |
2870 | && flag == NFS4_OPEN_DELEGATE_NONE | 2870 | && flag == NFS4_OPEN_DELEGATE_NONE |
@@ -3296,7 +3296,7 @@ nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate, | |||
3296 | dp = find_delegation_stateid(ino, stateid); | 3296 | dp = find_delegation_stateid(ino, stateid); |
3297 | if (!dp) | 3297 | if (!dp) |
3298 | goto out; | 3298 | goto out; |
3299 | status = check_stateid_generation(stateid, &dp->dl_stateid, nfsd4_has_session(cstate)); | 3299 | status = check_stateid_generation(stateid, &dp->dl_stid.sc_stateid, nfsd4_has_session(cstate)); |
3300 | if (status) | 3300 | if (status) |
3301 | goto out; | 3301 | goto out; |
3302 | status = nfs4_check_delegmode(dp, flags); | 3302 | status = nfs4_check_delegmode(dp, flags); |
@@ -3667,7 +3667,7 @@ nfsd4_delegreturn(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
3667 | dp = find_delegation_stateid(inode, stateid); | 3667 | dp = find_delegation_stateid(inode, stateid); |
3668 | if (!dp) | 3668 | if (!dp) |
3669 | goto out; | 3669 | goto out; |
3670 | status = check_stateid_generation(stateid, &dp->dl_stateid, nfsd4_has_session(cstate)); | 3670 | status = check_stateid_generation(stateid, &dp->dl_stid.sc_stateid, nfsd4_has_session(cstate)); |
3671 | if (status) | 3671 | if (status) |
3672 | goto out; | 3672 | goto out; |
3673 | renew_client(dp->dl_client); | 3673 | renew_client(dp->dl_client); |
@@ -3737,7 +3737,7 @@ search_for_delegation(stateid_t *stid) | |||
3737 | list_for_each_entry(fp, &file_hashtbl[i], fi_hash) { | 3737 | list_for_each_entry(fp, &file_hashtbl[i], fi_hash) { |
3738 | list_for_each(pos, &fp->fi_delegations) { | 3738 | list_for_each(pos, &fp->fi_delegations) { |
3739 | dp = list_entry(pos, struct nfs4_delegation, dl_perfile); | 3739 | dp = list_entry(pos, struct nfs4_delegation, dl_perfile); |
3740 | if (same_stateid(&dp->dl_stateid, stid)) | 3740 | if (same_stateid(&dp->dl_stid.sc_stateid, stid)) |
3741 | return dp; | 3741 | return dp; |
3742 | } | 3742 | } |
3743 | } | 3743 | } |
diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h index d7fffabb8d56..e3ff7c9f9264 100644 --- a/fs/nfsd/state.h +++ b/fs/nfsd/state.h | |||
@@ -76,6 +76,15 @@ struct nfsd4_callback { | |||
76 | bool cb_done; | 76 | bool cb_done; |
77 | }; | 77 | }; |
78 | 78 | ||
79 | struct nfs4_stid { | ||
80 | #define NFS4_OPEN_STID 1 | ||
81 | #define NFS4_LOCK_STID 2 | ||
82 | #define NFS4_DELEG_STID 4 | ||
83 | char sc_type; | ||
84 | struct list_head sc_hash; | ||
85 | stateid_t sc_stateid; | ||
86 | }; | ||
87 | |||
79 | struct nfs4_delegation { | 88 | struct nfs4_delegation { |
80 | struct list_head dl_perfile; | 89 | struct list_head dl_perfile; |
81 | struct list_head dl_perclnt; | 90 | struct list_head dl_perclnt; |
@@ -86,7 +95,7 @@ struct nfs4_delegation { | |||
86 | u32 dl_type; | 95 | u32 dl_type; |
87 | time_t dl_time; | 96 | time_t dl_time; |
88 | /* For recall: */ | 97 | /* For recall: */ |
89 | stateid_t dl_stateid; | 98 | struct nfs4_stid dl_stid; |
90 | struct knfsd_fh dl_fh; | 99 | struct knfsd_fh dl_fh; |
91 | int dl_retries; | 100 | int dl_retries; |
92 | struct nfsd4_callback dl_recall; | 101 | struct nfsd4_callback dl_recall; |
@@ -446,14 +455,7 @@ static inline struct file *find_any_file(struct nfs4_file *f) | |||
446 | * we should consider defining separate structs for the two cases. | 455 | * we should consider defining separate structs for the two cases. |
447 | */ | 456 | */ |
448 | 457 | ||
449 | struct nfs4_stid { | 458 | /* "ol" stands for "Open or Lock". Better suggestions welcome. */ |
450 | #define NFS4_OPEN_STID 1 | ||
451 | #define NFS4_LOCK_STID 2 | ||
452 | char sc_type; | ||
453 | struct list_head sc_hash; | ||
454 | stateid_t sc_stateid; | ||
455 | }; | ||
456 | |||
457 | struct nfs4_ol_stateid { | 459 | struct nfs4_ol_stateid { |
458 | struct nfs4_stid st_stid; | 460 | struct nfs4_stid st_stid; |
459 | struct list_head st_perfile; | 461 | struct list_head st_perfile; |