fs/nfs/nfs3proc.c
Source file repositories/reference/linux-study-clean/fs/nfs/nfs3proc.c
File Facts
- System
- Linux kernel
- Corpus path
fs/nfs/nfs3proc.c- Extension
.c- Size
- 28827 bytes
- Lines
- 1129
- 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/mm.hlinux/errno.hlinux/string.hlinux/sunrpc/clnt.hlinux/slab.hlinux/nfs.hlinux/nfs3.hlinux/nfs_fs.hlinux/nfs_page.hlinux/filelock.hlinux/lockd/bind.hlinux/nfs_mount.hlinux/freezer.hlinux/xattr.hiostat.hinternal.hnfs3_fs.h
Detected Declarations
struct nfs3_createdatafunction Copyrightfunction nfs3_async_handle_jukeboxfunction do_proc_get_rootfunction nfs3_proc_get_rootfunction nfs3_proc_getattrfunction nfs3_proc_setattrfunction __nfs3_proc_lookupfunction nfs3_proc_lookupfunction nfs3_proc_lookuppfunction nfs3_proc_accessfunction nfs3_proc_readlinkfunction nfs3_do_createfunction nfs3_free_createdatafunction nfs3_proc_createfunction nfs3_proc_removefunction nfs3_proc_unlink_setupfunction nfs3_proc_unlink_rpc_preparefunction nfs3_proc_unlink_donefunction nfs3_proc_rename_setupfunction nfs3_proc_rename_rpc_preparefunction nfs3_proc_rename_donefunction nfs3_proc_linkfunction nfs3_proc_symlinkfunction nfs3_proc_mkdirfunction nfs3_proc_rmdirfunction nfs3_proc_readdirfunction nfs3_proc_mknodfunction nfs3_proc_statfsfunction do_proc_fsinfofunction nfs3_proc_fsinfofunction nfs3_proc_pathconffunction nfs3_localio_probefunction Tryfunction nfs3_localio_probefunction nfs3_proc_read_setupfunction nfs3_proc_pgio_rpc_preparefunction nfs3_write_donefunction nfs3_proc_write_setupfunction nfs3_proc_commit_rpc_preparefunction nfs3_commit_donefunction nfs3_proc_commit_setupfunction nfs3_nlm_alloc_callfunction nfs3_nlm_unlock_preparefunction nfs3_nlm_release_callfunction nfs3_proc_lockfunction nfs3_have_delegationfunction nfs3_return_delegation
Annotated Snippet
struct nfs3_createdata {
struct rpc_message msg;
union {
struct nfs3_createargs create;
struct nfs3_mkdirargs mkdir;
struct nfs3_symlinkargs symlink;
struct nfs3_mknodargs mknod;
} arg;
struct nfs3_diropres res;
struct nfs_fh fh;
struct nfs_fattr fattr;
struct nfs_fattr dir_attr;
};
static struct nfs3_createdata *nfs3_alloc_createdata(void)
{
struct nfs3_createdata *data;
data = kzalloc_obj(*data);
if (data != NULL) {
data->msg.rpc_argp = &data->arg;
data->msg.rpc_resp = &data->res;
data->res.fh = &data->fh;
data->res.fattr = &data->fattr;
data->res.dir_attr = &data->dir_attr;
nfs_fattr_init(data->res.fattr);
nfs_fattr_init(data->res.dir_attr);
}
return data;
}
static struct dentry *
nfs3_do_create(struct inode *dir, struct dentry *dentry, struct nfs3_createdata *data)
{
int status;
status = rpc_call_sync(NFS_CLIENT(dir), &data->msg, 0);
nfs_post_op_update_inode(dir, data->res.dir_attr);
if (status != 0)
return ERR_PTR(status);
return nfs_add_or_obtain(dentry, data->res.fh, data->res.fattr);
}
static void nfs3_free_createdata(struct nfs3_createdata *data)
{
kfree(data);
}
/*
* Create a regular file.
*/
static int
nfs3_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
int flags)
{
struct posix_acl *default_acl, *acl;
struct nfs3_createdata *data;
struct dentry *d_alias;
int status = -ENOMEM;
dprintk("NFS call create %pd\n", dentry);
data = nfs3_alloc_createdata();
if (data == NULL)
goto out;
data->msg.rpc_proc = &nfs3_procedures[NFS3PROC_CREATE];
data->arg.create.fh = NFS_FH(dir);
data->arg.create.name = dentry->d_name.name;
data->arg.create.len = dentry->d_name.len;
data->arg.create.sattr = sattr;
data->arg.create.createmode = NFS3_CREATE_UNCHECKED;
if (flags & O_EXCL) {
data->arg.create.createmode = NFS3_CREATE_EXCLUSIVE;
data->arg.create.verifier[0] = cpu_to_be32(jiffies);
data->arg.create.verifier[1] = cpu_to_be32(current->pid);
}
status = posix_acl_create(dir, &sattr->ia_mode, &default_acl, &acl);
if (status)
goto out;
for (;;) {
d_alias = nfs3_do_create(dir, dentry, data);
status = PTR_ERR_OR_ZERO(d_alias);
if (status != -ENOTSUPP)
break;
Annotation
- Immediate include surface: `linux/mm.h`, `linux/errno.h`, `linux/string.h`, `linux/sunrpc/clnt.h`, `linux/slab.h`, `linux/nfs.h`, `linux/nfs3.h`, `linux/nfs_fs.h`.
- Detected declarations: `struct nfs3_createdata`, `function Copyright`, `function nfs3_async_handle_jukebox`, `function do_proc_get_root`, `function nfs3_proc_get_root`, `function nfs3_proc_getattr`, `function nfs3_proc_setattr`, `function __nfs3_proc_lookup`, `function nfs3_proc_lookup`, `function nfs3_proc_lookupp`.
- 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.