forked from luck/tmp_suning_uos_patched
[PATCH] knfsd: lockd: Add nlm_destroy_host
This patch moves the host destruction code out of nlm_host_gc into a function of its own. Signed-off-by: Olaf Kirch <okir@suse.de> Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
f2af793db0
commit
c53c1bb94f
|
@ -164,6 +164,34 @@ nlm_lookup_host(int server, const struct sockaddr_in *sin,
|
||||||
return host;
|
return host;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Destroy a host
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
nlm_destroy_host(struct nlm_host *host)
|
||||||
|
{
|
||||||
|
struct rpc_clnt *clnt;
|
||||||
|
|
||||||
|
BUG_ON(!list_empty(&host->h_lockowners));
|
||||||
|
BUG_ON(atomic_read(&host->h_count));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Release NSM handle and unmonitor host.
|
||||||
|
*/
|
||||||
|
nsm_unmonitor(host);
|
||||||
|
|
||||||
|
if ((clnt = host->h_rpcclnt) != NULL) {
|
||||||
|
if (atomic_read(&clnt->cl_users)) {
|
||||||
|
printk(KERN_WARNING
|
||||||
|
"lockd: active RPC handle\n");
|
||||||
|
clnt->cl_dead = 1;
|
||||||
|
} else {
|
||||||
|
rpc_destroy_client(host->h_rpcclnt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
kfree(host);
|
||||||
|
}
|
||||||
|
|
||||||
struct nlm_host *
|
struct nlm_host *
|
||||||
nlm_find_client(void)
|
nlm_find_client(void)
|
||||||
{
|
{
|
||||||
|
@ -400,7 +428,6 @@ nlm_gc_hosts(void)
|
||||||
struct hlist_head *chain;
|
struct hlist_head *chain;
|
||||||
struct hlist_node *pos, *next;
|
struct hlist_node *pos, *next;
|
||||||
struct nlm_host *host;
|
struct nlm_host *host;
|
||||||
struct rpc_clnt *clnt;
|
|
||||||
|
|
||||||
dprintk("lockd: host garbage collection\n");
|
dprintk("lockd: host garbage collection\n");
|
||||||
for (chain = nlm_hosts; chain < nlm_hosts + NLM_HOST_NRHASH; ++chain) {
|
for (chain = nlm_hosts; chain < nlm_hosts + NLM_HOST_NRHASH; ++chain) {
|
||||||
|
@ -423,21 +450,7 @@ nlm_gc_hosts(void)
|
||||||
dprintk("lockd: delete host %s\n", host->h_name);
|
dprintk("lockd: delete host %s\n", host->h_name);
|
||||||
hlist_del_init(&host->h_hash);
|
hlist_del_init(&host->h_hash);
|
||||||
|
|
||||||
/*
|
nlm_destroy_host(host);
|
||||||
* Unmonitor unless host was invalidated (i.e. lockd restarted)
|
|
||||||
*/
|
|
||||||
nsm_unmonitor(host);
|
|
||||||
|
|
||||||
if ((clnt = host->h_rpcclnt) != NULL) {
|
|
||||||
if (atomic_read(&clnt->cl_users)) {
|
|
||||||
printk(KERN_WARNING
|
|
||||||
"lockd: active RPC handle\n");
|
|
||||||
clnt->cl_dead = 1;
|
|
||||||
} else {
|
|
||||||
rpc_destroy_client(host->h_rpcclnt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
kfree(host);
|
|
||||||
nrhosts--;
|
nrhosts--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user