Skip to content

Commit 5e092be

Browse files
committed
NFSD: Distinguish per-net namespace initialization
I find the naming of nfsd_init_net() and nfsd_startup_net() to be confusingly similar. Rename the namespace initialization and tear- down ops and add comments to distinguish their separate purposes. Signed-off-by: Chuck Lever <[email protected]>
1 parent ed9ab73 commit 5e092be

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

fs/nfsd/nfsctl.c

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1494,7 +1494,17 @@ static int create_proc_exports_entry(void)
14941494

14951495
unsigned int nfsd_net_id;
14961496

1497-
static __net_init int nfsd_init_net(struct net *net)
1497+
/**
1498+
* nfsd_net_init - Prepare the nfsd_net portion of a new net namespace
1499+
* @net: a freshly-created network namespace
1500+
*
1501+
* This information stays around as long as the network namespace is
1502+
* alive whether or not there is an NFSD instance running in the
1503+
* namespace.
1504+
*
1505+
* Returns zero on success, or a negative errno otherwise.
1506+
*/
1507+
static __net_init int nfsd_net_init(struct net *net)
14981508
{
14991509
int retval;
15001510
struct nfsd_net *nn = net_generic(net, nfsd_net_id);
@@ -1524,7 +1534,12 @@ static __net_init int nfsd_init_net(struct net *net)
15241534
return retval;
15251535
}
15261536

1527-
static __net_exit void nfsd_exit_net(struct net *net)
1537+
/**
1538+
* nfsd_net_exit - Release the nfsd_net portion of a net namespace
1539+
* @net: a network namespace that is about to be destroyed
1540+
*
1541+
*/
1542+
static __net_exit void nfsd_net_exit(struct net *net)
15281543
{
15291544
struct nfsd_net *nn = net_generic(net, nfsd_net_id);
15301545

@@ -1535,8 +1550,8 @@ static __net_exit void nfsd_exit_net(struct net *net)
15351550
}
15361551

15371552
static struct pernet_operations nfsd_net_ops = {
1538-
.init = nfsd_init_net,
1539-
.exit = nfsd_exit_net,
1553+
.init = nfsd_net_init,
1554+
.exit = nfsd_net_exit,
15401555
.id = &nfsd_net_id,
15411556
.size = sizeof(struct nfsd_net),
15421557
};

fs/nfsd/nfssvc.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,11 @@ void nfsd_reset_write_verifier(struct nfsd_net *nn)
402402
write_sequnlock(&nn->writeverf_lock);
403403
}
404404

405+
/*
406+
* Crank up a set of per-namespace resources for a new NFSD instance,
407+
* including lockd, a duplicate reply cache, an open file cache
408+
* instance, and a cache of NFSv4 state objects.
409+
*/
405410
static int nfsd_startup_net(struct net *net, const struct cred *cred)
406411
{
407412
struct nfsd_net *nn = net_generic(net, nfsd_net_id);

0 commit comments

Comments
 (0)