fs/nfsd/nfssvc.c
Source file repositories/reference/linux-study-clean/fs/nfsd/nfssvc.c
File Facts
- System
- Linux kernel
- Corpus path
fs/nfsd/nfssvc.c- Extension
.c- Size
- 27448 bytes
- Lines
- 1079
- Domain
- Core OS
- Bucket
- VFS And Filesystem Core
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/sched/signal.hlinux/freezer.hlinux/module.hlinux/fs_struct.hlinux/swap.hlinux/siphash.hlinux/sunrpc/stats.hlinux/sunrpc/svcsock.hlinux/sunrpc/svc_xprt.hlinux/lockd/bind.hlinux/nfsacl.hlinux/nfslocalio.hlinux/seq_file.hlinux/inetdevice.hnet/addrconf.hnet/ipv6.hnet/net_namespace.hnfsd.hcache.hvfs.hnetns.hfilecache.htrace.h
Detected Declarations
function nfsd_support_versionfunction nfsd_versfunction nfsd_adjust_nfsd_versions4function nfsd_minorversionfunction nfsd_net_try_getfunction nfsd_net_putfunction nfsd_net_donefunction nfsd_net_freefunction nfsd_nrthreadsfunction nfsd_startup_genericfunction nfsd_shutdown_genericfunction nfsd_needs_lockdfunction nfsd_copy_write_verifierfunction nfsd_reset_write_verifier_lockedfunction statefunction nfsd_startup_netfunction nfsd_shutdown_netfunction nfsd_inetaddr_eventfunction nfsd_inet6addr_eventfunction nfsd_destroy_servfunction nfsd_reset_versionsfunction nfsd_get_default_max_blksizefunction nfsd_shutdown_threadsfunction nfsd_create_servfunction nfsd_nrpoolsfunction nfsd_get_nrthreadsfunction nfsd_set_nrthreadsfunction nfsd_svcfunction nfsd_support_acl_versionfunction nfsd_acl_rpcbind_setfunction nfsd_acl_init_requestfunction nfsd_rpcbind_setfunction nfsd_init_requestfunction nfsdfunction nfsd_dispatchfunction nfssvc_decode_voidargfunction nfssvc_encode_voidres
Annotated Snippet
if (nn->lockd_up) {
lockd_down(net);
nn->lockd_up = false;
}
wait_for_completion(&nn->nfsd_net_free_done);
}
percpu_ref_exit(&nn->nfsd_net_ref);
if (nn->nfsd_net_up)
nfsd_shutdown_generic();
nn->nfsd_net_up = false;
}
static DEFINE_SPINLOCK(nfsd_notifier_lock);
static int nfsd_inetaddr_event(struct notifier_block *this, unsigned long event,
void *ptr)
{
struct in_ifaddr *ifa = (struct in_ifaddr *)ptr;
struct net_device *dev = ifa->ifa_dev->dev;
struct net *net = dev_net(dev);
struct nfsd_net *nn = net_generic(net, nfsd_net_id);
struct sockaddr_in sin;
if (event != NETDEV_DOWN || !nn->nfsd_serv)
goto out;
spin_lock(&nfsd_notifier_lock);
if (nn->nfsd_serv) {
dprintk("nfsd_inetaddr_event: removed %pI4\n", &ifa->ifa_local);
sin.sin_family = AF_INET;
sin.sin_addr.s_addr = ifa->ifa_local;
svc_age_temp_xprts_now(nn->nfsd_serv, (struct sockaddr *)&sin);
}
spin_unlock(&nfsd_notifier_lock);
out:
return NOTIFY_DONE;
}
static struct notifier_block nfsd_inetaddr_notifier = {
.notifier_call = nfsd_inetaddr_event,
};
#if IS_ENABLED(CONFIG_IPV6)
static int nfsd_inet6addr_event(struct notifier_block *this,
unsigned long event, void *ptr)
{
struct inet6_ifaddr *ifa = (struct inet6_ifaddr *)ptr;
struct net_device *dev = ifa->idev->dev;
struct net *net = dev_net(dev);
struct nfsd_net *nn = net_generic(net, nfsd_net_id);
struct sockaddr_in6 sin6;
if (event != NETDEV_DOWN || !nn->nfsd_serv)
goto out;
spin_lock(&nfsd_notifier_lock);
if (nn->nfsd_serv) {
dprintk("nfsd_inet6addr_event: removed %pI6\n", &ifa->addr);
sin6.sin6_family = AF_INET6;
sin6.sin6_addr = ifa->addr;
if (ipv6_addr_type(&sin6.sin6_addr) & IPV6_ADDR_LINKLOCAL)
sin6.sin6_scope_id = ifa->idev->dev->ifindex;
svc_age_temp_xprts_now(nn->nfsd_serv, (struct sockaddr *)&sin6);
}
spin_unlock(&nfsd_notifier_lock);
out:
return NOTIFY_DONE;
}
static struct notifier_block nfsd_inet6addr_notifier = {
.notifier_call = nfsd_inet6addr_event,
};
#endif
/* Only used under nfsd_mutex, so this atomic may be overkill: */
static atomic_t nfsd_notifier_refcount = ATOMIC_INIT(0);
/**
* nfsd_destroy_serv - tear down NFSD's svc_serv for a namespace
* @net: network namespace the NFS service is associated with
*/
void nfsd_destroy_serv(struct net *net)
{
struct nfsd_net *nn = net_generic(net, nfsd_net_id);
struct svc_serv *serv = nn->nfsd_serv;
lockdep_assert_held(&nfsd_mutex);
Annotation
- Immediate include surface: `linux/sched/signal.h`, `linux/freezer.h`, `linux/module.h`, `linux/fs_struct.h`, `linux/swap.h`, `linux/siphash.h`, `linux/sunrpc/stats.h`, `linux/sunrpc/svcsock.h`.
- Detected declarations: `function nfsd_support_version`, `function nfsd_vers`, `function nfsd_adjust_nfsd_versions4`, `function nfsd_minorversion`, `function nfsd_net_try_get`, `function nfsd_net_put`, `function nfsd_net_done`, `function nfsd_net_free`, `function nfsd_nrthreads`, `function nfsd_startup_generic`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.