]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
nfsd: nfsd_destroy_serv() must call svc_destroy() even if nfsd_startup_net() failed
authorNeilBrown <neilb@suse.de>
Sun, 22 Sep 2024 23:46:05 +0000 (09:46 +1000)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 23 Sep 2024 14:37:32 +0000 (10:37 -0400)
If nfsd_startup_net() fails and so ->nfsd_net_up is false,
nfsd_destroy_serv() doesn't currently call svc_destroy().  It should.

Fixes: 1e3577a4521e ("SUNRPC: discard sv_refcnt, and svc_get/svc_put")
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/nfssvc.c

index defc430f912f6dd32f7a28c68b3963ef182ec1b9..5f8637b7a7a414988003a9c2213356e0f4bffcc1 100644 (file)
@@ -385,6 +385,9 @@ static void nfsd_shutdown_net(struct net *net)
 {
        struct nfsd_net *nn = net_generic(net, nfsd_net_id);
 
+       if (!nn->nfsd_net_up)
+               return;
+       nfsd_export_flush(net);
        nfs4_state_shutdown_net(net);
        nfsd_reply_cache_shutdown(nn);
        nfsd_file_cache_shutdown_net(net);
@@ -492,11 +495,8 @@ void nfsd_destroy_serv(struct net *net)
         * other initialization has been done except the rpcb information.
         */
        svc_rpcb_cleanup(serv, net);
-       if (!nn->nfsd_net_up)
-               return;
 
        nfsd_shutdown_net(net);
-       nfsd_export_flush(net);
        svc_destroy(&serv);
 }