aboutsummaryrefslogtreecommitdiffstats
path: root/fs/lockd
diff options
context:
space:
mode:
authorStanislav Kinsbursky <skinsbursky@parallels.com>2012-07-25 08:55:54 -0400
committerJ. Bruce Fields <bfields@redhat.com>2012-07-27 16:48:43 -0400
commitb26411f85d3763ec5fc553854d9c3c0966072090 (patch)
tree7d8437dee426b9d0000a9e5b2553e0e3fade822f /fs/lockd
parent99dbb8fe0992ecefd061e5efa7604b92eab58ccc (diff)
LockD: mark host per network namespace on garbage collect
This is required for per-network NLM shutdown and cleanup. This patch passes init_net for a while. Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/lockd')
-rw-r--r--fs/lockd/host.c3
-rw-r--r--fs/lockd/svcsubs.c19
2 files changed, 15 insertions, 7 deletions
diff --git a/fs/lockd/host.c b/fs/lockd/host.c
index eb75ca7c2d6e..2c5f41b098e9 100644
--- a/fs/lockd/host.c
+++ b/fs/lockd/host.c
@@ -628,13 +628,14 @@ nlm_gc_hosts(void)
628 struct hlist_head *chain; 628 struct hlist_head *chain;
629 struct hlist_node *pos, *next; 629 struct hlist_node *pos, *next;
630 struct nlm_host *host; 630 struct nlm_host *host;
631 struct net *net = &init_net;
631 632
632 dprintk("lockd: host garbage collection\n"); 633 dprintk("lockd: host garbage collection\n");
633 for_each_host(host, pos, chain, nlm_server_hosts) 634 for_each_host(host, pos, chain, nlm_server_hosts)
634 host->h_inuse = 0; 635 host->h_inuse = 0;
635 636
636 /* Mark all hosts that hold locks, blocks or shares */ 637 /* Mark all hosts that hold locks, blocks or shares */
637 nlmsvc_mark_resources(); 638 nlmsvc_mark_resources(net);
638 639
639 for_each_host_safe(host, pos, next, chain, nlm_server_hosts) { 640 for_each_host_safe(host, pos, next, chain, nlm_server_hosts) {
640 if (atomic_read(&host->h_count) || host->h_inuse 641 if (atomic_read(&host->h_count) || host->h_inuse
diff --git a/fs/lockd/svcsubs.c b/fs/lockd/svcsubs.c
index 2240d384d787..0deb5f6c9dd4 100644
--- a/fs/lockd/svcsubs.c
+++ b/fs/lockd/svcsubs.c
@@ -309,7 +309,8 @@ nlm_release_file(struct nlm_file *file)
309 * Helpers function for resource traversal 309 * Helpers function for resource traversal
310 * 310 *
311 * nlmsvc_mark_host: 311 * nlmsvc_mark_host:
312 * used by the garbage collector; simply sets h_inuse. 312 * used by the garbage collector; simply sets h_inuse only for those
313 * hosts, which passed network check.
313 * Always returns 0. 314 * Always returns 0.
314 * 315 *
315 * nlmsvc_same_host: 316 * nlmsvc_same_host:
@@ -320,12 +321,15 @@ nlm_release_file(struct nlm_file *file)
320 * returns 1 iff the host is a client. 321 * returns 1 iff the host is a client.
321 * Used by nlmsvc_invalidate_all 322 * Used by nlmsvc_invalidate_all
322 */ 323 */
324
323static int 325static int
324nlmsvc_mark_host(void *data, struct nlm_host *dummy) 326nlmsvc_mark_host(void *data, struct nlm_host *hint)
325{ 327{
326 struct nlm_host *host = data; 328 struct nlm_host *host = data;
327 329
328 host->h_inuse = 1; 330 if ((hint->net == NULL) ||
331 (host->net == hint->net))
332 host->h_inuse = 1;
329 return 0; 333 return 0;
330} 334}
331 335
@@ -358,10 +362,13 @@ nlmsvc_is_client(void *data, struct nlm_host *dummy)
358 * Mark all hosts that still hold resources 362 * Mark all hosts that still hold resources
359 */ 363 */
360void 364void
361nlmsvc_mark_resources(void) 365nlmsvc_mark_resources(struct net *net)
362{ 366{
363 dprintk("lockd: nlmsvc_mark_resources\n"); 367 struct nlm_host hint;
364 nlm_traverse_files(NULL, nlmsvc_mark_host, NULL); 368
369 dprintk("lockd: nlmsvc_mark_resources for net %p\n", net);
370 hint.net = net;
371 nlm_traverse_files(&hint, nlmsvc_mark_host, NULL);
365} 372}
366 373
367/* 374/*