aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2013-03-21 15:19:33 -0400
committerJ. Bruce Fields <bfields@redhat.com>2013-04-04 13:25:16 -0400
commite8c69d17d1ef8437aee729322db005573a467fd6 (patch)
treed6266a01818dfd0038337fab3253912e1d140405 /fs/nfsd
parent68a3396178e6688ad7367202cdf0af8ed03c8727 (diff)
nfsd4: make del_recall_lru per-network-namespace
If nothing else this simplifies the nfs4_state_shutdown_net logic a tad. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/netns.h1
-rw-r--r--fs/nfsd/nfs4state.c15
2 files changed, 8 insertions, 8 deletions
diff --git a/fs/nfsd/netns.h b/fs/nfsd/netns.h
index 1051bebff1b0..849a7c3ced22 100644
--- a/fs/nfsd/netns.h
+++ b/fs/nfsd/netns.h
@@ -80,6 +80,7 @@ struct nfsd_net {
80 */ 80 */
81 struct list_head client_lru; 81 struct list_head client_lru;
82 struct list_head close_lru; 82 struct list_head close_lru;
83 struct list_head del_recall_lru;
83 84
84 struct delayed_work laundromat_work; 85 struct delayed_work laundromat_work;
85 86
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 26a03fa6840a..aae93045ce6b 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -225,8 +225,6 @@ opaque_hashval(const void *ptr, int nbytes)
225 return x; 225 return x;
226} 226}
227 227
228static struct list_head del_recall_lru;
229
230static void nfsd4_free_file(struct nfs4_file *f) 228static void nfsd4_free_file(struct nfs4_file *f)
231{ 229{
232 kmem_cache_free(file_slab, f); 230 kmem_cache_free(file_slab, f);
@@ -2583,6 +2581,9 @@ out:
2583 2581
2584static void nfsd_break_one_deleg(struct nfs4_delegation *dp) 2582static void nfsd_break_one_deleg(struct nfs4_delegation *dp)
2585{ 2583{
2584 struct nfs4_client *clp = dp->dl_stid.sc_client;
2585 struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id);
2586
2586 /* We're assuming the state code never drops its reference 2587 /* We're assuming the state code never drops its reference
2587 * without first removing the lease. Since we're in this lease 2588 * without first removing the lease. Since we're in this lease
2588 * callback (and since the lease code is serialized by the kernel 2589 * callback (and since the lease code is serialized by the kernel
@@ -2590,7 +2591,7 @@ static void nfsd_break_one_deleg(struct nfs4_delegation *dp)
2590 * it's safe to take a reference: */ 2591 * it's safe to take a reference: */
2591 atomic_inc(&dp->dl_count); 2592 atomic_inc(&dp->dl_count);
2592 2593
2593 list_add_tail(&dp->dl_recall_lru, &del_recall_lru); 2594 list_add_tail(&dp->dl_recall_lru, &nn->del_recall_lru);
2594 2595
2595 /* only place dl_time is set. protected by lock_flocks*/ 2596 /* only place dl_time is set. protected by lock_flocks*/
2596 dp->dl_time = get_seconds(); 2597 dp->dl_time = get_seconds();
@@ -3254,7 +3255,7 @@ nfs4_laundromat(struct nfsd_net *nn)
3254 expire_client(clp); 3255 expire_client(clp);
3255 } 3256 }
3256 spin_lock(&recall_lock); 3257 spin_lock(&recall_lock);
3257 list_for_each_safe(pos, next, &del_recall_lru) { 3258 list_for_each_safe(pos, next, &nn->del_recall_lru) {
3258 dp = list_entry (pos, struct nfs4_delegation, dl_recall_lru); 3259 dp = list_entry (pos, struct nfs4_delegation, dl_recall_lru);
3259 if (net_generic(dp->dl_stid.sc_client->net, nfsd_net_id) != nn) 3260 if (net_generic(dp->dl_stid.sc_client->net, nfsd_net_id) != nn)
3260 continue; 3261 continue;
@@ -4810,7 +4811,6 @@ struct nfs4_client *nfsd_find_client(struct sockaddr_storage *addr, size_t addr_
4810void 4811void
4811nfs4_state_init(void) 4812nfs4_state_init(void)
4812{ 4813{
4813 INIT_LIST_HEAD(&del_recall_lru);
4814} 4814}
4815 4815
4816/* 4816/*
@@ -4874,6 +4874,7 @@ static int nfs4_state_create_net(struct net *net)
4874 nn->unconf_name_tree = RB_ROOT; 4874 nn->unconf_name_tree = RB_ROOT;
4875 INIT_LIST_HEAD(&nn->client_lru); 4875 INIT_LIST_HEAD(&nn->client_lru);
4876 INIT_LIST_HEAD(&nn->close_lru); 4876 INIT_LIST_HEAD(&nn->close_lru);
4877 INIT_LIST_HEAD(&nn->del_recall_lru);
4877 spin_lock_init(&nn->client_lock); 4878 spin_lock_init(&nn->client_lock);
4878 4879
4879 INIT_DELAYED_WORK(&nn->laundromat_work, laundromat_main); 4880 INIT_DELAYED_WORK(&nn->laundromat_work, laundromat_main);
@@ -4986,10 +4987,8 @@ nfs4_state_shutdown_net(struct net *net)
4986 4987
4987 INIT_LIST_HEAD(&reaplist); 4988 INIT_LIST_HEAD(&reaplist);
4988 spin_lock(&recall_lock); 4989 spin_lock(&recall_lock);
4989 list_for_each_safe(pos, next, &del_recall_lru) { 4990 list_for_each_safe(pos, next, &nn->del_recall_lru) {
4990 dp = list_entry (pos, struct nfs4_delegation, dl_recall_lru); 4991 dp = list_entry (pos, struct nfs4_delegation, dl_recall_lru);
4991 if (dp->dl_stid.sc_client->net != net)
4992 continue;
4993 list_move(&dp->dl_recall_lru, &reaplist); 4992 list_move(&dp->dl_recall_lru, &reaplist);
4994 } 4993 }
4995 spin_unlock(&recall_lock); 4994 spin_unlock(&recall_lock);