diff mbox series

nfsd: nfsd_destroy_serv() must call svc_destroy() even if nfsd_startup_net() failed

Message ID 172704876504.17050.1958700732037877952@noble.neil.brown.name (mailing list archive)
State New
Headers show
Series nfsd: nfsd_destroy_serv() must call svc_destroy() even if nfsd_startup_net() failed | expand

Commit Message

NeilBrown Sept. 22, 2024, 11:46 p.m. UTC
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>
---
 fs/nfsd/nfssvc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)


base-commit: 509abfc7a0ba66afa648e8216306acdc55ec54ed

Comments

Chuck Lever Sept. 23, 2024, 2:45 p.m. UTC | #1
From: Chuck Lever <chuck.lever@oracle.com>

On Mon, 23 Sep 2024 09:46:05 +1000, NeilBrown wrote:                                              
> If nfsd_startup_net() fails and so ->nfsd_net_up is false,
> nfsd_destroy_serv() doesn't currently call svc_destroy().  It should.
> 
>                                                                         

Applied to nfsd-fixes for v6.12-rc, thanks!                                                                

[1/1] nfsd: nfsd_destroy_serv() must call svc_destroy() even if nfsd_startup_net() failed
      commit: 53e4e17557049d7688ca9dadeae80864d40cf0b7                                                                      

--                                                                              
Chuck Lever
diff mbox series

Patch

diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index defc430f912f..5f8637b7a7a4 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -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);
 }