summaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfssvc.c
diff options
context:
space:
mode:
authorStanislav Kinsbursky <skinsbursky@parallels.com>2012-12-06 14:23:39 +0300
committerJ. Bruce Fields <bfields@redhat.com>2012-12-10 16:25:41 -0500
commit4539f14981ce02d48b212786a41c8bcfb62851b4 (patch)
treeaa86b4da7bf1a993e2bfba8a41e3512484ac653d /fs/nfsd/nfssvc.c
parent903d9bf0edebc9d9f06df125ab2bd57b4aa4e78e (diff)
downloadlinux-stable-4539f14981ce02d48b212786a41c8bcfb62851b4.tar.gz
linux-stable-4539f14981ce02d48b212786a41c8bcfb62851b4.tar.bz2
linux-stable-4539f14981ce02d48b212786a41c8bcfb62851b4.zip
nfsd: replace boolean nfsd_up flag by users counter
Since we have generic NFSd resurces, we have to introduce some way how to allocate and destroy those resources on first per-net NFSd start and on last per-net NFSd stop respectively. This patch replaces global boolean nfsd_up flag (which is unused now) by users counter and use it to determine either we need to allocate generic resources or destroy them. Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfssvc.c')
-rw-r--r--fs/nfsd/nfssvc.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index 0c87b4e7d1b5..5bb4a33211c7 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -204,13 +204,13 @@ static int nfsd_init_socks(struct net *net)
return 0;
}
-static bool nfsd_up = false;
+static int nfsd_users = 0;
static int nfsd_startup_generic(int nrservs)
{
int ret;
- if (nfsd_up)
+ if (nfsd_users++)
return 0;
/*
@@ -233,9 +233,11 @@ out_racache:
static void nfsd_shutdown_generic(void)
{
+ if (--nfsd_users)
+ return;
+
nfs4_state_shutdown();
nfsd_racache_shutdown();
- nfsd_up = false;
}
static int nfsd_startup_net(int nrservs, struct net *net)
@@ -260,7 +262,6 @@ static int nfsd_startup_net(int nrservs, struct net *net)
goto out_lockd;
nn->nfsd_net_up = true;
- nfsd_up = true;
return 0;
out_lockd: