fs/nfs/nfs42proc.c
Source file repositories/reference/linux-study-clean/fs/nfs/nfs42proc.c
File Facts
- System
- Linux kernel
- Corpus path
fs/nfs/nfs42proc.c- Extension
.c- Size
- 44321 bytes
- Lines
- 1683
- 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/fs.hlinux/sunrpc/addr.hlinux/sunrpc/sched.hlinux/nfs.hlinux/nfs3.hlinux/nfs4.hlinux/nfs_xdr.hlinux/nfs_fs.hnfs4_fs.hnfs42.hiostat.hpnfs.hnfs4session.hinternal.hdelegation.hnfs4trace.h
Detected Declarations
struct nfs42_offload_datafunction nfs42_set_netaddrfunction _nfs42_proc_fallocatefunction nfs42_proc_fallocatefunction nfs42_proc_allocatefunction nfs42_proc_deallocatefunction nfs42_proc_zero_rangefunction nfs4_copy_dequeue_callbackfunction handle_async_copyfunction process_copy_commitfunction nfs42_copy_dest_donefunction _nfs42_proc_copyfunction nfs42_proc_copyfunction nfs42_offload_preparefunction nfs42_offload_cancel_donefunction nfs42_offload_releasefunction nfs42_do_offload_cancel_asyncfunction _nfs42_proc_offload_statusfunction nfs42_proc_offload_statusfunction _nfs42_proc_copy_notifyfunction nfs42_proc_copy_notifyfunction _nfs42_proc_llseekfunction nfs42_proc_llseekfunction nfs42_layoutstat_preparefunction nfs42_layoutstat_donefunction nfs42_layoutstat_releasefunction nfs42_proc_layoutstats_genericfunction nfs42_alloc_layouterror_datafunction nfs42_free_layouterror_datafunction nfs42_layouterror_preparefunction nfs42_layouterror_donefunction nfs42_layouterror_releasefunction nfs42_proc_layouterrorfunction _nfs42_proc_clonefunction nfs42_proc_clonefunction _nfs42_proc_removexattrfunction _nfs42_proc_setxattrfunction _nfs42_proc_getxattrfunction _nfs42_proc_listxattrsfunction nfs42_proc_getxattrfunction nfs42_proc_setxattrfunction nfs42_proc_listxattrsfunction nfs42_proc_removexattrexport nfs42_proc_layouterror
Annotated Snippet
struct nfs42_offload_data {
struct nfs_server *seq_server;
struct nfs42_offload_status_args args;
struct nfs42_offload_status_res res;
};
static void nfs42_offload_prepare(struct rpc_task *task, void *calldata)
{
struct nfs42_offload_data *data = calldata;
nfs4_setup_sequence(data->seq_server->nfs_client,
&data->args.osa_seq_args,
&data->res.osr_seq_res, task);
}
static void nfs42_offload_cancel_done(struct rpc_task *task, void *calldata)
{
struct nfs42_offload_data *data = calldata;
trace_nfs4_offload_cancel(&data->args, task->tk_status);
nfs41_sequence_done(task, &data->res.osr_seq_res);
if (task->tk_status &&
nfs4_async_handle_error(task, data->seq_server, NULL,
NULL) == -EAGAIN)
rpc_restart_call_prepare(task);
}
static void nfs42_offload_release(void *data)
{
kfree(data);
}
static const struct rpc_call_ops nfs42_offload_cancel_ops = {
.rpc_call_prepare = nfs42_offload_prepare,
.rpc_call_done = nfs42_offload_cancel_done,
.rpc_release = nfs42_offload_release,
};
static int nfs42_do_offload_cancel_async(struct file *dst,
nfs4_stateid *stateid)
{
struct nfs_server *dst_server = NFS_SERVER(file_inode(dst));
struct nfs42_offload_data *data = NULL;
struct nfs_open_context *ctx = nfs_file_open_context(dst);
struct rpc_task *task;
struct rpc_message msg = {
.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OFFLOAD_CANCEL],
.rpc_cred = ctx->cred,
};
struct rpc_task_setup task_setup_data = {
.rpc_client = dst_server->client,
.rpc_message = &msg,
.callback_ops = &nfs42_offload_cancel_ops,
.workqueue = nfsiod_workqueue,
.flags = RPC_TASK_ASYNC | RPC_TASK_MOVEABLE,
};
int status;
if (!(dst_server->caps & NFS_CAP_OFFLOAD_CANCEL))
return -EOPNOTSUPP;
data = kzalloc_obj(struct nfs42_offload_data);
if (data == NULL)
return -ENOMEM;
data->seq_server = dst_server;
data->args.osa_src_fh = NFS_FH(file_inode(dst));
memcpy(&data->args.osa_stateid, stateid,
sizeof(data->args.osa_stateid));
msg.rpc_argp = &data->args;
msg.rpc_resp = &data->res;
task_setup_data.callback_data = data;
nfs4_init_sequence(dst_server->nfs_client, &data->args.osa_seq_args,
&data->res.osr_seq_res, 1, 0);
task = rpc_run_task(&task_setup_data);
if (IS_ERR(task))
return PTR_ERR(task);
status = rpc_wait_for_completion_task(task);
if (status == -ENOTSUPP)
dst_server->caps &= ~NFS_CAP_OFFLOAD_CANCEL;
rpc_put_task(task);
return status;
}
static int
_nfs42_proc_offload_status(struct nfs_server *server, struct file *file,
struct nfs42_offload_data *data)
{
struct nfs_open_context *ctx = nfs_file_open_context(file);
struct rpc_message msg = {
Annotation
- Immediate include surface: `linux/fs.h`, `linux/sunrpc/addr.h`, `linux/sunrpc/sched.h`, `linux/nfs.h`, `linux/nfs3.h`, `linux/nfs4.h`, `linux/nfs_xdr.h`, `linux/nfs_fs.h`.
- Detected declarations: `struct nfs42_offload_data`, `function nfs42_set_netaddr`, `function _nfs42_proc_fallocate`, `function nfs42_proc_fallocate`, `function nfs42_proc_allocate`, `function nfs42_proc_deallocate`, `function nfs42_proc_zero_range`, `function nfs4_copy_dequeue_callback`, `function handle_async_copy`, `function process_copy_commit`.
- 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.