Loading Documentation/netlink/specs/nfsd.yaml +27 −0 Original line number Diff line number Diff line Loading @@ -115,6 +115,15 @@ attribute-sets: type: nest nested-attributes: sock multi-attr: true - name: pool-mode attributes: - name: mode type: string - name: npools type: u32 operations: list: Loading Loading @@ -195,3 +204,21 @@ operations: reply: attributes: - addr - name: pool-mode-set doc: set the current server pool-mode attribute-set: pool-mode flags: [ admin-perm ] do: request: attributes: - mode - name: pool-mode-get doc: get info about server pool-mode attribute-set: pool-mode do: reply: attributes: - mode - npools fs/nfsd/netlink.c +17 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,11 @@ static const struct nla_policy nfsd_listener_set_nl_policy[NFSD_A_SERVER_SOCK_AD [NFSD_A_SERVER_SOCK_ADDR] = NLA_POLICY_NESTED(nfsd_sock_nl_policy), }; /* NFSD_CMD_POOL_MODE_SET - do */ static const struct nla_policy nfsd_pool_mode_set_nl_policy[NFSD_A_POOL_MODE_MODE + 1] = { [NFSD_A_POOL_MODE_MODE] = { .type = NLA_NUL_STRING, }, }; /* Ops table for nfsd */ static const struct genl_split_ops nfsd_nl_ops[] = { { Loading Loading @@ -83,6 +88,18 @@ static const struct genl_split_ops nfsd_nl_ops[] = { .doit = nfsd_nl_listener_get_doit, .flags = GENL_CMD_CAP_DO, }, { .cmd = NFSD_CMD_POOL_MODE_SET, .doit = nfsd_nl_pool_mode_set_doit, .policy = nfsd_pool_mode_set_nl_policy, .maxattr = NFSD_A_POOL_MODE_MODE, .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO, }, { .cmd = NFSD_CMD_POOL_MODE_GET, .doit = nfsd_nl_pool_mode_get_doit, .flags = GENL_CMD_CAP_DO, }, }; struct genl_family nfsd_nl_family __ro_after_init = { Loading fs/nfsd/netlink.h +2 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ int nfsd_nl_version_set_doit(struct sk_buff *skb, struct genl_info *info); int nfsd_nl_version_get_doit(struct sk_buff *skb, struct genl_info *info); int nfsd_nl_listener_set_doit(struct sk_buff *skb, struct genl_info *info); int nfsd_nl_listener_get_doit(struct sk_buff *skb, struct genl_info *info); int nfsd_nl_pool_mode_set_doit(struct sk_buff *skb, struct genl_info *info); int nfsd_nl_pool_mode_get_doit(struct sk_buff *skb, struct genl_info *info); extern struct genl_family nfsd_nl_family; Loading fs/nfsd/nfsctl.c +57 −0 Original line number Diff line number Diff line Loading @@ -2156,6 +2156,63 @@ int nfsd_nl_listener_get_doit(struct sk_buff *skb, struct genl_info *info) return err; } /** * nfsd_nl_pool_mode_set_doit - set the number of running threads * @skb: reply buffer * @info: netlink metadata and command arguments * * Return 0 on success or a negative errno. */ int nfsd_nl_pool_mode_set_doit(struct sk_buff *skb, struct genl_info *info) { const struct nlattr *attr; if (GENL_REQ_ATTR_CHECK(info, NFSD_A_POOL_MODE_MODE)) return -EINVAL; attr = info->attrs[NFSD_A_POOL_MODE_MODE]; return sunrpc_set_pool_mode(nla_data(attr)); } /** * nfsd_nl_pool_mode_get_doit - get info about pool_mode * @skb: reply buffer * @info: netlink metadata and command arguments * * Return 0 on success or a negative errno. */ int nfsd_nl_pool_mode_get_doit(struct sk_buff *skb, struct genl_info *info) { struct net *net = genl_info_net(info); char buf[16]; void *hdr; int err; if (sunrpc_get_pool_mode(buf, ARRAY_SIZE(buf)) >= ARRAY_SIZE(buf)) return -ERANGE; skb = genlmsg_new(GENLMSG_DEFAULT_SIZE, GFP_KERNEL); if (!skb) return -ENOMEM; err = -EMSGSIZE; hdr = genlmsg_iput(skb, info); if (!hdr) goto err_free_msg; err = nla_put_string(skb, NFSD_A_POOL_MODE_MODE, buf) | nla_put_u32(skb, NFSD_A_POOL_MODE_NPOOLS, nfsd_nrpools(net)); if (err) goto err_free_msg; genlmsg_end(skb, hdr); return genlmsg_reply(skb, info); err_free_msg: nlmsg_free(skb); return err; } /** * nfsd_net_init - Prepare the nfsd_net portion of a new net namespace * @net: a freshly-created network namespace Loading include/uapi/linux/nfsd_netlink.h +10 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,14 @@ enum { NFSD_A_SERVER_SOCK_MAX = (__NFSD_A_SERVER_SOCK_MAX - 1) }; enum { NFSD_A_POOL_MODE_MODE = 1, NFSD_A_POOL_MODE_NPOOLS, __NFSD_A_POOL_MODE_MAX, NFSD_A_POOL_MODE_MAX = (__NFSD_A_POOL_MODE_MAX - 1) }; enum { NFSD_CMD_RPC_STATUS_GET = 1, NFSD_CMD_THREADS_SET, Loading @@ -78,6 +86,8 @@ enum { NFSD_CMD_VERSION_GET, NFSD_CMD_LISTENER_SET, NFSD_CMD_LISTENER_GET, NFSD_CMD_POOL_MODE_SET, NFSD_CMD_POOL_MODE_GET, __NFSD_CMD_MAX, NFSD_CMD_MAX = (__NFSD_CMD_MAX - 1) Loading Loading
Documentation/netlink/specs/nfsd.yaml +27 −0 Original line number Diff line number Diff line Loading @@ -115,6 +115,15 @@ attribute-sets: type: nest nested-attributes: sock multi-attr: true - name: pool-mode attributes: - name: mode type: string - name: npools type: u32 operations: list: Loading Loading @@ -195,3 +204,21 @@ operations: reply: attributes: - addr - name: pool-mode-set doc: set the current server pool-mode attribute-set: pool-mode flags: [ admin-perm ] do: request: attributes: - mode - name: pool-mode-get doc: get info about server pool-mode attribute-set: pool-mode do: reply: attributes: - mode - npools
fs/nfsd/netlink.c +17 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,11 @@ static const struct nla_policy nfsd_listener_set_nl_policy[NFSD_A_SERVER_SOCK_AD [NFSD_A_SERVER_SOCK_ADDR] = NLA_POLICY_NESTED(nfsd_sock_nl_policy), }; /* NFSD_CMD_POOL_MODE_SET - do */ static const struct nla_policy nfsd_pool_mode_set_nl_policy[NFSD_A_POOL_MODE_MODE + 1] = { [NFSD_A_POOL_MODE_MODE] = { .type = NLA_NUL_STRING, }, }; /* Ops table for nfsd */ static const struct genl_split_ops nfsd_nl_ops[] = { { Loading Loading @@ -83,6 +88,18 @@ static const struct genl_split_ops nfsd_nl_ops[] = { .doit = nfsd_nl_listener_get_doit, .flags = GENL_CMD_CAP_DO, }, { .cmd = NFSD_CMD_POOL_MODE_SET, .doit = nfsd_nl_pool_mode_set_doit, .policy = nfsd_pool_mode_set_nl_policy, .maxattr = NFSD_A_POOL_MODE_MODE, .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO, }, { .cmd = NFSD_CMD_POOL_MODE_GET, .doit = nfsd_nl_pool_mode_get_doit, .flags = GENL_CMD_CAP_DO, }, }; struct genl_family nfsd_nl_family __ro_after_init = { Loading
fs/nfsd/netlink.h +2 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ int nfsd_nl_version_set_doit(struct sk_buff *skb, struct genl_info *info); int nfsd_nl_version_get_doit(struct sk_buff *skb, struct genl_info *info); int nfsd_nl_listener_set_doit(struct sk_buff *skb, struct genl_info *info); int nfsd_nl_listener_get_doit(struct sk_buff *skb, struct genl_info *info); int nfsd_nl_pool_mode_set_doit(struct sk_buff *skb, struct genl_info *info); int nfsd_nl_pool_mode_get_doit(struct sk_buff *skb, struct genl_info *info); extern struct genl_family nfsd_nl_family; Loading
fs/nfsd/nfsctl.c +57 −0 Original line number Diff line number Diff line Loading @@ -2156,6 +2156,63 @@ int nfsd_nl_listener_get_doit(struct sk_buff *skb, struct genl_info *info) return err; } /** * nfsd_nl_pool_mode_set_doit - set the number of running threads * @skb: reply buffer * @info: netlink metadata and command arguments * * Return 0 on success or a negative errno. */ int nfsd_nl_pool_mode_set_doit(struct sk_buff *skb, struct genl_info *info) { const struct nlattr *attr; if (GENL_REQ_ATTR_CHECK(info, NFSD_A_POOL_MODE_MODE)) return -EINVAL; attr = info->attrs[NFSD_A_POOL_MODE_MODE]; return sunrpc_set_pool_mode(nla_data(attr)); } /** * nfsd_nl_pool_mode_get_doit - get info about pool_mode * @skb: reply buffer * @info: netlink metadata and command arguments * * Return 0 on success or a negative errno. */ int nfsd_nl_pool_mode_get_doit(struct sk_buff *skb, struct genl_info *info) { struct net *net = genl_info_net(info); char buf[16]; void *hdr; int err; if (sunrpc_get_pool_mode(buf, ARRAY_SIZE(buf)) >= ARRAY_SIZE(buf)) return -ERANGE; skb = genlmsg_new(GENLMSG_DEFAULT_SIZE, GFP_KERNEL); if (!skb) return -ENOMEM; err = -EMSGSIZE; hdr = genlmsg_iput(skb, info); if (!hdr) goto err_free_msg; err = nla_put_string(skb, NFSD_A_POOL_MODE_MODE, buf) | nla_put_u32(skb, NFSD_A_POOL_MODE_NPOOLS, nfsd_nrpools(net)); if (err) goto err_free_msg; genlmsg_end(skb, hdr); return genlmsg_reply(skb, info); err_free_msg: nlmsg_free(skb); return err; } /** * nfsd_net_init - Prepare the nfsd_net portion of a new net namespace * @net: a freshly-created network namespace Loading
include/uapi/linux/nfsd_netlink.h +10 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,14 @@ enum { NFSD_A_SERVER_SOCK_MAX = (__NFSD_A_SERVER_SOCK_MAX - 1) }; enum { NFSD_A_POOL_MODE_MODE = 1, NFSD_A_POOL_MODE_NPOOLS, __NFSD_A_POOL_MODE_MAX, NFSD_A_POOL_MODE_MAX = (__NFSD_A_POOL_MODE_MAX - 1) }; enum { NFSD_CMD_RPC_STATUS_GET = 1, NFSD_CMD_THREADS_SET, Loading @@ -78,6 +86,8 @@ enum { NFSD_CMD_VERSION_GET, NFSD_CMD_LISTENER_SET, NFSD_CMD_LISTENER_GET, NFSD_CMD_POOL_MODE_SET, NFSD_CMD_POOL_MODE_GET, __NFSD_CMD_MAX, NFSD_CMD_MAX = (__NFSD_CMD_MAX - 1) Loading