Whamcloud - gitweb
LU-16241 obdclass: NL_SET_ERR_MSG work for older kernel 16/48916/6
authorArshad Hussain <arshad.hussain@aeoncomputing.com>
Wed, 19 Oct 2022 04:29:42 +0000 (09:59 +0530)
committerOleg Drokin <green@whamcloud.com>
Wed, 2 Nov 2022 07:12:08 +0000 (07:12 +0000)
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 <arshad.hussain@aeoncomputing.com>
Change-Id: I6830e1dd2ca84df09ef89aaaa9e9b802d9cdbd16
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/48916
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
libcfs/include/libcfs/linux/linux-net.h

index c599f51..b13a1e6 100644 (file)
 #include <net/netlink.h>
 #include <net/genetlink.h>
 
+/* 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 */