From: Shaun Tancheff Date: Fri, 10 Feb 2023 18:02:41 +0000 (-0600) Subject: LU-16508 netlink: resv_start_op for [lnet|lustre]_family X-Git-Tag: 2.15.56~101 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=14cc87902d07d85a4025049ad8b120092837c9ff;p=fs%2Flustre-release.git LU-16508 netlink: resv_start_op for [lnet|lustre]_family Linux v5.0-11693-g3b0f31f2b8c9 genetlink: make policy common to family struct genl_family adds policy and resv_start_op members Linux v6.1-rc2-63-g4fa86555d1cd genetlink: piggy back on resv_op to default to a reject policy struct genl_family needs to set a policy and/or indicate the commands that should be validated. Set the resv_start_op higher than the largest command accepted. to avoid a default policy of NLA_REJECT. When genl_family has a policy provide one. HPE-bug-id: LUS-11454 Signed-off-by: Shaun Tancheff Change-Id: If38fbe4c9358bb4f9b57e7d25b8a6df1fba63452 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49800 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin Reviewed-by: James Simmons Reviewed-by: xinliang --- diff --git a/lnet/lnet/api-ni.c b/lnet/lnet/api-ni.c index 224526d..bde1df9 100644 --- a/lnet/lnet/api-ni.c +++ b/lnet/lnet/api-ni.c @@ -5774,6 +5774,9 @@ static struct genl_family lnet_family = { .n_ops = ARRAY_SIZE(lnet_genl_ops), .mcgrps = lnet_mcast_grps, .n_mcgrps = ARRAY_SIZE(lnet_mcast_grps), +#ifdef GENL_FAMILY_HAS_RESV_START_OP + .resv_start_op = __LNET_CMD_MAX_PLUS_ONE, +#endif }; void LNetDebugPeer(struct lnet_processid *id) diff --git a/lnet/selftest/conctl.c b/lnet/selftest/conctl.c index fef72dc..4cb7dd3 100644 --- a/lnet/selftest/conctl.c +++ b/lnet/selftest/conctl.c @@ -1394,6 +1394,9 @@ static struct genl_family lst_family = { .n_ops = ARRAY_SIZE(lst_genl_ops), .mcgrps = lst_mcast_grps, .n_mcgrps = ARRAY_SIZE(lst_mcast_grps), +#ifdef GENL_FAMILY_HAS_RESV_START_OP + .resv_start_op = __LNET_SELFTEST_CMD_MAX_PLUS_ONE, +#endif }; int lstcon_init_netlink(void) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 7280e58..fa8f8b1 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -2692,6 +2692,30 @@ AC_DEFUN([LC_HAVE_SUNRPC_CACHE_HASH_LOCK_IS_A_SPINLOCK], [ ]) # LC_HAVE_SUNRPC_CACHE_HASH_LOCK_IS_A_SPINLOCK # +# LC_GENL_FAMILY_HAS_RESV_START_OP +# +# Linux v5.0-11693-g3b0f31f2b8c9 +# genetlink: make policy common to family +# +AC_DEFUN([LC_SRC_GENL_FAMILY_HAS_RESV_START_OP], [ + LB2_LINUX_TEST_SRC([genl_family_has_resv_start_op], [ + #include + ],[ + static const struct genl_family family = { + .resv_start_op = 42, + }; + (void)family; + ],[-Werror]) +]) +AC_DEFUN([LC_GENL_FAMILY_HAS_RESV_START_OP], [ + AC_MSG_CHECKING([if struct genl_family has resv_start_op member]) + LB2_LINUX_TEST_RESULT([genl_family_has_resv_start_op], [ + AC_DEFINE(GENL_FAMILY_HAS_RESV_START_OP, 1, + [struct genl_family has resv_start_op member]) + ]) +]) # LC_GENL_FAMILY_HAS_RESV_START_OP + +# # LC_HAVE_BVEC_ITER_ALL # # kernel 5.1 commit 6dc4f100c175dd0511ae8674786e7c9006cdfbfa @@ -3786,6 +3810,9 @@ AC_DEFUN([LC_PROG_LINUX_SRC], [ LC_SRC_UAPI_LINUX_MOUNT_H LC_SRC_HAVE_SUNRPC_CACHE_HASH_LOCK_IS_A_SPINLOCK + # 5.0 + LC_SRC_GENL_FAMILY_HAS_RESV_START_OP + # 5.1 LC_SRC_HAVE_BVEC_ITER_ALL @@ -4033,6 +4060,9 @@ AC_DEFUN([LC_PROG_LINUX_RESULTS], [ LC_UAPI_LINUX_MOUNT_H LC_HAVE_SUNRPC_CACHE_HASH_LOCK_IS_A_SPINLOCK + # 5.0 + LC_GENL_FAMILY_HAS_RESV_START_OP + # 5.1 LC_HAVE_BVEC_ITER_ALL diff --git a/lustre/obdclass/kernelcomm.c b/lustre/obdclass/kernelcomm.c index 8407825..61cad4a 100644 --- a/lustre/obdclass/kernelcomm.c +++ b/lustre/obdclass/kernelcomm.c @@ -314,6 +314,9 @@ static struct genl_family lustre_family = { .n_ops = ARRAY_SIZE(lustre_genl_ops), .mcgrps = lustre_mcast_grps, .n_mcgrps = ARRAY_SIZE(lustre_mcast_grps), +#ifdef GENL_FAMILY_HAS_RESV_START_OP + .resv_start_op = __LUSTRE_CMD_MAX_PLUS_ONE, +#endif }; /**