diff options
author | J. Bruce Fields <bfields@redhat.com> | 2011-10-12 16:24:27 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2011-10-17 17:09:37 -0400 |
commit | a50d2ad1721c0c785e9a74c0003ca044de6868a5 (patch) | |
tree | 2664edfe88903ea29c1b195b46442cac950e0a30 /fs/nfsd/nfs4state.c | |
parent | 01cd4afadbf376de07d364a632cc82a0fc5e8655 (diff) |
nfsd4: centralize renew_client() calls
There doesn't seem to be any harm to renewing the client a bit earlier,
when it is looked up. That saves us from having to sprinkle
renew_client calls over quite so many places.
Also remove a redundant comment and do a little cleanup.
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r-- | fs/nfsd/nfs4state.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 2042805da960..d90461eb9368 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -931,9 +931,6 @@ renew_client_locked(struct nfs4_client *clp) | |||
931 | return; | 931 | return; |
932 | } | 932 | } |
933 | 933 | ||
934 | /* | ||
935 | * Move client to the end to the LRU list. | ||
936 | */ | ||
937 | dprintk("renewing client (clientid %08x/%08x)\n", | 934 | dprintk("renewing client (clientid %08x/%08x)\n", |
938 | clp->cl_clientid.cl_boot, | 935 | clp->cl_clientid.cl_boot, |
939 | clp->cl_clientid.cl_id); | 936 | clp->cl_clientid.cl_id); |
@@ -1220,8 +1217,10 @@ find_confirmed_client(clientid_t *clid) | |||
1220 | unsigned int idhashval = clientid_hashval(clid->cl_id); | 1217 | unsigned int idhashval = clientid_hashval(clid->cl_id); |
1221 | 1218 | ||
1222 | list_for_each_entry(clp, &conf_id_hashtbl[idhashval], cl_idhash) { | 1219 | list_for_each_entry(clp, &conf_id_hashtbl[idhashval], cl_idhash) { |
1223 | if (same_clid(&clp->cl_clientid, clid)) | 1220 | if (same_clid(&clp->cl_clientid, clid)) { |
1221 | renew_client(clp); | ||
1224 | return clp; | 1222 | return clp; |
1223 | } | ||
1225 | } | 1224 | } |
1226 | return NULL; | 1225 | return NULL; |
1227 | } | 1226 | } |
@@ -2372,11 +2371,15 @@ same_owner_str(struct nfs4_stateowner *sop, struct xdr_netobj *owner, | |||
2372 | static struct nfs4_openowner * | 2371 | static struct nfs4_openowner * |
2373 | find_openstateowner_str(unsigned int hashval, struct nfsd4_open *open) | 2372 | find_openstateowner_str(unsigned int hashval, struct nfsd4_open *open) |
2374 | { | 2373 | { |
2375 | struct nfs4_stateowner *so = NULL; | 2374 | struct nfs4_stateowner *so; |
2375 | struct nfs4_openowner *oo; | ||
2376 | 2376 | ||
2377 | list_for_each_entry(so, &open_ownerstr_hashtbl[hashval], so_strhash) { | 2377 | list_for_each_entry(so, &open_ownerstr_hashtbl[hashval], so_strhash) { |
2378 | if (same_owner_str(so, &open->op_owner, &open->op_clientid)) | 2378 | if (same_owner_str(so, &open->op_owner, &open->op_clientid)) { |
2379 | return container_of(so, struct nfs4_openowner, oo_owner); | 2379 | oo = openowner(so); |
2380 | renew_client(oo->oo_owner.so_client); | ||
2381 | return oo; | ||
2382 | } | ||
2380 | } | 2383 | } |
2381 | return NULL; | 2384 | return NULL; |
2382 | } | 2385 | } |
@@ -2536,7 +2539,6 @@ renew: | |||
2536 | open->op_openowner = oo; | 2539 | open->op_openowner = oo; |
2537 | } | 2540 | } |
2538 | list_del_init(&oo->oo_close_lru); | 2541 | list_del_init(&oo->oo_close_lru); |
2539 | renew_client(oo->oo_owner.so_client); | ||
2540 | return nfs_ok; | 2542 | return nfs_ok; |
2541 | } | 2543 | } |
2542 | 2544 | ||
@@ -2970,7 +2972,6 @@ nfsd4_renew(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
2970 | dprintk("nfsd4_renew: clientid not found!\n"); | 2972 | dprintk("nfsd4_renew: clientid not found!\n"); |
2971 | goto out; | 2973 | goto out; |
2972 | } | 2974 | } |
2973 | renew_client(clp); | ||
2974 | status = nfserr_cb_path_down; | 2975 | status = nfserr_cb_path_down; |
2975 | if (!list_empty(&clp->cl_delegations) | 2976 | if (!list_empty(&clp->cl_delegations) |
2976 | && clp->cl_cb_state != NFSD4_CB_UP) | 2977 | && clp->cl_cb_state != NFSD4_CB_UP) |
@@ -3275,7 +3276,6 @@ nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate, | |||
3275 | status = nfs4_check_delegmode(dp, flags); | 3276 | status = nfs4_check_delegmode(dp, flags); |
3276 | if (status) | 3277 | if (status) |
3277 | goto out; | 3278 | goto out; |
3278 | renew_client(dp->dl_stid.sc_client); | ||
3279 | if (filpp) { | 3279 | if (filpp) { |
3280 | *filpp = dp->dl_file->fi_deleg_file; | 3280 | *filpp = dp->dl_file->fi_deleg_file; |
3281 | BUG_ON(!*filpp); | 3281 | BUG_ON(!*filpp); |
@@ -3293,7 +3293,6 @@ nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate, | |||
3293 | status = nfs4_check_openmode(stp, flags); | 3293 | status = nfs4_check_openmode(stp, flags); |
3294 | if (status) | 3294 | if (status) |
3295 | goto out; | 3295 | goto out; |
3296 | renew_client(stp->st_stateowner->so_client); | ||
3297 | if (filpp) { | 3296 | if (filpp) { |
3298 | if (flags & RD_STATE) | 3297 | if (flags & RD_STATE) |
3299 | *filpp = find_readable_file(stp->st_file); | 3298 | *filpp = find_readable_file(stp->st_file); |
@@ -3412,7 +3411,6 @@ nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid, | |||
3412 | return status; | 3411 | return status; |
3413 | *stpp = openlockstateid(s); | 3412 | *stpp = openlockstateid(s); |
3414 | cstate->replay_owner = (*stpp)->st_stateowner; | 3413 | cstate->replay_owner = (*stpp)->st_stateowner; |
3415 | renew_client((*stpp)->st_stateowner->so_client); | ||
3416 | 3414 | ||
3417 | return nfs4_seqid_op_checks(cstate, stateid, seqid, *stpp); | 3415 | return nfs4_seqid_op_checks(cstate, stateid, seqid, *stpp); |
3418 | } | 3416 | } |
@@ -3643,7 +3641,6 @@ nfsd4_delegreturn(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
3643 | status = check_stateid_generation(stateid, &dp->dl_stid.sc_stateid, nfsd4_has_session(cstate)); | 3641 | status = check_stateid_generation(stateid, &dp->dl_stid.sc_stateid, nfsd4_has_session(cstate)); |
3644 | if (status) | 3642 | if (status) |
3645 | goto out; | 3643 | goto out; |
3646 | renew_client(dp->dl_stid.sc_client); | ||
3647 | 3644 | ||
3648 | unhash_delegation(dp); | 3645 | unhash_delegation(dp); |
3649 | out: | 3646 | out: |