summaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfssvc.c
diff options
context:
space:
mode:
authorStanislav Kinsbursky <skinsbursky@parallels.com>2012-12-06 14:23:09 +0300
committerJ. Bruce Fields <bfields@redhat.com>2012-12-10 16:25:36 -0500
commit6ff50b3dea9a242b50642a703b513986bffb8ce9 (patch)
tree04c9a7bc28f512ee92e1821a7375432423cbf002 /fs/nfsd/nfssvc.c
parent081603520b25f7b35ef63a363376a17c36ef74ed (diff)
downloadop-kernel-dev-6ff50b3dea9a242b50642a703b513986bffb8ce9.zip
op-kernel-dev-6ff50b3dea9a242b50642a703b513986bffb8ce9.tar.gz
nfsd: move per-net startup code to separated function
NFSd resources are partially per-net and partially globally used. This patch splits resources init and shutdown and moves per-net code to separated functions. Generic and per-net init and shutdown are called sequentially for a while. 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.c48
1 files changed, 33 insertions, 15 deletions
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index b144658..038348b 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -203,6 +203,27 @@ static int nfsd_init_socks(struct net *net)
static bool nfsd_up = false;
+static int nfsd_startup_net(struct net *net)
+{
+ int ret;
+
+ ret = nfsd_init_socks(net);
+ if (ret)
+ return ret;
+ ret = lockd_up(net);
+ if (ret)
+ return ret;
+ ret = nfs4_state_start_net(net);
+ if (ret)
+ goto out_lockd;
+
+ return 0;
+
+out_lockd:
+ lockd_down(net);
+ return ret;
+}
+
static int nfsd_startup(int nrservs, struct net *net)
{
int ret;
@@ -217,31 +238,29 @@ static int nfsd_startup(int nrservs, struct net *net)
ret = nfsd_racache_init(2*nrservs);
if (ret)
return ret;
- ret = nfsd_init_socks(net);
- if (ret)
- goto out_racache;
- ret = lockd_up(net);
- if (ret)
- goto out_racache;
ret = nfs4_state_start();
if (ret)
- goto out_lockd;
-
- ret = nfs4_state_start_net(net);
+ goto out_racache;
+ ret = nfsd_startup_net(net);
if (ret)
- goto out_net_state;
+ goto out_net;
nfsd_up = true;
return 0;
-out_net_state:
+
+out_net:
nfs4_state_shutdown();
-out_lockd:
- lockd_down(net);
out_racache:
nfsd_racache_shutdown();
return ret;
}
+static void nfsd_shutdown_net(struct net *net)
+{
+ nfs4_state_shutdown_net(net);
+ lockd_down(net);
+}
+
static void nfsd_shutdown(struct net *net)
{
/*
@@ -252,9 +271,8 @@ static void nfsd_shutdown(struct net *net)
*/
if (!nfsd_up)
return;
- nfs4_state_shutdown_net(net);
+ nfsd_shutdown_net(net);
nfs4_state_shutdown();
- lockd_down(net);
nfsd_racache_shutdown();
nfsd_up = false;
}
OpenPOWER on IntegriCloud