diff options
| author | Benny Halevy <bhalevy@panasas.com> | 2010-05-11 17:13:41 -0400 |
|---|---|---|
| committer | J. Bruce Fields <bfields@citi.umich.edu> | 2010-05-13 11:47:22 -0400 |
| commit | 07cd4909a6c0c275ef42fd27748226975919e336 (patch) | |
| tree | 90ffb93321817320cdf3cf8dbd643272b5752f7a | |
| parent | 46583e2597af649f134462d2f2c1be5e6689198d (diff) | |
nfsd4: mark_client_expired
Mark the client as expired under the client_lock so it won't be renewed
when an nfsv4.1 session is done, after it was explicitly expired
during processing of the compound.
Do not renew a client mark as expired (in particular, it is not
on the lru list anymore)
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
| -rw-r--r-- | fs/nfsd/nfs4state.c | 10 | ||||
| -rw-r--r-- | fs/nfsd/state.h | 14 |
2 files changed, 23 insertions, 1 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index e439a882e0c2..98aa7e8827b9 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
| @@ -632,6 +632,14 @@ free_session(struct kref *kref) | |||
| 632 | static inline void | 632 | static inline void |
| 633 | renew_client_locked(struct nfs4_client *clp) | 633 | renew_client_locked(struct nfs4_client *clp) |
| 634 | { | 634 | { |
| 635 | if (is_client_expired(clp)) { | ||
| 636 | dprintk("%s: client (clientid %08x/%08x) already expired\n", | ||
| 637 | __func__, | ||
| 638 | clp->cl_clientid.cl_boot, | ||
| 639 | clp->cl_clientid.cl_id); | ||
| 640 | return; | ||
| 641 | } | ||
| 642 | |||
| 635 | /* | 643 | /* |
| 636 | * Move client to the end to the LRU list. | 644 | * Move client to the end to the LRU list. |
| 637 | */ | 645 | */ |
| @@ -697,6 +705,7 @@ free_client(struct nfs4_client *clp) | |||
| 697 | static inline void | 705 | static inline void |
| 698 | unhash_client_locked(struct nfs4_client *clp) | 706 | unhash_client_locked(struct nfs4_client *clp) |
| 699 | { | 707 | { |
| 708 | mark_client_expired(clp); | ||
| 700 | list_del(&clp->cl_lru); | 709 | list_del(&clp->cl_lru); |
| 701 | while (!list_empty(&clp->cl_sessions)) { | 710 | while (!list_empty(&clp->cl_sessions)) { |
| 702 | struct nfsd4_session *ses; | 711 | struct nfsd4_session *ses; |
| @@ -836,6 +845,7 @@ static struct nfs4_client *create_client(struct xdr_netobj name, char *recdir, | |||
| 836 | INIT_LIST_HEAD(&clp->cl_delegations); | 845 | INIT_LIST_HEAD(&clp->cl_delegations); |
| 837 | INIT_LIST_HEAD(&clp->cl_sessions); | 846 | INIT_LIST_HEAD(&clp->cl_sessions); |
| 838 | INIT_LIST_HEAD(&clp->cl_lru); | 847 | INIT_LIST_HEAD(&clp->cl_lru); |
| 848 | clp->cl_time = get_seconds(); | ||
| 839 | clear_bit(0, &clp->cl_cb_slot_busy); | 849 | clear_bit(0, &clp->cl_cb_slot_busy); |
| 840 | rpc_init_wait_queue(&clp->cl_cb_waitq, "Backchannel slot table"); | 850 | rpc_init_wait_queue(&clp->cl_cb_waitq, "Backchannel slot table"); |
| 841 | copy_verf(clp, verf); | 851 | copy_verf(clp, verf); |
diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h index ee42a0beecfa..cfd743ea4b79 100644 --- a/fs/nfsd/state.h +++ b/fs/nfsd/state.h | |||
| @@ -166,7 +166,7 @@ struct nfsd4_session { | |||
| 166 | struct list_head se_hash; /* hash by sessionid */ | 166 | struct list_head se_hash; /* hash by sessionid */ |
| 167 | struct list_head se_perclnt; | 167 | struct list_head se_perclnt; |
| 168 | u32 se_flags; | 168 | u32 se_flags; |
| 169 | struct nfs4_client *se_client; /* for expire_client */ | 169 | struct nfs4_client *se_client; |
| 170 | struct nfs4_sessionid se_sessionid; | 170 | struct nfs4_sessionid se_sessionid; |
| 171 | struct nfsd4_channel_attrs se_fchannel; | 171 | struct nfsd4_channel_attrs se_fchannel; |
| 172 | struct nfsd4_channel_attrs se_bchannel; | 172 | struct nfsd4_channel_attrs se_bchannel; |
| @@ -244,6 +244,18 @@ struct nfs4_client { | |||
| 244 | /* wait here for slots */ | 244 | /* wait here for slots */ |
| 245 | }; | 245 | }; |
| 246 | 246 | ||
| 247 | static inline void | ||
| 248 | mark_client_expired(struct nfs4_client *clp) | ||
| 249 | { | ||
| 250 | clp->cl_time = 0; | ||
| 251 | } | ||
| 252 | |||
| 253 | static inline bool | ||
| 254 | is_client_expired(struct nfs4_client *clp) | ||
| 255 | { | ||
| 256 | return clp->cl_time == 0; | ||
| 257 | } | ||
| 258 | |||
| 247 | /* struct nfs4_client_reset | 259 | /* struct nfs4_client_reset |
| 248 | * one per old client. Populates reset_str_hashtbl. Filled from conf_id_hashtbl | 260 | * one per old client. Populates reset_str_hashtbl. Filled from conf_id_hashtbl |
| 249 | * upon lease reset, or from upcall to state_daemon (to read in state | 261 | * upon lease reset, or from upcall to state_daemon (to read in state |
