]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
nfsd: don't destroy global nfs4_file table in per-net shutdown
authorJeff Layton <jlayton@kernel.org>
Sat, 11 Feb 2023 12:50:08 +0000 (07:50 -0500)
committerChuck Lever <chuck.lever@oracle.com>
Sat, 11 Feb 2023 17:09:44 +0000 (12:09 -0500)
The nfs4_file table is global, so shutting it down when a containerized
nfsd is shut down is wrong and can lead to double-frees. Tear down the
nfs4_file_rhltable in nfs4_state_shutdown instead of
nfs4_state_shutdown_net.

Fixes: d47b295e8d76 ("NFSD: Use rhashtable for managing nfs4_file objects")
Link: https://bugzilla.redhat.com/show_bug.cgi?id=2169017
Reported-by: JianHong Yin <jiyin@redhat.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/nfs4state.c

index f194d029c3d641652d5e3ce83728b8ad5ce2eb46..0fb09e37e12fa878fc98643ed84ac3ebc127b5d0 100644 (file)
@@ -8182,7 +8182,6 @@ nfs4_state_shutdown_net(struct net *net)
 
        nfsd4_client_tracking_exit(net);
        nfs4_state_destroy_net(net);
-       rhltable_destroy(&nfs4_file_rhltable);
 #ifdef CONFIG_NFSD_V4_2_INTER_SSC
        nfsd4_ssc_shutdown_umount(nn);
 #endif
@@ -8192,6 +8191,7 @@ void
 nfs4_state_shutdown(void)
 {
        nfsd4_destroy_callback_queue();
+       rhltable_destroy(&nfs4_file_rhltable);
 }
 
 static void