fs/nfsd/nfs4proc.c
Source file repositories/reference/linux-study-clean/fs/nfsd/nfs4proc.c
File Facts
- System
- Linux kernel
- Corpus path
fs/nfsd/nfs4proc.c- Extension
.c- Size
- 114405 bytes
- Lines
- 4118
- 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/fs_struct.hlinux/file.hlinux/falloc.hlinux/slab.hlinux/kthread.hlinux/namei.hlinux/sunrpc/addr.hlinux/nfs_ssc.hidmap.hcache.hxdr4.hvfs.hcurrent_stateid.hnetns.hacl.hpnfs.htrace.h
Detected Declarations
function check_attr_supportfunction nfsd4_check_open_attributesfunction is_create_with_attrsfunction fh_dup2function do_open_permissionfunction nfsd_check_obj_isregfunction nfsd4_set_open_owner_reply_cachefunction nfsd4_create_is_exclusivefunction nfsd4_vfs_createfunction nfsd4_process_open2function wefunction do_open_lookupfunction do_open_fhandlefunction copy_clientidfunction nfsd4_openfunction nfsd4_open_omfgfunction nfsd4_getfhfunction nfsd4_putfhfunction nfsd4_putrootfhfunction nfsd4_restorefhfunction nfsd4_savefhfunction nfsd4_accessfunction nfsd4_commitfunction nfsd4_createfunction nfsd4_getattrfunction nfsd4_linkfunction nfsd4_do_lookuppfunction nfsd4_lookuppfunction nfsd4_lookupfunction nfsd4_readfunction nfsd4_read_releasefunction nfsd4_readdirfunction nfsd4_readlinkfunction nfsd4_removefunction nfsd4_renamefunction nfsd4_secinfofunction nfsd4_secinfo_no_namefunction nfsd4_secinfo_releasefunction nfsd4_secinfo_no_name_releasefunction current_timefunction nfsd4_setattrfunction nfsd4_file_mark_deleg_writtenfunction nfsd4_writefunction nfsd4_verify_copyfunction nfsd4_clonefunction nfsd4_has_active_async_copiesfunction nfsd4_async_copy_reaperfunction list_for_each_safe
Annotated Snippet
if (open->op_dpacl || open->op_pacl) {
status = nfserr_inval;
goto out;
}
if (is_create_with_attrs(open)) {
status = nfsd4_acl_to_attr(NF4REG, open->op_acl,
&attrs);
if (status)
goto out;
}
} else if (is_create_with_attrs(open)) {
/* The dpacl and pacl will get released by nfsd_attrs_free(). */
attrs.na_dpacl = open->op_dpacl;
attrs.na_pacl = open->op_pacl;
open->op_dpacl = NULL;
open->op_pacl = NULL;
}
child = start_creating(&nop_mnt_idmap, parent,
&QSTR_LEN(open->op_fname, open->op_fnamelen));
if (IS_ERR(child)) {
status = nfserrno(PTR_ERR(child));
goto out;
}
if (d_really_is_negative(child)) {
status = fh_verify(rqstp, fhp, S_IFDIR, NFSD_MAY_CREATE);
if (status != nfs_ok)
goto out;
}
status = fh_compose(resfhp, fhp->fh_export, child, fhp);
if (status != nfs_ok)
goto out;
v_mtime = 0;
v_atime = 0;
if (nfsd4_create_is_exclusive(open->op_createmode)) {
u32 *verifier = (u32 *)open->op_verf.data;
/*
* Solaris 7 gets confused (bugid 4218508) if these have
* the high bit set, as do xfs filesystems without the
* "bigtime" feature. So just clear the high bits. If this
* is ever changed to use different attrs for storing the
* verifier, then do_open_lookup() will also need to be
* fixed accordingly.
*/
v_mtime = verifier[0] & 0x7fffffff;
v_atime = verifier[1] & 0x7fffffff;
}
if (d_really_is_positive(child)) {
/* NFSv4 protocol requires change attributes even though
* no change happened.
*/
status = fh_fill_both_attrs(fhp);
if (status != nfs_ok)
goto out;
switch (open->op_createmode) {
case NFS4_CREATE_UNCHECKED:
if (!d_is_reg(child))
break;
/*
* In NFSv4, we don't want to truncate the file
* now. This would be wrong if the OPEN fails for
* some other reason. Furthermore, if the size is
* nonzero, we should ignore it according to spec!
*/
open->op_truncate = (iap->ia_valid & ATTR_SIZE) &&
!iap->ia_size;
break;
case NFS4_CREATE_GUARDED:
status = nfserr_exist;
break;
case NFS4_CREATE_EXCLUSIVE:
if (inode_get_mtime_sec(d_inode(child)) == v_mtime &&
inode_get_atime_sec(d_inode(child)) == v_atime &&
d_inode(child)->i_size == 0) {
open->op_created = true;
break; /* subtle */
}
status = nfserr_exist;
break;
case NFS4_CREATE_EXCLUSIVE4_1:
if (inode_get_mtime_sec(d_inode(child)) == v_mtime &&
inode_get_atime_sec(d_inode(child)) == v_atime &&
d_inode(child)->i_size == 0) {
Annotation
- Immediate include surface: `linux/fs_struct.h`, `linux/file.h`, `linux/falloc.h`, `linux/slab.h`, `linux/kthread.h`, `linux/namei.h`, `linux/sunrpc/addr.h`, `linux/nfs_ssc.h`.
- Detected declarations: `function check_attr_support`, `function nfsd4_check_open_attributes`, `function is_create_with_attrs`, `function fh_dup2`, `function do_open_permission`, `function nfsd_check_obj_isreg`, `function nfsd4_set_open_owner_reply_cache`, `function nfsd4_create_is_exclusive`, `function nfsd4_vfs_create`, `function nfsd4_process_open2`.
- 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.