fs/nfs/nfs4proc.c
Source file repositories/reference/linux-study-clean/fs/nfs/nfs4proc.c
File Facts
- System
- Linux kernel
- Corpus path
fs/nfs/nfs4proc.c- Extension
.c- Size
- 295102 bytes
- Lines
- 10752
- Domain
- Core OS
- Bucket
- VFS And Filesystem Core
- Inferred role
- Core OS: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/delay.hlinux/errno.hlinux/string.hlinux/ratelimit.hlinux/printk.hlinux/slab.hlinux/sunrpc/clnt.hlinux/nfs.hlinux/nfs4.hlinux/nfs_fs.hlinux/nfs_page.hlinux/nfs_mount.hlinux/namei.hlinux/mount.hlinux/module.hlinux/xattr.hlinux/utsname.hlinux/freezer.hlinux/iversion.hnfs4_fs.hdelegation.hinternal.hiostat.hcallback.hpnfs.hnetns.hsysfs.hnfs4idmap.hnfs4session.hfscache.hnfs40.h
Detected Declarations
struct nfs4_opendatastruct nfs4_open_createattrsstruct nfs4_closedatastruct nfs4_createdatastruct nfs4_cached_aclstruct nfs4_delegreturndatastruct nfs4_unlockdatastruct nfs4_lockdatastruct nfs4_lock_waiterstruct rpc_bind_conn_calldatastruct nfs41_exchange_id_datastruct nfs4_get_lease_time_datastruct nfs4_sequence_datastruct nfs4_reclaim_complete_datastruct nfs_free_stateid_datafunction nfs4_label_init_securityfunction nfs4_label_release_securityfunction nfs4_label_init_securityfunction nfs4_label_release_securityfunction nfs4_bitmaskfunction nfs4_map_errorsfunction nfs4_bitmap_copy_adjustfunction nfs4_setup_readdirfunction nfs4_fattr_set_prechangefunction nfs4_test_and_free_stateidfunction __nfs4_free_revoked_stateidfunction nfs4_free_revoked_stateidfunction nfs4_update_delayfunction nfs4_delay_killablefunction nfs4_delay_interruptiblefunction nfs4_delayfunction nfs4_recoverable_stateidfunction nfs4_do_handle_exceptionfunction nfs4_exception_should_retransfunction nfs4_handle_exceptionfunction nfs4_async_handle_exceptionfunction nfs4_async_handle_errorfunction _nfs4_is_integrity_protectedfunction do_renew_leasefunction renew_leasefunction nfs4_init_sequencefunction nfs41_release_slotfunction nfs41_sequence_free_slotfunction nfs4_slot_sequence_record_sentfunction nfs4_slot_sequence_ackedfunction nfs4_probe_sequencefunction nfs41_sequence_processfunction nfs41_sequence_done
Annotated Snippet
struct nfs4_open_createattrs {
struct nfs4_label *label;
struct iattr *sattr;
const __u32 verf[2];
};
static bool nfs4_clear_cap_atomic_open_v1(struct nfs_server *server,
int err, struct nfs4_exception *exception)
{
if (err != -EINVAL)
return false;
if (!(server->caps & NFS_CAP_ATOMIC_OPEN_V1))
return false;
server->caps &= ~NFS_CAP_ATOMIC_OPEN_V1;
exception->retry = 1;
return true;
}
static fmode_t _nfs4_ctx_to_accessmode(const struct nfs_open_context *ctx)
{
return ctx->mode & (FMODE_READ|FMODE_WRITE|FMODE_EXEC);
}
static fmode_t _nfs4_ctx_to_openmode(const struct nfs_open_context *ctx)
{
fmode_t ret = ctx->mode & (FMODE_READ|FMODE_WRITE);
return (ctx->mode & FMODE_EXEC) ? FMODE_READ | ret : ret;
}
static u32
nfs4_fmode_to_share_access(fmode_t fmode)
{
u32 res = 0;
switch (fmode & (FMODE_READ | FMODE_WRITE)) {
case FMODE_READ:
res = NFS4_SHARE_ACCESS_READ;
break;
case FMODE_WRITE:
res = NFS4_SHARE_ACCESS_WRITE;
break;
case FMODE_READ|FMODE_WRITE:
res = NFS4_SHARE_ACCESS_BOTH;
}
return res;
}
static u32
nfs4_map_atomic_open_share(struct nfs_server *server,
fmode_t fmode, int openflags)
{
u32 res = nfs4_fmode_to_share_access(fmode);
if (!(server->caps & NFS_CAP_ATOMIC_OPEN_V1))
goto out;
/* Want no delegation if we're using O_DIRECT */
if (openflags & O_DIRECT) {
res |= NFS4_SHARE_WANT_NO_DELEG;
goto out;
}
/* res |= NFS4_SHARE_WANT_NO_PREFERENCE; */
if (server->caps & NFS_CAP_DELEGTIME)
res |= NFS4_SHARE_WANT_DELEG_TIMESTAMPS;
if (server->caps & NFS_CAP_OPEN_XOR)
res |= NFS4_SHARE_WANT_OPEN_XOR_DELEGATION;
out:
return res;
}
static enum open_claim_type4
nfs4_map_atomic_open_claim(struct nfs_server *server,
enum open_claim_type4 claim)
{
if (server->caps & NFS_CAP_ATOMIC_OPEN_V1)
return claim;
switch (claim) {
default:
return claim;
case NFS4_OPEN_CLAIM_FH:
return NFS4_OPEN_CLAIM_NULL;
case NFS4_OPEN_CLAIM_DELEG_CUR_FH:
return NFS4_OPEN_CLAIM_DELEGATE_CUR;
case NFS4_OPEN_CLAIM_DELEG_PREV_FH:
return NFS4_OPEN_CLAIM_DELEGATE_PREV;
}
}
static void nfs4_init_opendata_res(struct nfs4_opendata *p)
{
Annotation
- Immediate include surface: `linux/mm.h`, `linux/delay.h`, `linux/errno.h`, `linux/string.h`, `linux/ratelimit.h`, `linux/printk.h`, `linux/slab.h`, `linux/sunrpc/clnt.h`.
- Detected declarations: `struct nfs4_opendata`, `struct nfs4_open_createattrs`, `struct nfs4_closedata`, `struct nfs4_createdata`, `struct nfs4_cached_acl`, `struct nfs4_delegreturndata`, `struct nfs4_unlockdata`, `struct nfs4_lockdata`, `struct nfs4_lock_waiter`, `struct rpc_bind_conn_calldata`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: integration 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.