diff options
Diffstat (limited to 'fs/nfsd/nfssvc.c')
-rw-r--r-- | fs/nfsd/nfssvc.c | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c index 760c85a6f534..9a4a5f9e7468 100644 --- a/fs/nfsd/nfssvc.c +++ b/fs/nfsd/nfssvc.c | |||
@@ -241,6 +241,15 @@ static void nfsd_shutdown_generic(void) | |||
241 | nfsd_racache_shutdown(); | 241 | nfsd_racache_shutdown(); |
242 | } | 242 | } |
243 | 243 | ||
244 | static bool nfsd_needs_lockd(void) | ||
245 | { | ||
246 | #if defined(CONFIG_NFSD_V3) | ||
247 | return (nfsd_versions[2] != NULL) || (nfsd_versions[3] != NULL); | ||
248 | #else | ||
249 | return (nfsd_versions[2] != NULL); | ||
250 | #endif | ||
251 | } | ||
252 | |||
244 | static int nfsd_startup_net(int nrservs, struct net *net) | 253 | static int nfsd_startup_net(int nrservs, struct net *net) |
245 | { | 254 | { |
246 | struct nfsd_net *nn = net_generic(net, nfsd_net_id); | 255 | struct nfsd_net *nn = net_generic(net, nfsd_net_id); |
@@ -255,9 +264,14 @@ static int nfsd_startup_net(int nrservs, struct net *net) | |||
255 | ret = nfsd_init_socks(net); | 264 | ret = nfsd_init_socks(net); |
256 | if (ret) | 265 | if (ret) |
257 | goto out_socks; | 266 | goto out_socks; |
258 | ret = lockd_up(net); | 267 | |
259 | if (ret) | 268 | if (nfsd_needs_lockd() && !nn->lockd_up) { |
260 | goto out_socks; | 269 | ret = lockd_up(net); |
270 | if (ret) | ||
271 | goto out_socks; | ||
272 | nn->lockd_up = 1; | ||
273 | } | ||
274 | |||
261 | ret = nfs4_state_start_net(net); | 275 | ret = nfs4_state_start_net(net); |
262 | if (ret) | 276 | if (ret) |
263 | goto out_lockd; | 277 | goto out_lockd; |
@@ -266,7 +280,10 @@ static int nfsd_startup_net(int nrservs, struct net *net) | |||
266 | return 0; | 280 | return 0; |
267 | 281 | ||
268 | out_lockd: | 282 | out_lockd: |
269 | lockd_down(net); | 283 | if (nn->lockd_up) { |
284 | lockd_down(net); | ||
285 | nn->lockd_up = 0; | ||
286 | } | ||
270 | out_socks: | 287 | out_socks: |
271 | nfsd_shutdown_generic(); | 288 | nfsd_shutdown_generic(); |
272 | return ret; | 289 | return ret; |
@@ -277,7 +294,10 @@ static void nfsd_shutdown_net(struct net *net) | |||
277 | struct nfsd_net *nn = net_generic(net, nfsd_net_id); | 294 | struct nfsd_net *nn = net_generic(net, nfsd_net_id); |
278 | 295 | ||
279 | nfs4_state_shutdown_net(net); | 296 | nfs4_state_shutdown_net(net); |
280 | lockd_down(net); | 297 | if (nn->lockd_up) { |
298 | lockd_down(net); | ||
299 | nn->lockd_up = 0; | ||
300 | } | ||
281 | nn->nfsd_net_up = false; | 301 | nn->nfsd_net_up = false; |
282 | nfsd_shutdown_generic(); | 302 | nfsd_shutdown_generic(); |
283 | } | 303 | } |