Skip to content

Commit f5f9d4a

Browse files
jtlaytonchucklever
authored andcommitted
nfsd: move reply cache initialization into nfsd startup
There's no need to start the reply cache before nfsd is up and running, and doing so means that we register a shrinker for every net namespace instead of just the ones where nfsd is running. Move it to the per-net nfsd startup instead. Reported-by: Dai Ngo <[email protected]> Signed-off-by: Jeff Layton <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
1 parent db1d616 commit f5f9d4a

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

fs/nfsd/nfsctl.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1458,16 +1458,11 @@ static __net_init int nfsd_init_net(struct net *net)
14581458
nn->nfsd_versions = NULL;
14591459
nn->nfsd4_minorversions = NULL;
14601460
nfsd4_init_leases_net(nn);
1461-
retval = nfsd_reply_cache_init(nn);
1462-
if (retval)
1463-
goto out_cache_error;
14641461
get_random_bytes(&nn->siphash_key, sizeof(nn->siphash_key));
14651462
seqlock_init(&nn->writeverf_lock);
14661463

14671464
return 0;
14681465

1469-
out_cache_error:
1470-
nfsd_idmap_shutdown(net);
14711466
out_idmap_error:
14721467
nfsd_export_shutdown(net);
14731468
out_export_error:
@@ -1476,9 +1471,6 @@ static __net_init int nfsd_init_net(struct net *net)
14761471

14771472
static __net_exit void nfsd_exit_net(struct net *net)
14781473
{
1479-
struct nfsd_net *nn = net_generic(net, nfsd_net_id);
1480-
1481-
nfsd_reply_cache_shutdown(nn);
14821474
nfsd_idmap_shutdown(net);
14831475
nfsd_export_shutdown(net);
14841476
nfsd_netns_free_versions(net_generic(net, nfsd_net_id));

fs/nfsd/nfssvc.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,16 +427,23 @@ static int nfsd_startup_net(struct net *net, const struct cred *cred)
427427
ret = nfsd_file_cache_start_net(net);
428428
if (ret)
429429
goto out_lockd;
430-
ret = nfs4_state_start_net(net);
430+
431+
ret = nfsd_reply_cache_init(nn);
431432
if (ret)
432433
goto out_filecache;
433434

435+
ret = nfs4_state_start_net(net);
436+
if (ret)
437+
goto out_reply_cache;
438+
434439
#ifdef CONFIG_NFSD_V4_2_INTER_SSC
435440
nfsd4_ssc_init_umount_work(nn);
436441
#endif
437442
nn->nfsd_net_up = true;
438443
return 0;
439444

445+
out_reply_cache:
446+
nfsd_reply_cache_shutdown(nn);
440447
out_filecache:
441448
nfsd_file_cache_shutdown_net(net);
442449
out_lockd:
@@ -454,6 +461,7 @@ static void nfsd_shutdown_net(struct net *net)
454461
struct nfsd_net *nn = net_generic(net, nfsd_net_id);
455462

456463
nfs4_state_shutdown_net(net);
464+
nfsd_reply_cache_shutdown(nn);
457465
nfsd_file_cache_shutdown_net(net);
458466
if (nn->lockd_up) {
459467
lockd_down(net);

0 commit comments

Comments
 (0)