diff options
author | Stanislav Kinsbursky <skinsbursky@parallels.com> | 2012-11-14 10:21:56 -0500 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2012-11-15 07:40:48 -0500 |
commit | 5ed58bb243484e01e82ffca8451907403168e262 (patch) | |
tree | ebd3a0a966c3cb85be3fd83a920d1f7e836d84a3 /fs | |
parent | 1872de0e8171904612ee85de218fa045bc473cad (diff) |
nfsd: make client_lru list per net
This list holds nfs4 clients queue for lease renewal, which are network
namespace aware. So let's make this list per network namespace too.
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfsd/netns.h | 5 | ||||
-rw-r--r-- | fs/nfsd/nfs4state.c | 16 |
2 files changed, 13 insertions, 8 deletions
diff --git a/fs/nfsd/netns.h b/fs/nfsd/netns.h index da33d3f804b..9a98a0aeee6 100644 --- a/fs/nfsd/netns.h +++ b/fs/nfsd/netns.h | |||
@@ -68,6 +68,11 @@ struct nfsd_net { | |||
68 | struct list_head *ownerstr_hashtbl; | 68 | struct list_head *ownerstr_hashtbl; |
69 | struct list_head *lockowner_ino_hashtbl; | 69 | struct list_head *lockowner_ino_hashtbl; |
70 | struct list_head *sessionid_hashtbl; | 70 | struct list_head *sessionid_hashtbl; |
71 | /* | ||
72 | * client_lru holds client queue ordered by nfs4_client.cl_time | ||
73 | * for lease renewal. | ||
74 | */ | ||
75 | struct list_head client_lru; | ||
71 | }; | 76 | }; |
72 | 77 | ||
73 | extern int nfsd_net_id; | 78 | extern int nfsd_net_id; |
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 248f217a00b..9cf7e9bf369 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -402,15 +402,11 @@ static unsigned int clientstr_hashval(const char *name) | |||
402 | } | 402 | } |
403 | 403 | ||
404 | /* | 404 | /* |
405 | * client_lru holds client queue ordered by nfs4_client.cl_time | ||
406 | * for lease renewal. | ||
407 | * | ||
408 | * close_lru holds (open) stateowner queue ordered by nfs4_stateowner.so_time | 405 | * close_lru holds (open) stateowner queue ordered by nfs4_stateowner.so_time |
409 | * for last close replay. | 406 | * for last close replay. |
410 | * | 407 | * |
411 | * All of the above fields are protected by the client_mutex. | 408 | * All of the above fields are protected by the client_mutex. |
412 | */ | 409 | */ |
413 | static struct list_head client_lru; | ||
414 | static struct list_head close_lru; | 410 | static struct list_head close_lru; |
415 | 411 | ||
416 | /* | 412 | /* |
@@ -995,6 +991,8 @@ unhash_session(struct nfsd4_session *ses) | |||
995 | static inline void | 991 | static inline void |
996 | renew_client_locked(struct nfs4_client *clp) | 992 | renew_client_locked(struct nfs4_client *clp) |
997 | { | 993 | { |
994 | struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id); | ||
995 | |||
998 | if (is_client_expired(clp)) { | 996 | if (is_client_expired(clp)) { |
999 | WARN_ON(1); | 997 | WARN_ON(1); |
1000 | printk("%s: client (clientid %08x/%08x) already expired\n", | 998 | printk("%s: client (clientid %08x/%08x) already expired\n", |
@@ -1007,7 +1005,7 @@ renew_client_locked(struct nfs4_client *clp) | |||
1007 | dprintk("renewing client (clientid %08x/%08x)\n", | 1005 | dprintk("renewing client (clientid %08x/%08x)\n", |
1008 | clp->cl_clientid.cl_boot, | 1006 | clp->cl_clientid.cl_boot, |
1009 | clp->cl_clientid.cl_id); | 1007 | clp->cl_clientid.cl_id); |
1010 | list_move_tail(&clp->cl_lru, &client_lru); | 1008 | list_move_tail(&clp->cl_lru, &nn->client_lru); |
1011 | clp->cl_time = get_seconds(); | 1009 | clp->cl_time = get_seconds(); |
1012 | } | 1010 | } |
1013 | 1011 | ||
@@ -3196,6 +3194,7 @@ nfs4_laundromat(void) | |||
3196 | time_t cutoff = get_seconds() - nfsd4_lease; | 3194 | time_t cutoff = get_seconds() - nfsd4_lease; |
3197 | time_t t, clientid_val = nfsd4_lease; | 3195 | time_t t, clientid_val = nfsd4_lease; |
3198 | time_t u, test_val = nfsd4_lease; | 3196 | time_t u, test_val = nfsd4_lease; |
3197 | struct nfsd_net *nn = net_generic(&init_net, nfsd_net_id); | ||
3199 | 3198 | ||
3200 | nfs4_lock_state(); | 3199 | nfs4_lock_state(); |
3201 | 3200 | ||
@@ -3203,7 +3202,7 @@ nfs4_laundromat(void) | |||
3203 | nfsd4_end_grace(&init_net); | 3202 | nfsd4_end_grace(&init_net); |
3204 | INIT_LIST_HEAD(&reaplist); | 3203 | INIT_LIST_HEAD(&reaplist); |
3205 | spin_lock(&client_lock); | 3204 | spin_lock(&client_lock); |
3206 | list_for_each_safe(pos, next, &client_lru) { | 3205 | list_for_each_safe(pos, next, &nn->client_lru) { |
3207 | clp = list_entry(pos, struct nfs4_client, cl_lru); | 3206 | clp = list_entry(pos, struct nfs4_client, cl_lru); |
3208 | if (time_after((unsigned long)clp->cl_time, (unsigned long)cutoff)) { | 3207 | if (time_after((unsigned long)clp->cl_time, (unsigned long)cutoff)) { |
3209 | t = clp->cl_time - cutoff; | 3208 | t = clp->cl_time - cutoff; |
@@ -4590,9 +4589,10 @@ void nfsd_forget_clients(u64 num) | |||
4590 | { | 4589 | { |
4591 | struct nfs4_client *clp, *next; | 4590 | struct nfs4_client *clp, *next; |
4592 | int count = 0; | 4591 | int count = 0; |
4592 | struct nfsd_net *nn = net_generic(&init_net, nfsd_net_id); | ||
4593 | 4593 | ||
4594 | nfs4_lock_state(); | 4594 | nfs4_lock_state(); |
4595 | list_for_each_entry_safe(clp, next, &client_lru, cl_lru) { | 4595 | list_for_each_entry_safe(clp, next, &nn->client_lru, cl_lru) { |
4596 | expire_client(clp); | 4596 | expire_client(clp); |
4597 | if (++count == num) | 4597 | if (++count == num) |
4598 | break; | 4598 | break; |
@@ -4722,7 +4722,6 @@ nfs4_state_init(void) | |||
4722 | INIT_LIST_HEAD(&file_hashtbl[i]); | 4722 | INIT_LIST_HEAD(&file_hashtbl[i]); |
4723 | } | 4723 | } |
4724 | INIT_LIST_HEAD(&close_lru); | 4724 | INIT_LIST_HEAD(&close_lru); |
4725 | INIT_LIST_HEAD(&client_lru); | ||
4726 | INIT_LIST_HEAD(&del_recall_lru); | 4725 | INIT_LIST_HEAD(&del_recall_lru); |
4727 | } | 4726 | } |
4728 | 4727 | ||
@@ -4785,6 +4784,7 @@ static int nfs4_state_start_net(struct net *net) | |||
4785 | INIT_LIST_HEAD(&nn->sessionid_hashtbl[i]); | 4784 | INIT_LIST_HEAD(&nn->sessionid_hashtbl[i]); |
4786 | nn->conf_name_tree = RB_ROOT; | 4785 | nn->conf_name_tree = RB_ROOT; |
4787 | nn->unconf_name_tree = RB_ROOT; | 4786 | nn->unconf_name_tree = RB_ROOT; |
4787 | INIT_LIST_HEAD(&nn->client_lru); | ||
4788 | 4788 | ||
4789 | return 0; | 4789 | return 0; |
4790 | 4790 | ||