fs/nfs/nfs40proc.c
Source file repositories/reference/linux-study-clean/fs/nfs/nfs40proc.c
File Facts
- System
- Linux kernel
- Corpus path
fs/nfs/nfs40proc.c- Extension
.c- Size
- 11183 bytes
- Lines
- 396
- 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/nfs4.hlinux/nfs.hlinux/sunrpc/sched.hlinux/nfs_fs.hinternal.hnfs4_fs.hnfs40.hnfs4session.hnfs4trace.h
Detected Declarations
struct nfs4_renewdatastruct nfs_release_lockowner_datafunction nfs40_call_sync_preparefunction nfs40_call_sync_donefunction nfs40_sequence_free_slotfunction nfs40_sequence_donefunction nfs40_clear_delegation_stateidfunction nfs40_open_expiredfunction nfs4_renew_releasefunction nfs4_renew_donefunction nfs4_proc_async_renewfunction nfs4_proc_renewfunction nfs40_test_and_free_expired_stateidfunction _nfs40_proc_get_locationsfunction _nfs40_proc_fsid_presentfunction nfs4_release_lockowner_preparefunction nfs4_release_lockowner_donefunction nfs4_release_lockowner_releasefunction nfs4_release_lockowner
Annotated Snippet
struct nfs4_renewdata {
struct nfs_client *client;
unsigned long timestamp;
};
/*
* nfs4_proc_async_renew(): This is not one of the nfs_rpc_ops; it is a special
* standalone procedure for queueing an asynchronous RENEW.
*/
static void nfs4_renew_release(void *calldata)
{
struct nfs4_renewdata *data = calldata;
struct nfs_client *clp = data->client;
if (refcount_read(&clp->cl_count) > 1)
nfs4_schedule_state_renewal(clp);
nfs_put_client(clp);
kfree(data);
}
static void nfs4_renew_done(struct rpc_task *task, void *calldata)
{
struct nfs4_renewdata *data = calldata;
struct nfs_client *clp = data->client;
unsigned long timestamp = data->timestamp;
trace_nfs4_renew_async(clp, task->tk_status);
switch (task->tk_status) {
case 0:
break;
case -NFS4ERR_LEASE_MOVED:
nfs4_schedule_lease_moved_recovery(clp);
break;
default:
/* Unless we're shutting down, schedule state recovery! */
if (test_bit(NFS_CS_RENEWD, &clp->cl_res_state) == 0)
return;
if (task->tk_status != NFS4ERR_CB_PATH_DOWN) {
nfs4_schedule_lease_recovery(clp);
return;
}
nfs4_schedule_path_down_recovery(clp);
}
do_renew_lease(clp, timestamp);
}
static const struct rpc_call_ops nfs4_renew_ops = {
.rpc_call_done = nfs4_renew_done,
.rpc_release = nfs4_renew_release,
};
static int nfs4_proc_async_renew(struct nfs_client *clp, const struct cred *cred, unsigned renew_flags)
{
struct rpc_message msg = {
.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_RENEW],
.rpc_argp = clp,
.rpc_cred = cred,
};
struct nfs4_renewdata *data;
if (renew_flags == 0)
return 0;
if (!refcount_inc_not_zero(&clp->cl_count))
return -EIO;
data = kmalloc_obj(*data, GFP_NOFS);
if (data == NULL) {
nfs_put_client(clp);
return -ENOMEM;
}
data->client = clp;
data->timestamp = jiffies;
return rpc_call_async(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT,
&nfs4_renew_ops, data);
}
static int nfs4_proc_renew(struct nfs_client *clp, const struct cred *cred)
{
struct rpc_message msg = {
.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_RENEW],
.rpc_argp = clp,
.rpc_cred = cred,
};
unsigned long now = jiffies;
int status;
status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT);
if (status < 0)
return status;
do_renew_lease(clp, now);
return 0;
Annotation
- Immediate include surface: `linux/nfs4.h`, `linux/nfs.h`, `linux/sunrpc/sched.h`, `linux/nfs_fs.h`, `internal.h`, `nfs4_fs.h`, `nfs40.h`, `nfs4session.h`.
- Detected declarations: `struct nfs4_renewdata`, `struct nfs_release_lockowner_data`, `function nfs40_call_sync_prepare`, `function nfs40_call_sync_done`, `function nfs40_sequence_free_slot`, `function nfs40_sequence_done`, `function nfs40_clear_delegation_stateid`, `function nfs40_open_expired`, `function nfs4_renew_release`, `function nfs4_renew_done`.
- 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.