]> Pileus Git - ~andy/linux/blobdiff - fs/nfsd/nfssvc.c
keep shadowed vfsmounts together
[~andy/linux] / fs / nfsd / nfssvc.c
index 760c85a6f534a45b0eb396a62acc305484163109..9a4a5f9e7468748f7195ac92f86d7317c83e0822 100644 (file)
@@ -241,6 +241,15 @@ static void nfsd_shutdown_generic(void)
        nfsd_racache_shutdown();
 }
 
+static bool nfsd_needs_lockd(void)
+{
+#if defined(CONFIG_NFSD_V3)
+       return (nfsd_versions[2] != NULL) || (nfsd_versions[3] != NULL);
+#else
+       return (nfsd_versions[2] != NULL);
+#endif
+}
+
 static int nfsd_startup_net(int nrservs, struct net *net)
 {
        struct nfsd_net *nn = net_generic(net, nfsd_net_id);
@@ -255,9 +264,14 @@ static int nfsd_startup_net(int nrservs, struct net *net)
        ret = nfsd_init_socks(net);
        if (ret)
                goto out_socks;
-       ret = lockd_up(net);
-       if (ret)
-               goto out_socks;
+
+       if (nfsd_needs_lockd() && !nn->lockd_up) {
+               ret = lockd_up(net);
+               if (ret)
+                       goto out_socks;
+               nn->lockd_up = 1;
+       }
+
        ret = nfs4_state_start_net(net);
        if (ret)
                goto out_lockd;
@@ -266,7 +280,10 @@ static int nfsd_startup_net(int nrservs, struct net *net)
        return 0;
 
 out_lockd:
-       lockd_down(net);
+       if (nn->lockd_up) {
+               lockd_down(net);
+               nn->lockd_up = 0;
+       }
 out_socks:
        nfsd_shutdown_generic();
        return ret;
@@ -277,7 +294,10 @@ static void nfsd_shutdown_net(struct net *net)
        struct nfsd_net *nn = net_generic(net, nfsd_net_id);
 
        nfs4_state_shutdown_net(net);
-       lockd_down(net);
+       if (nn->lockd_up) {
+               lockd_down(net);
+               nn->lockd_up = 0;
+       }
        nn->nfsd_net_up = false;
        nfsd_shutdown_generic();
 }