diff options
author | Vasily Averin <vvs@virtuozzo.com> | 2017-11-08 00:55:55 -0500 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2017-11-27 16:45:10 -0500 |
commit | e919b0765287f36f7e9c84aed785eddfbbd98dfa (patch) | |
tree | 9b4c959282bbf3d3a2d56eb7ee6daea682d66bf3 | |
parent | ba589528d6a251721a245fad07c0e3090fc9d6f5 (diff) |
lockd: remove net pointer from messages
Publishing of net pointer is not safe,
use net->ns.inum as net ID in debug messages
[ 171.757678] lockd_up_net: per-net data created; net=f00001e7
[ 171.767188] NFSD: starting 90-second grace period (net f00001e7)
[ 300.653313] lockd: nuking all hosts in net f00001e7...
[ 300.653641] lockd: host garbage collection for net f00001e7
[ 300.653968] lockd: nlmsvc_mark_resources for net f00001e7
[ 300.711483] lockd_down_net: per-net data destroyed; net=f00001e7
[ 300.711847] lockd: nuking all hosts in net 0...
[ 300.711847] lockd: host garbage collection for net 0
[ 300.711848] lockd: nlmsvc_mark_resources for net 0
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
-rw-r--r-- | fs/lockd/host.c | 21 | ||||
-rw-r--r-- | fs/lockd/mon.c | 3 | ||||
-rw-r--r-- | fs/lockd/svc.c | 9 | ||||
-rw-r--r-- | fs/lockd/svcsubs.c | 2 |
4 files changed, 21 insertions, 14 deletions
diff --git a/fs/lockd/host.c b/fs/lockd/host.c index 0d4e590e0549..f90f6d5082ef 100644 --- a/fs/lockd/host.c +++ b/fs/lockd/host.c | |||
@@ -578,8 +578,10 @@ static void nlm_complain_hosts(struct net *net) | |||
578 | 578 | ||
579 | if (ln->nrhosts == 0) | 579 | if (ln->nrhosts == 0) |
580 | return; | 580 | return; |
581 | printk(KERN_WARNING "lockd: couldn't shutdown host module for net %p!\n", net); | 581 | pr_warn("lockd: couldn't shutdown host module for net %x!\n", |
582 | dprintk("lockd: %lu hosts left in net %p:\n", ln->nrhosts, net); | 582 | net->ns.inum); |
583 | dprintk("lockd: %lu hosts left in net %x:\n", ln->nrhosts, | ||
584 | net->ns.inum); | ||
583 | } else { | 585 | } else { |
584 | if (nrhosts == 0) | 586 | if (nrhosts == 0) |
585 | return; | 587 | return; |
@@ -590,9 +592,9 @@ static void nlm_complain_hosts(struct net *net) | |||
590 | for_each_host(host, chain, nlm_server_hosts) { | 592 | for_each_host(host, chain, nlm_server_hosts) { |
591 | if (net && host->net != net) | 593 | if (net && host->net != net) |
592 | continue; | 594 | continue; |
593 | dprintk(" %s (cnt %d use %d exp %ld net %p)\n", | 595 | dprintk(" %s (cnt %d use %d exp %ld net %x)\n", |
594 | host->h_name, atomic_read(&host->h_count), | 596 | host->h_name, atomic_read(&host->h_count), |
595 | host->h_inuse, host->h_expires, host->net); | 597 | host->h_inuse, host->h_expires, host->net->ns.inum); |
596 | } | 598 | } |
597 | } | 599 | } |
598 | 600 | ||
@@ -605,7 +607,8 @@ nlm_shutdown_hosts_net(struct net *net) | |||
605 | mutex_lock(&nlm_host_mutex); | 607 | mutex_lock(&nlm_host_mutex); |
606 | 608 | ||
607 | /* First, make all hosts eligible for gc */ | 609 | /* First, make all hosts eligible for gc */ |
608 | dprintk("lockd: nuking all hosts in net %p...\n", net); | 610 | dprintk("lockd: nuking all hosts in net %x...\n", |
611 | net ? net->ns.inum : 0); | ||
609 | for_each_host(host, chain, nlm_server_hosts) { | 612 | for_each_host(host, chain, nlm_server_hosts) { |
610 | if (net && host->net != net) | 613 | if (net && host->net != net) |
611 | continue; | 614 | continue; |
@@ -646,7 +649,8 @@ nlm_gc_hosts(struct net *net) | |||
646 | struct hlist_node *next; | 649 | struct hlist_node *next; |
647 | struct nlm_host *host; | 650 | struct nlm_host *host; |
648 | 651 | ||
649 | dprintk("lockd: host garbage collection for net %p\n", net); | 652 | dprintk("lockd: host garbage collection for net %x\n", |
653 | net ? net->ns.inum : 0); | ||
650 | for_each_host(host, chain, nlm_server_hosts) { | 654 | for_each_host(host, chain, nlm_server_hosts) { |
651 | if (net && host->net != net) | 655 | if (net && host->net != net) |
652 | continue; | 656 | continue; |
@@ -662,9 +666,10 @@ nlm_gc_hosts(struct net *net) | |||
662 | if (atomic_read(&host->h_count) || host->h_inuse | 666 | if (atomic_read(&host->h_count) || host->h_inuse |
663 | || time_before(jiffies, host->h_expires)) { | 667 | || time_before(jiffies, host->h_expires)) { |
664 | dprintk("nlm_gc_hosts skipping %s " | 668 | dprintk("nlm_gc_hosts skipping %s " |
665 | "(cnt %d use %d exp %ld net %p)\n", | 669 | "(cnt %d use %d exp %ld net %x)\n", |
666 | host->h_name, atomic_read(&host->h_count), | 670 | host->h_name, atomic_read(&host->h_count), |
667 | host->h_inuse, host->h_expires, host->net); | 671 | host->h_inuse, host->h_expires, |
672 | host->net->ns.inum); | ||
668 | continue; | 673 | continue; |
669 | } | 674 | } |
670 | nlm_destroy_host_locked(host); | 675 | nlm_destroy_host_locked(host); |
diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c index 9fbbd11f9ecb..96cfb2967ac7 100644 --- a/fs/lockd/mon.c +++ b/fs/lockd/mon.c | |||
@@ -110,7 +110,8 @@ static int nsm_mon_unmon(struct nsm_handle *nsm, u32 proc, struct nsm_res *res, | |||
110 | clnt = nsm_create(host->net, host->nodename); | 110 | clnt = nsm_create(host->net, host->nodename); |
111 | if (IS_ERR(clnt)) { | 111 | if (IS_ERR(clnt)) { |
112 | dprintk("lockd: failed to create NSM upcall transport, " | 112 | dprintk("lockd: failed to create NSM upcall transport, " |
113 | "status=%ld, net=%p\n", PTR_ERR(clnt), host->net); | 113 | "status=%ld, net=%x\n", PTR_ERR(clnt), |
114 | host->net->ns.inum); | ||
114 | return PTR_ERR(clnt); | 115 | return PTR_ERR(clnt); |
115 | } | 116 | } |
116 | 117 | ||
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c index a8e3777c94dc..e28796bd7375 100644 --- a/fs/lockd/svc.c +++ b/fs/lockd/svc.c | |||
@@ -259,7 +259,7 @@ static int lockd_up_net(struct svc_serv *serv, struct net *net) | |||
259 | if (error < 0) | 259 | if (error < 0) |
260 | goto err_bind; | 260 | goto err_bind; |
261 | set_grace_period(net); | 261 | set_grace_period(net); |
262 | dprintk("lockd_up_net: per-net data created; net=%p\n", net); | 262 | dprintk("%s: per-net data created; net=%x\n", __func__, net->ns.inum); |
263 | return 0; | 263 | return 0; |
264 | 264 | ||
265 | err_bind: | 265 | err_bind: |
@@ -275,11 +275,12 @@ static void lockd_down_net(struct svc_serv *serv, struct net *net) | |||
275 | if (--ln->nlmsvc_users == 0) { | 275 | if (--ln->nlmsvc_users == 0) { |
276 | nlm_shutdown_hosts_net(net); | 276 | nlm_shutdown_hosts_net(net); |
277 | svc_shutdown_net(serv, net); | 277 | svc_shutdown_net(serv, net); |
278 | dprintk("lockd_down_net: per-net data destroyed; net=%p\n", net); | 278 | dprintk("%s: per-net data destroyed; net=%x\n", |
279 | __func__, net->ns.inum); | ||
279 | } | 280 | } |
280 | } else { | 281 | } else { |
281 | printk(KERN_ERR "lockd_down_net: no users! task=%p, net=%p\n", | 282 | pr_err("%s: no users! task=%p, net=%x\n", |
282 | nlmsvc_task, net); | 283 | __func__, nlmsvc_task, net->ns.inum); |
283 | BUG(); | 284 | BUG(); |
284 | } | 285 | } |
285 | } | 286 | } |
diff --git a/fs/lockd/svcsubs.c b/fs/lockd/svcsubs.c index a563ddbc19e6..4ec3d6e03e76 100644 --- a/fs/lockd/svcsubs.c +++ b/fs/lockd/svcsubs.c | |||
@@ -370,7 +370,7 @@ nlmsvc_mark_resources(struct net *net) | |||
370 | { | 370 | { |
371 | struct nlm_host hint; | 371 | struct nlm_host hint; |
372 | 372 | ||
373 | dprintk("lockd: nlmsvc_mark_resources for net %p\n", net); | 373 | dprintk("lockd: %s for net %x\n", __func__, net ? net->ns.inum : 0); |
374 | hint.net = net; | 374 | hint.net = net; |
375 | nlm_traverse_files(&hint, nlmsvc_mark_host, NULL); | 375 | nlm_traverse_files(&hint, nlmsvc_mark_host, NULL); |
376 | } | 376 | } |