From d41a508a4958b9edb104ee0076fd29d0f2196845 Mon Sep 17 00:00:00 2001 From: Arshad Hussain Date: Wed, 19 Oct 2022 09:59:42 +0530 Subject: [PATCH] LU-16241 obdclass: NL_SET_ERR_MSG work for older kernel NL_SET_ERR_MSG macros is already defined in kernels 3.10.0-1160 and above. For older kernels (3.10.0-957) where this is not defined we put the message to the system log as a workaround Test-Parameters: trivial clientdistro=el7.9 serverdistro=el7.9 Test-Parameters: trivial clientdistro=el8.5 serverdistro=el8.5 Signed-off-by: Arshad Hussain Change-Id: I6830e1dd2ca84df09ef89aaaa9e9b802d9cdbd16 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/48916 Reviewed-by: James Simmons Reviewed-by: Jian Yu Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Tested-by: jenkins Tested-by: Maloo --- libcfs/include/libcfs/linux/linux-net.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libcfs/include/libcfs/linux/linux-net.h b/libcfs/include/libcfs/linux/linux-net.h index c599f51..b13a1e6 100644 --- a/libcfs/include/libcfs/linux/linux-net.h +++ b/libcfs/include/libcfs/linux/linux-net.h @@ -26,6 +26,18 @@ #include #include +/* NL_SET_ERR_MSG macros is already defined in kernels + * 3.10.0-1160 and above. For older kernels (3.10.0-957) + * where this is not defined we put the message to the + * system log as a workaround + */ +#ifndef NL_SET_ERR_MSG +#define NL_SET_ERR_MSG(unused, msg) do { \ + static const char __msg[] = msg; \ + pr_debug("%s\n", __msg); \ +} while (0) +#endif + #ifndef HAVE_NLA_STRDUP char *nla_strdup(const struct nlattr *nla, gfp_t flags); #endif /* !HAVE_NLA_STRDUP */ -- 1.8.3.1