fs/nfsd/export.c
Source file repositories/reference/linux-study-clean/fs/nfsd/export.c
File Facts
- System
- Linux kernel
- Corpus path
fs/nfsd/export.c- Extension
.c- Size
- 56273 bytes
- Lines
- 2253
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/slab.hlinux/namei.hlinux/module.hlinux/exportfs.hlinux/sunrpc/svc_xprt.hnet/genetlink.huapi/linux/nfsd_netlink.hnfsd.hnfsfh.hnetns.hpnfs.hfilecache.htrace.hnetlink.h
Detected Declarations
function Copyrightfunction expkey_upcallfunction expkey_requestfunction expkey_parsefunction expkey_showfunction expkey_matchfunction expkey_initfunction expkey_updatefunction expkey_flushfunction expkey_notifyfunction svc_expkey_hashfunction svc_expkey_lookupfunction svc_expkey_updatefunction nfsd_nl_expkey_get_reqs_dumpitfunction nfsd_nl_parse_one_expkeyfunction nfsd_nl_expkey_set_reqs_doitfunction nlmsg_for_each_attr_typefunction nfsd4_fslocs_freefunction export_stats_initfunction export_stats_resetfunction export_stats_destroyfunction svc_export_releasefunction svc_export_putfunction nfsd_nl_svc_export_get_reqs_dumpitfunction nfsd_nl_parse_fslocationsfunction nla_for_each_nested_typefunction nfsd_nl_parse_one_exportfunction nla_for_each_nested_typefunction nla_for_each_nested_typefunction nfsd_nl_svc_export_set_reqs_doitfunction nlmsg_for_each_attr_typefunction svc_export_upcallfunction svc_export_notifyfunction svc_export_requestfunction check_exportfunction numberfunction fsloc_parsefunction secinfo_parsefunction fsloc_parsefunction secinfo_parsefunction xprtsec_parsefunction nfsd_uuid_parsefunction svc_export_parsefunction is_export_stats_filefunction svc_export_showfunction svc_export_matchfunction svc_export_initfunction export_update
Annotated Snippet
key_len(ek->ek_fsidtype), ek->ek_fsid)) {
nla_nest_cancel(skb, nest);
break;
}
nla_nest_end(skb, nest);
cb->args[0] = seqnos[i];
emitted++;
}
if (!emitted) {
genlmsg_cancel(skb, hdr);
ret = -EMSGSIZE;
goto out_put;
}
genlmsg_end(skb, hdr);
ret = skb->len;
out_put:
for (i = 0; i < cnt; i++)
cache_put(items[i], cd);
out_alloc:
kfree(seqnos);
kfree(items);
out_unlock:
mutex_unlock(&nfsd_mutex);
return ret;
}
/**
* nfsd_nl_parse_one_expkey - parse one expkey entry from netlink
* @cd: cache_detail for the expkey cache
* @attr: nested attribute containing expkey fields
*
* Parses one expkey entry from a netlink message and updates the
* cache. Mirrors the logic in expkey_parse().
*
* Returns 0 on success or a negative errno.
*/
static int nfsd_nl_parse_one_expkey(struct cache_detail *cd,
struct nlattr *attr)
{
struct nlattr *tb[NFSD_A_EXPKEY_PATH + 1];
struct auth_domain *dom = NULL;
struct svc_expkey key;
struct svc_expkey *ek = NULL;
struct timespec64 boot;
int err;
u8 fsidtype;
int fsid_len;
err = nla_parse_nested(tb, NFSD_A_EXPKEY_PATH, attr,
nfsd_expkey_nl_policy, NULL);
if (err)
return err;
/* client (required) */
if (!tb[NFSD_A_EXPKEY_CLIENT])
return -EINVAL;
dom = auth_domain_find(nla_data(tb[NFSD_A_EXPKEY_CLIENT]));
if (!dom)
return -ENOENT;
/* fsidtype (required) */
if (!tb[NFSD_A_EXPKEY_FSIDTYPE]) {
err = -EINVAL;
goto out_dom;
}
fsidtype = nla_get_u8(tb[NFSD_A_EXPKEY_FSIDTYPE]);
if (key_len(fsidtype) == 0) {
err = -EINVAL;
goto out_dom;
}
/* fsid (required) */
if (!tb[NFSD_A_EXPKEY_FSID]) {
err = -EINVAL;
goto out_dom;
}
fsid_len = nla_len(tb[NFSD_A_EXPKEY_FSID]);
if (fsid_len != key_len(fsidtype)) {
err = -EINVAL;
goto out_dom;
}
/* expiry (required, wallclock seconds) */
if (!tb[NFSD_A_EXPKEY_EXPIRY]) {
err = -EINVAL;
goto out_dom;
Annotation
- Immediate include surface: `linux/slab.h`, `linux/namei.h`, `linux/module.h`, `linux/exportfs.h`, `linux/sunrpc/svc_xprt.h`, `net/genetlink.h`, `uapi/linux/nfsd_netlink.h`, `nfsd.h`.
- Detected declarations: `function Copyright`, `function expkey_upcall`, `function expkey_request`, `function expkey_parse`, `function expkey_show`, `function expkey_match`, `function expkey_init`, `function expkey_update`, `function expkey_flush`, `function expkey_notify`.
- 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.