-
Notifications
You must be signed in to change notification settings - Fork 0
nfsd load
MODULE_ALIAS_FS("nfsd");
will make alias fs-nfsd nfsd
appear in /lib/modules/$(uname -r)/modules.aliases
, so when mount -t nfsd nfsd /proc/fs/nfsd
is executed by proc-fs-nfsd.mount
, the module is requested by https://elixir.bootlin.com/linux/v5.7/source/fs/filesystems.c#L273
struct file_system_type *get_fs_type(const char *name)
{
/* ... */
fs = __get_fs_type(name, len);
if (!fs && (request_module("fs-%.*s", len, name) == 0)) {
fs = __get_fs_type(name, len);
/* ... */
https://elixir.bootlin.com/linux/v5.7/source/fs/nfsd/nfsctl.c#L1577
module_init(init_nfsd)
https://elixir.bootlin.com/linux/v5.7/source/fs/nfsd/nfsctl.c#L1517
unsigned int nfsd_net_id;
/* ... */
static struct pernet_operations nfsd_net_ops = {
.init = nfsd_init_net,
.exit = nfsd_exit_net,
.id = &nfsd_net_id,
.size = sizeof(struct nfsd_net),
};
static int __init init_nfsd(void)
{
int retval;
printk(KERN_INFO "Installing knfsd (copyright (C) 1996 okir@monad.swb.de).\n");
retval = register_pernet_subsys(&nfsd_net_ops);
A zero filled struct nfsd_net
is allocated and nfsd_init_net
is called for each existing network namespace and will be done for each future network namespace.
https://elixir.bootlin.com/linux/v5.7/source/fs/nfsd/nfsctl.c#L1451
static __net_init int nfsd_init_net(struct net *net)
{
int retval;
struct vfsmount *mnt;
struct nfsd_net *nn = net_generic(net, nfsd_net_id);
retval = nfsd_export_init(net);
if (retval)
goto out_export_error;
init nfsd.export und nfsd.export caches and their /proc/net/rpc/NAME..
retval = nfsd_idmap_init(net);
if (retval)
goto out_idmap_error;
init "nfs4.nametoid" and "nfs4.idtoname" cached (nfs4 UID/GID mappings to names)