aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorStanislav Kinsbursky <skinsbursky@parallels.com>2012-11-14 10:22:01 -0500
committerJ. Bruce Fields <bfields@redhat.com>2012-11-15 07:40:49 -0500
commit73758fed711b847d833b9b0db59137eaeed06485 (patch)
tree3941b6db0317eafd62364e6acd0a72901b322a76 /fs
parent5ed58bb243484e01e82ffca8451907403168e262 (diff)
nfsd: make close_lru list per net
This list holds nfs4 clients (open) stateowner queue for last close replay, 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.h6
-rw-r--r--fs/nfsd/nfs4state.c20
2 files changed, 13 insertions, 13 deletions
diff --git a/fs/nfsd/netns.h b/fs/nfsd/netns.h
index 9a98a0aeee6..a356ea3dc68 100644
--- a/fs/nfsd/netns.h
+++ b/fs/nfsd/netns.h
@@ -71,8 +71,14 @@ struct nfsd_net {
71 /* 71 /*
72 * client_lru holds client queue ordered by nfs4_client.cl_time 72 * client_lru holds client queue ordered by nfs4_client.cl_time
73 * for lease renewal. 73 * for lease renewal.
74 *
75 * close_lru holds (open) stateowner queue ordered by nfs4_stateowner.so_time
76 * for last close replay.
77 *
78 * All of the above fields are protected by the client_mutex.
74 */ 79 */
75 struct list_head client_lru; 80 struct list_head client_lru;
81 struct list_head close_lru;
76}; 82};
77 83
78extern int nfsd_net_id; 84extern int nfsd_net_id;
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 9cf7e9bf369..a8e406449ef 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -402,14 +402,6 @@ static unsigned int clientstr_hashval(const char *name)
402} 402}
403 403
404/* 404/*
405 * close_lru holds (open) stateowner queue ordered by nfs4_stateowner.so_time
406 * for last close replay.
407 *
408 * All of the above fields are protected by the client_mutex.
409 */
410static struct list_head close_lru;
411
412/*
413 * We store the NONE, READ, WRITE, and BOTH bits separately in the 405 * We store the NONE, READ, WRITE, and BOTH bits separately in the
414 * st_{access,deny}_bmap field of the stateid, in order to track not 406 * st_{access,deny}_bmap field of the stateid, in order to track not
415 * only what share bits are currently in force, but also what 407 * only what share bits are currently in force, but also what
@@ -2465,11 +2457,13 @@ static void init_open_stateid(struct nfs4_ol_stateid *stp, struct nfs4_file *fp,
2465} 2457}
2466 2458
2467static void 2459static void
2468move_to_close_lru(struct nfs4_openowner *oo) 2460move_to_close_lru(struct nfs4_openowner *oo, struct net *net)
2469{ 2461{
2462 struct nfsd_net *nn = net_generic(net, nfsd_net_id);
2463
2470 dprintk("NFSD: move_to_close_lru nfs4_openowner %p\n", oo); 2464 dprintk("NFSD: move_to_close_lru nfs4_openowner %p\n", oo);
2471 2465
2472 list_move_tail(&oo->oo_close_lru, &close_lru); 2466 list_move_tail(&oo->oo_close_lru, &nn->close_lru);
2473 oo->oo_time = get_seconds(); 2467 oo->oo_time = get_seconds();
2474} 2468}
2475 2469
@@ -3242,7 +3236,7 @@ nfs4_laundromat(void)
3242 unhash_delegation(dp); 3236 unhash_delegation(dp);
3243 } 3237 }
3244 test_val = nfsd4_lease; 3238 test_val = nfsd4_lease;
3245 list_for_each_safe(pos, next, &close_lru) { 3239 list_for_each_safe(pos, next, &nn->close_lru) {
3246 oo = container_of(pos, struct nfs4_openowner, oo_close_lru); 3240 oo = container_of(pos, struct nfs4_openowner, oo_close_lru);
3247 if (time_after((unsigned long)oo->oo_time, (unsigned long)cutoff)) { 3241 if (time_after((unsigned long)oo->oo_time, (unsigned long)cutoff)) {
3248 u = oo->oo_time - cutoff; 3242 u = oo->oo_time - cutoff;
@@ -3820,7 +3814,7 @@ nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
3820 * little while to handle CLOSE replay. 3814 * little while to handle CLOSE replay.
3821 */ 3815 */
3822 if (list_empty(&oo->oo_owner.so_stateids)) 3816 if (list_empty(&oo->oo_owner.so_stateids))
3823 move_to_close_lru(oo); 3817 move_to_close_lru(oo, SVC_NET(rqstp));
3824 } 3818 }
3825 } 3819 }
3826out: 3820out:
@@ -4721,7 +4715,6 @@ nfs4_state_init(void)
4721 for (i = 0; i < FILE_HASH_SIZE; i++) { 4715 for (i = 0; i < FILE_HASH_SIZE; i++) {
4722 INIT_LIST_HEAD(&file_hashtbl[i]); 4716 INIT_LIST_HEAD(&file_hashtbl[i]);
4723 } 4717 }
4724 INIT_LIST_HEAD(&close_lru);
4725 INIT_LIST_HEAD(&del_recall_lru); 4718 INIT_LIST_HEAD(&del_recall_lru);
4726} 4719}
4727 4720
@@ -4785,6 +4778,7 @@ static int nfs4_state_start_net(struct net *net)
4785 nn->conf_name_tree = RB_ROOT; 4778 nn->conf_name_tree = RB_ROOT;
4786 nn->unconf_name_tree = RB_ROOT; 4779 nn->unconf_name_tree = RB_ROOT;
4787 INIT_LIST_HEAD(&nn->client_lru); 4780 INIT_LIST_HEAD(&nn->client_lru);
4781 INIT_LIST_HEAD(&nn->close_lru);
4788 4782
4789 return 0; 4783 return 0;
4790 4784