diff options
author | Stanislav Kinsbursky <skinsbursky@parallels.com> | 2012-12-06 06:23:09 -0500 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2012-12-10 16:25:36 -0500 |
commit | 6ff50b3dea9a242b50642a703b513986bffb8ce9 (patch) | |
tree | 04c9a7bc28f512ee92e1821a7375432423cbf002 /fs/nfsd/nfssvc.c | |
parent | 081603520b25f7b35ef63a363376a17c36ef74ed (diff) |
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.c | 48 |
1 files changed, 33 insertions, 15 deletions
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c index b144658c49b2..038348bc1a09 100644 --- a/fs/nfsd/nfssvc.c +++ b/fs/nfsd/nfssvc.c | |||
@@ -203,6 +203,27 @@ static int nfsd_init_socks(struct net *net) | |||
203 | 203 | ||
204 | static bool nfsd_up = false; | 204 | static bool nfsd_up = false; |
205 | 205 | ||
206 | static int nfsd_startup_net(struct net *net) | ||
207 | { | ||
208 | int ret; | ||
209 | |||
210 | ret = nfsd_init_socks(net); | ||
211 | if (ret) | ||
212 | return ret; | ||
213 | ret = lockd_up(net); | ||
214 | if (ret) | ||
215 | return ret; | ||
216 | ret = nfs4_state_start_net(net); | ||
217 | if (ret) | ||
218 | goto out_lockd; | ||
219 | |||
220 | return 0; | ||
221 | |||
222 | out_lockd: | ||
223 | lockd_down(net); | ||
224 | return ret; | ||
225 | } | ||
226 | |||
206 | static int nfsd_startup(int nrservs, struct net *net) | 227 | static int nfsd_startup(int nrservs, struct net *net) |
207 | { | 228 | { |
208 | int ret; | 229 | int ret; |
@@ -217,31 +238,29 @@ static int nfsd_startup(int nrservs, struct net *net) | |||
217 | ret = nfsd_racache_init(2*nrservs); | 238 | ret = nfsd_racache_init(2*nrservs); |
218 | if (ret) | 239 | if (ret) |
219 | return ret; | 240 | return ret; |
220 | ret = nfsd_init_socks(net); | ||
221 | if (ret) | ||
222 | goto out_racache; | ||
223 | ret = lockd_up(net); | ||
224 | if (ret) | ||
225 | goto out_racache; | ||
226 | ret = nfs4_state_start(); | 241 | ret = nfs4_state_start(); |
227 | if (ret) | 242 | if (ret) |
228 | goto out_lockd; | 243 | goto out_racache; |
229 | 244 | ret = nfsd_startup_net(net); | |
230 | ret = nfs4_state_start_net(net); | ||
231 | if (ret) | 245 | if (ret) |
232 | goto out_net_state; | 246 | goto out_net; |
233 | 247 | ||
234 | nfsd_up = true; | 248 | nfsd_up = true; |
235 | return 0; | 249 | return 0; |
236 | out_net_state: | 250 | |
251 | out_net: | ||
237 | nfs4_state_shutdown(); | 252 | nfs4_state_shutdown(); |
238 | out_lockd: | ||
239 | lockd_down(net); | ||
240 | out_racache: | 253 | out_racache: |
241 | nfsd_racache_shutdown(); | 254 | nfsd_racache_shutdown(); |
242 | return ret; | 255 | return ret; |
243 | } | 256 | } |
244 | 257 | ||
258 | static void nfsd_shutdown_net(struct net *net) | ||
259 | { | ||
260 | nfs4_state_shutdown_net(net); | ||
261 | lockd_down(net); | ||
262 | } | ||
263 | |||
245 | static void nfsd_shutdown(struct net *net) | 264 | static void nfsd_shutdown(struct net *net) |
246 | { | 265 | { |
247 | /* | 266 | /* |
@@ -252,9 +271,8 @@ static void nfsd_shutdown(struct net *net) | |||
252 | */ | 271 | */ |
253 | if (!nfsd_up) | 272 | if (!nfsd_up) |
254 | return; | 273 | return; |
255 | nfs4_state_shutdown_net(net); | 274 | nfsd_shutdown_net(net); |
256 | nfs4_state_shutdown(); | 275 | nfs4_state_shutdown(); |
257 | lockd_down(net); | ||
258 | nfsd_racache_shutdown(); | 276 | nfsd_racache_shutdown(); |
259 | nfsd_up = false; | 277 | nfsd_up = false; |
260 | } | 278 | } |