Skip to content

Commit d5850ff

Browse files
Stanislav KinsburskyJ. Bruce Fields
authored andcommitted
Lockd: host complaining function introduced
Just a small cleanup. Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
1 parent caa4e76 commit d5850ff

1 file changed

Lines changed: 30 additions & 27 deletions

File tree

‎fs/lockd/host.c‎

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,35 @@ void nlm_host_rebooted(const struct nlm_reboot *info)
572572
nsm_release(nsm);
573573
}
574574

575+
static void nlm_complain_hosts(struct net *net)
576+
{
577+
struct hlist_head *chain;
578+
struct hlist_node *pos;
579+
struct nlm_host *host;
580+
581+
if (net) {
582+
struct lockd_net *ln = net_generic(net, lockd_net_id);
583+
584+
if (ln->nrhosts == 0)
585+
return;
586+
printk(KERN_WARNING "lockd: couldn't shutdown host module for net %p!\n", net);
587+
dprintk("lockd: %lu hosts left in net %p:\n", ln->nrhosts, net);
588+
} else {
589+
if (nrhosts == 0)
590+
return;
591+
printk(KERN_WARNING "lockd: couldn't shutdown host module!\n");
592+
dprintk("lockd: %lu hosts left:\n", nrhosts);
593+
}
594+
595+
for_each_host(host, pos, chain, nlm_server_hosts) {
596+
if (net && host->net != net)
597+
continue;
598+
dprintk(" %s (cnt %d use %d exp %ld net %p)\n",
599+
host->h_name, atomic_read(&host->h_count),
600+
host->h_inuse, host->h_expires, host->net);
601+
}
602+
}
603+
575604
void
576605
nlm_shutdown_hosts_net(struct net *net)
577606
{
@@ -598,18 +627,7 @@ nlm_shutdown_hosts_net(struct net *net)
598627
nlm_gc_hosts(net);
599628
mutex_unlock(&nlm_host_mutex);
600629

601-
/* complain if any hosts are left */
602-
if (net) {
603-
struct lockd_net *ln = net_generic(net, lockd_net_id);
604-
605-
printk(KERN_WARNING "lockd: couldn't shutdown host module for net %p!\n", net);
606-
dprintk("lockd: %lu hosts left in net %p:\n", ln->nrhosts, net);
607-
for_each_host(host, pos, chain, nlm_server_hosts) {
608-
dprintk(" %s (cnt %d use %d exp %ld net %p)\n",
609-
host->h_name, atomic_read(&host->h_count),
610-
host->h_inuse, host->h_expires, host->net);
611-
}
612-
}
630+
nlm_complain_hosts(net);
613631
}
614632

615633
/*
@@ -619,22 +637,7 @@ nlm_shutdown_hosts_net(struct net *net)
619637
void
620638
nlm_shutdown_hosts(void)
621639
{
622-
struct hlist_head *chain;
623-
struct hlist_node *pos;
624-
struct nlm_host *host;
625-
626640
nlm_shutdown_hosts_net(NULL);
627-
628-
/* complain if any hosts are left */
629-
if (nrhosts != 0) {
630-
printk(KERN_WARNING "lockd: couldn't shutdown host module!\n");
631-
dprintk("lockd: %lu hosts left:\n", nrhosts);
632-
for_each_host(host, pos, chain, nlm_server_hosts) {
633-
dprintk(" %s (cnt %d use %d exp %ld net %p)\n",
634-
host->h_name, atomic_read(&host->h_count),
635-
host->h_inuse, host->h_expires, host->net);
636-
}
637-
}
638641
}
639642

640643
/*

0 commit comments

Comments
 (0)