fs/lockd/svc.c
Source file repositories/reference/linux-study-clean/fs/lockd/svc.c
File Facts
- System
- Linux kernel
- Corpus path
fs/lockd/svc.c- Extension
.c- Size
- 19216 bytes
- Lines
- 792
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/init.hlinux/sysctl.hlinux/moduleparam.hlinux/sched/signal.hlinux/errno.hlinux/in.hlinux/uio.hlinux/smp.hlinux/mutex.hlinux/freezer.hlinux/inetdevice.hlinux/sunrpc/types.hlinux/sunrpc/stats.hlinux/sunrpc/clnt.hlinux/sunrpc/svc.hlinux/sunrpc/svcsock.hlinux/sunrpc/svc_xprt.hnet/ip.hnet/addrconf.hnet/ipv6.hlinux/nfs.hlockd.hnetns.hprocfs.hnetlink.h
Detected Declarations
function nlmsvc_request_retryfunction get_lockd_grace_periodfunction grace_enderfunction set_grace_periodfunction lockdfunction create_lockd_listenerfunction create_lockd_familyfunction make_socksfunction lockd_up_netfunction lockd_down_netfunction lockd_inetaddr_eventfunction lockd_inet6addr_eventfunction lockd_getfunction lockd_putfunction lockd_upfunction lockd_downfunction is_callbackfunction lockd_authenticatefunction lockd_init_netfunction lockd_exit_netfunction init_nlmfunction exit_nlmfunction nlmsvc_dispatchfunction lockd_nl_server_set_doitfunction lockd_nl_server_get_doitmodule init init_nlmexport nlmsvc_opsexport lockd_upexport lockd_down
Annotated Snippet
module_init(init_nlm);
module_exit(exit_nlm);
/**
* nlmsvc_dispatch - Process an NLM Request
* @rqstp: incoming request
*
* Return values:
* %0: Processing complete; do not send a Reply
* %1: Processing complete; send Reply in rqstp->rq_res
*/
int nlmsvc_dispatch(struct svc_rqst *rqstp)
{
const struct svc_procedure *procp = rqstp->rq_procinfo;
__be32 *statp = rqstp->rq_accept_statp;
if (!procp->pc_decode(rqstp, &rqstp->rq_arg_stream))
goto out_decode_err;
*statp = procp->pc_func(rqstp);
if (*statp == rpc_drop_reply)
return 0;
if (*statp != rpc_success)
return 1;
if (!procp->pc_encode(rqstp, &rqstp->rq_res_stream))
goto out_encode_err;
return 1;
out_decode_err:
*statp = rpc_garbage_args;
return 1;
out_encode_err:
*statp = rpc_system_err;
return 1;
}
/*
* Define NLM program and procedures
*/
static const struct svc_version *nlmsvc_version[] = {
[1] = &nlmsvc_version1,
[3] = &nlmsvc_version3,
#ifdef CONFIG_LOCKD_V4
[4] = &nlmsvc_version4,
#endif
};
#define NLM_NRVERS ARRAY_SIZE(nlmsvc_version)
static struct svc_program nlmsvc_program = {
.pg_prog = NLM_PROGRAM, /* program number */
.pg_nvers = NLM_NRVERS, /* number of entries in nlmsvc_version */
.pg_vers = nlmsvc_version, /* version table */
.pg_name = "lockd", /* service name */
.pg_class = "nfsd", /* share authentication with nfsd */
.pg_authenticate = &lockd_authenticate, /* export authentication */
.pg_init_request = svc_generic_init_request,
.pg_rpcbind_set = svc_generic_rpcbind_set,
};
/**
* lockd_nl_server_set_doit - set the lockd server parameters via netlink
* @skb: reply buffer
* @info: netlink metadata and command arguments
*
* This updates the per-net values. When updating the values in the init_net
* namespace, also update the "legacy" global values.
*
* Return 0 on success or a negative errno.
*/
int lockd_nl_server_set_doit(struct sk_buff *skb, struct genl_info *info)
{
struct net *net = genl_info_net(info);
struct lockd_net *ln = net_generic(net, lockd_net_id);
const struct nlattr *attr;
if (GENL_REQ_ATTR_CHECK(info, LOCKD_A_SERVER_GRACETIME))
return -EINVAL;
if (info->attrs[LOCKD_A_SERVER_GRACETIME] ||
info->attrs[LOCKD_A_SERVER_TCP_PORT] ||
info->attrs[LOCKD_A_SERVER_UDP_PORT]) {
attr = info->attrs[LOCKD_A_SERVER_GRACETIME];
if (attr) {
u32 gracetime = nla_get_u32(attr);
if (gracetime > nlm_grace_period_max)
return -EINVAL;
Annotation
- Immediate include surface: `linux/module.h`, `linux/init.h`, `linux/sysctl.h`, `linux/moduleparam.h`, `linux/sched/signal.h`, `linux/errno.h`, `linux/in.h`, `linux/uio.h`.
- Detected declarations: `function nlmsvc_request_retry`, `function get_lockd_grace_period`, `function grace_ender`, `function set_grace_period`, `function lockd`, `function create_lockd_listener`, `function create_lockd_family`, `function make_socks`, `function lockd_up_net`, `function lockd_down_net`.
- 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.