diff options
-rw-r--r-- | fs/nfsd/netns.h | 4 | ||||
-rw-r--r-- | fs/nfsd/nfs4state.c | 42 |
2 files changed, 23 insertions, 23 deletions
diff --git a/fs/nfsd/netns.h b/fs/nfsd/netns.h index 1ff781f9c3d0..1e76030e1d16 100644 --- a/fs/nfsd/netns.h +++ b/fs/nfsd/netns.h | |||
@@ -50,12 +50,16 @@ struct nfsd_net { | |||
50 | * | 50 | * |
51 | * conf_id_hashtbl[], and conf_name_tree hold confirmed | 51 | * conf_id_hashtbl[], and conf_name_tree hold confirmed |
52 | * setclientid_confirmed info. | 52 | * setclientid_confirmed info. |
53 | * | ||
54 | * unconf_str_hastbl[] and unconf_name_tree hold unconfirmed | ||
55 | * setclientid info. | ||
53 | */ | 56 | */ |
54 | struct list_head *reclaim_str_hashtbl; | 57 | struct list_head *reclaim_str_hashtbl; |
55 | int reclaim_str_hashtbl_size; | 58 | int reclaim_str_hashtbl_size; |
56 | struct list_head *conf_id_hashtbl; | 59 | struct list_head *conf_id_hashtbl; |
57 | struct rb_root conf_name_tree; | 60 | struct rb_root conf_name_tree; |
58 | struct list_head *unconf_id_hashtbl; | 61 | struct list_head *unconf_id_hashtbl; |
62 | struct rb_root unconf_name_tree; | ||
59 | }; | 63 | }; |
60 | 64 | ||
61 | extern int nfsd_net_id; | 65 | extern int nfsd_net_id; |
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index f33bbfbdc24f..b35329199e35 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -404,9 +404,6 @@ static unsigned int clientstr_hashval(const char *name) | |||
404 | } | 404 | } |
405 | 405 | ||
406 | /* | 406 | /* |
407 | * unconf_id_hashtbl[] and unconf_name_tree hold unconfirmed | ||
408 | * setclientid info. | ||
409 | * | ||
410 | * client_lru holds client queue ordered by nfs4_client.cl_time | 407 | * client_lru holds client queue ordered by nfs4_client.cl_time |
411 | * for lease renewal. | 408 | * for lease renewal. |
412 | * | 409 | * |
@@ -415,7 +412,6 @@ static unsigned int clientstr_hashval(const char *name) | |||
415 | * | 412 | * |
416 | * All of the above fields are protected by the client_mutex. | 413 | * All of the above fields are protected by the client_mutex. |
417 | */ | 414 | */ |
418 | static struct rb_root unconf_name_tree; | ||
419 | static struct list_head client_lru; | 415 | static struct list_head client_lru; |
420 | static struct list_head close_lru; | 416 | static struct list_head close_lru; |
421 | 417 | ||
@@ -1134,7 +1130,7 @@ destroy_client(struct nfs4_client *clp) | |||
1134 | if (test_bit(NFSD4_CLIENT_CONFIRMED, &clp->cl_flags)) | 1130 | if (test_bit(NFSD4_CLIENT_CONFIRMED, &clp->cl_flags)) |
1135 | rb_erase(&clp->cl_namenode, &nn->conf_name_tree); | 1131 | rb_erase(&clp->cl_namenode, &nn->conf_name_tree); |
1136 | else | 1132 | else |
1137 | rb_erase(&clp->cl_namenode, &unconf_name_tree); | 1133 | rb_erase(&clp->cl_namenode, &nn->unconf_name_tree); |
1138 | spin_lock(&client_lock); | 1134 | spin_lock(&client_lock); |
1139 | unhash_client_locked(clp); | 1135 | unhash_client_locked(clp); |
1140 | if (atomic_read(&clp->cl_refcount) == 0) | 1136 | if (atomic_read(&clp->cl_refcount) == 0) |
@@ -1371,7 +1367,7 @@ add_to_unconfirmed(struct nfs4_client *clp) | |||
1371 | struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id); | 1367 | struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id); |
1372 | 1368 | ||
1373 | clear_bit(NFSD4_CLIENT_CONFIRMED, &clp->cl_flags); | 1369 | clear_bit(NFSD4_CLIENT_CONFIRMED, &clp->cl_flags); |
1374 | add_clp_to_name_tree(clp, &unconf_name_tree); | 1370 | add_clp_to_name_tree(clp, &nn->unconf_name_tree); |
1375 | idhashval = clientid_hashval(clp->cl_clientid.cl_id); | 1371 | idhashval = clientid_hashval(clp->cl_clientid.cl_id); |
1376 | list_add(&clp->cl_idhash, &nn->unconf_id_hashtbl[idhashval]); | 1372 | list_add(&clp->cl_idhash, &nn->unconf_id_hashtbl[idhashval]); |
1377 | renew_client(clp); | 1373 | renew_client(clp); |
@@ -1385,7 +1381,7 @@ move_to_confirmed(struct nfs4_client *clp) | |||
1385 | 1381 | ||
1386 | dprintk("NFSD: move_to_confirm nfs4_client %p\n", clp); | 1382 | dprintk("NFSD: move_to_confirm nfs4_client %p\n", clp); |
1387 | list_move(&clp->cl_idhash, &nn->conf_id_hashtbl[idhashval]); | 1383 | list_move(&clp->cl_idhash, &nn->conf_id_hashtbl[idhashval]); |
1388 | rb_erase(&clp->cl_namenode, &unconf_name_tree); | 1384 | rb_erase(&clp->cl_namenode, &nn->unconf_name_tree); |
1389 | add_clp_to_name_tree(clp, &nn->conf_name_tree); | 1385 | add_clp_to_name_tree(clp, &nn->conf_name_tree); |
1390 | set_bit(NFSD4_CLIENT_CONFIRMED, &clp->cl_flags); | 1386 | set_bit(NFSD4_CLIENT_CONFIRMED, &clp->cl_flags); |
1391 | renew_client(clp); | 1387 | renew_client(clp); |
@@ -1436,9 +1432,9 @@ find_confirmed_client_by_name(struct xdr_netobj *name, struct nfsd_net *nn) | |||
1436 | } | 1432 | } |
1437 | 1433 | ||
1438 | static struct nfs4_client * | 1434 | static struct nfs4_client * |
1439 | find_unconfirmed_client_by_name(struct xdr_netobj *name) | 1435 | find_unconfirmed_client_by_name(struct xdr_netobj *name, struct nfsd_net *nn) |
1440 | { | 1436 | { |
1441 | return find_clp_in_name_tree(name, &unconf_name_tree); | 1437 | return find_clp_in_name_tree(name, &nn->unconf_name_tree); |
1442 | } | 1438 | } |
1443 | 1439 | ||
1444 | static void | 1440 | static void |
@@ -1677,7 +1673,7 @@ nfsd4_exchange_id(struct svc_rqst *rqstp, | |||
1677 | goto out; | 1673 | goto out; |
1678 | } | 1674 | } |
1679 | 1675 | ||
1680 | unconf = find_unconfirmed_client_by_name(&exid->clname); | 1676 | unconf = find_unconfirmed_client_by_name(&exid->clname, nn); |
1681 | if (unconf) /* case 4, possible retry or client restart */ | 1677 | if (unconf) /* case 4, possible retry or client restart */ |
1682 | expire_client(unconf); | 1678 | expire_client(unconf); |
1683 | 1679 | ||
@@ -2239,7 +2235,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
2239 | goto out; | 2235 | goto out; |
2240 | } | 2236 | } |
2241 | } | 2237 | } |
2242 | unconf = find_unconfirmed_client_by_name(&clname); | 2238 | unconf = find_unconfirmed_client_by_name(&clname, nn); |
2243 | if (unconf) | 2239 | if (unconf) |
2244 | expire_client(unconf); | 2240 | expire_client(unconf); |
2245 | status = nfserr_jukebox; | 2241 | status = nfserr_jukebox; |
@@ -4720,7 +4716,6 @@ nfs4_state_init(void) | |||
4720 | { | 4716 | { |
4721 | int i; | 4717 | int i; |
4722 | 4718 | ||
4723 | unconf_name_tree = RB_ROOT; | ||
4724 | for (i = 0; i < SESSION_HASH_SIZE; i++) | 4719 | for (i = 0; i < SESSION_HASH_SIZE; i++) |
4725 | INIT_LIST_HEAD(&sessionid_hashtbl[i]); | 4720 | INIT_LIST_HEAD(&sessionid_hashtbl[i]); |
4726 | for (i = 0; i < FILE_HASH_SIZE; i++) { | 4721 | for (i = 0; i < FILE_HASH_SIZE; i++) { |
@@ -4776,6 +4771,7 @@ static int nfs4_state_start_net(struct net *net) | |||
4776 | INIT_LIST_HEAD(&nn->unconf_id_hashtbl[i]); | 4771 | INIT_LIST_HEAD(&nn->unconf_id_hashtbl[i]); |
4777 | } | 4772 | } |
4778 | nn->conf_name_tree = RB_ROOT; | 4773 | nn->conf_name_tree = RB_ROOT; |
4774 | nn->unconf_name_tree = RB_ROOT; | ||
4779 | 4775 | ||
4780 | return 0; | 4776 | return 0; |
4781 | 4777 | ||
@@ -4791,6 +4787,7 @@ __nfs4_state_shutdown_net(struct net *net) | |||
4791 | int i; | 4787 | int i; |
4792 | struct nfs4_client *clp = NULL; | 4788 | struct nfs4_client *clp = NULL; |
4793 | struct nfsd_net *nn = net_generic(net, nfsd_net_id); | 4789 | struct nfsd_net *nn = net_generic(net, nfsd_net_id); |
4790 | struct rb_node *node, *tmp; | ||
4794 | 4791 | ||
4795 | for (i = 0; i < CLIENT_HASH_SIZE; i++) { | 4792 | for (i = 0; i < CLIENT_HASH_SIZE; i++) { |
4796 | while (!list_empty(&nn->conf_id_hashtbl[i])) { | 4793 | while (!list_empty(&nn->conf_id_hashtbl[i])) { |
@@ -4798,6 +4795,16 @@ __nfs4_state_shutdown_net(struct net *net) | |||
4798 | destroy_client(clp); | 4795 | destroy_client(clp); |
4799 | } | 4796 | } |
4800 | } | 4797 | } |
4798 | |||
4799 | node = rb_first(&nn->unconf_name_tree); | ||
4800 | while (node != NULL) { | ||
4801 | tmp = node; | ||
4802 | node = rb_next(tmp); | ||
4803 | clp = rb_entry(tmp, struct nfs4_client, cl_namenode); | ||
4804 | rb_erase(tmp, &nn->unconf_name_tree); | ||
4805 | destroy_client(clp); | ||
4806 | } | ||
4807 | |||
4801 | kfree(nn->unconf_id_hashtbl); | 4808 | kfree(nn->unconf_id_hashtbl); |
4802 | kfree(nn->conf_id_hashtbl); | 4809 | kfree(nn->conf_id_hashtbl); |
4803 | } | 4810 | } |
@@ -4857,22 +4864,11 @@ out_recovery: | |||
4857 | static void | 4864 | static void |
4858 | __nfs4_state_shutdown(struct net *net) | 4865 | __nfs4_state_shutdown(struct net *net) |
4859 | { | 4866 | { |
4860 | struct nfs4_client *clp = NULL; | ||
4861 | struct nfs4_delegation *dp = NULL; | 4867 | struct nfs4_delegation *dp = NULL; |
4862 | struct list_head *pos, *next, reaplist; | 4868 | struct list_head *pos, *next, reaplist; |
4863 | struct rb_node *node, *tmp; | ||
4864 | 4869 | ||
4865 | __nfs4_state_shutdown_net(net); | 4870 | __nfs4_state_shutdown_net(net); |
4866 | 4871 | ||
4867 | node = rb_first(&unconf_name_tree); | ||
4868 | while (node != NULL) { | ||
4869 | tmp = node; | ||
4870 | node = rb_next(tmp); | ||
4871 | clp = rb_entry(tmp, struct nfs4_client, cl_namenode); | ||
4872 | rb_erase(tmp, &unconf_name_tree); | ||
4873 | destroy_client(clp); | ||
4874 | } | ||
4875 | |||
4876 | INIT_LIST_HEAD(&reaplist); | 4872 | INIT_LIST_HEAD(&reaplist); |
4877 | spin_lock(&recall_lock); | 4873 | spin_lock(&recall_lock); |
4878 | list_for_each_safe(pos, next, &del_recall_lru) { | 4874 | list_for_each_safe(pos, next, &del_recall_lru) { |