Re: [PATCH v5 3/3] NFSD: convert write_ports to netlink command

Simon Horman
2023-12-05T20:37:37Z

On Wed, Nov 29, 2023 at 06:12:45PM +0100, Lorenzo Bianconi wrote:
> Introduce write_ports netlink command similar to the ones available
> through the procfs.
>
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>

Hi Lorenzo,

some minor feedback from my side.

...

> @@ -1862,6 +1871,87 @@ int nfsd_nl_version_get_dumpit(struct sk_buff *skb,
> return ret;
> }
>
> +/**
> + * nfsd_nl_listener_start_doit - start the provided nfs server listener
> + * @skb: reply buffer
> + * @info: netlink metadata and command arguments
> + *
> + * Return 0 on success or a negative errno.
> + */
> +int nfsd_nl_listener_start_doit(struct sk_buff *skb, struct genl_info *info)
> +{
> + int ret;
> +
> + if (GENL_REQ_ATTR_CHECK(info, NFSD_A_SERVER_LISTENER_TRANSPORT_NAME) ||
> + GENL_REQ_ATTR_CHECK(info, NFSD_A_SERVER_LISTENER_PORT))
> + return -EINVAL;
> +
> + mutex_lock(&nfsd_mutex);
> + ret = ___write_ports_addxprt(genl_info_net(info), get_current_cred(),
> + nla_data(info->attrs[NFSD_A_SERVER_LISTENER_TRANSPORT_NAME]),
> + nla_get_u32(info->attrs[NFSD_A_SERVER_LISTENER_PORT]));

gcc-13 and clang-17 W=1 builds warn that ret is set but otherwise unused in
this function.

> + mutex_unlock(&nfsd_mutex);
> +
> + return 0;
> +}
> +
> +/**
> + * nfsd_nl_version_get_dumpit - Handle listener_get dumpit

nit: nfsd_nl_listener_get_dumpit

> + * @skb: reply buffer
> + * @cb: netlink metadata and command arguments
> + *
> + * Returns the size of the reply or a negative errno.
> + */
> +int nfsd_nl_listener_get_dumpit(struct sk_buff *skb,
> + struct netlink_callback *cb)

...