fs/nfsd/nfsctl.c
Source file repositories/reference/linux-study-clean/fs/nfsd/nfsctl.c
File Facts
- System
- Linux kernel
- Corpus path
fs/nfsd/nfsctl.c- Extension
.c- Size
- 65194 bytes
- Lines
- 2589
- Domain
- Core OS
- Bucket
- VFS And Filesystem Core
- Inferred role
- Core OS: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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/ctype.hlinux/fs_context.hlinux/sunrpc/cache.hlinux/sunrpc/svcsock.hlinux/lockd/bind.hlinux/sunrpc/addr.hlinux/sunrpc/gss_api.hlinux/sunrpc/rpc_pipe_fs.hlinux/sunrpc/svc.hlinux/module.hlinux/fsnotify.hlinux/nfslocalio.hidmap.hnfsd.hcache.hstate.hnetns.hpnfs.hfilecache.htrace.hnetlink.h
Detected Declarations
struct nfsd_genl_rqstpfunction nfsctl_transaction_writefunction nfsctl_transaction_readfunction exports_net_openfunction exports_releasefunction exports_nfsd_openfunction export_features_showfunction nfsd_pool_stats_openfunction write_unlock_ipfunction write_unlock_fsfunction write_filehandlefunction write_threadsfunction write_pool_threadsfunction nfsd_print_version_supportfunction __write_versionsfunction write_versionsfunction __write_ports_namesfunction __write_ports_addfdfunction __write_ports_addxprtfunction __write_portsfunction write_portsfunction write_maxblksizefunction __nfsd4_write_timefunction nfsd4_write_timefunction write_leasetimefunction __write_recoverydirfunction write_recoverydirfunction write_v4_end_gracefunction _nfsd_symlinkfunction _nfsd_symlinkfunction nfsdfs_create_filesfunction nfsd_client_rmdirfunction nfsd_fill_superfunction nfsd_fs_get_treefunction nfsd_fs_free_fcfunction nfsd_init_fs_contextfunction nfsd_umountfunction exports_proc_openfunction create_proc_exports_entryfunction create_proc_exports_entryfunction nfsd_genl_rpc_status_compose_msgfunction nfsd_nl_rpc_status_get_dumpitfunction list_for_each_entry_rcufunction downfunction nfsd_nl_threads_set_doitfunction nfsd_nl_threads_get_doitfunction nfsd_nl_version_set_doitfunction nlmsg_for_each_attr_type
Annotated Snippet
static const struct file_operations transaction_ops = {
.write = nfsctl_transaction_write,
.read = nfsctl_transaction_read,
.release = simple_transaction_release,
.llseek = default_llseek,
};
static int exports_net_open(struct net *net, struct file *file)
{
int err;
struct seq_file *seq;
struct nfsd_net *nn = net_generic(net, nfsd_net_id);
err = seq_open(file, &nfs_exports_op);
if (err)
return err;
seq = file->private_data;
seq->private = nn->svc_export_cache;
get_net(net);
return 0;
}
static int exports_release(struct inode *inode, struct file *file)
{
struct seq_file *seq = file->private_data;
struct cache_detail *cd = seq->private;
put_net(cd->net);
return seq_release(inode, file);
}
static int exports_nfsd_open(struct inode *inode, struct file *file)
{
return exports_net_open(inode->i_sb->s_fs_info, file);
}
static const struct file_operations exports_nfsd_operations = {
.open = exports_nfsd_open,
.read = seq_read,
.llseek = seq_lseek,
.release = exports_release,
};
static int export_features_show(struct seq_file *m, void *v)
{
seq_printf(m, "0x%x 0x%x\n", NFSEXP_ALLFLAGS, NFSEXP_SECINFO_FLAGS);
return 0;
}
DEFINE_SHOW_ATTRIBUTE(export_features);
static int nfsd_pool_stats_open(struct inode *inode, struct file *file)
{
struct nfsd_net *nn = net_generic(inode->i_sb->s_fs_info, nfsd_net_id);
return svc_pool_stats_open(&nn->nfsd_info, file);
}
static const struct file_operations pool_stats_operations = {
.open = nfsd_pool_stats_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
DEFINE_SHOW_ATTRIBUTE(nfsd_reply_cache_stats);
DEFINE_SHOW_ATTRIBUTE(nfsd_file_cache_stats);
/*----------------------------------------------------------------------------*/
/*
* payload - write methods
*/
static inline struct net *netns(struct file *file)
{
return file_inode(file)->i_sb->s_fs_info;
}
/*
* write_unlock_ip - Release all locks used by a client
*
* Experimental.
*
* Input:
* buf: '\n'-terminated C string containing a
* presentation format IP address
* size: length of C string in @buf
* Output:
Annotation
- Immediate include surface: `linux/slab.h`, `linux/namei.h`, `linux/ctype.h`, `linux/fs_context.h`, `linux/sunrpc/cache.h`, `linux/sunrpc/svcsock.h`, `linux/lockd/bind.h`, `linux/sunrpc/addr.h`.
- Detected declarations: `struct nfsd_genl_rqstp`, `function nfsctl_transaction_write`, `function nfsctl_transaction_read`, `function exports_net_open`, `function exports_release`, `function exports_nfsd_open`, `function export_features_show`, `function nfsd_pool_stats_open`, `function write_unlock_ip`, `function write_unlock_fs`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.