Whamcloud - gitweb
LU-15220 libcfs: fix panic_notifier_list undeclared error 12/45812/6
authorJian Yu <yujian@whamcloud.com>
Fri, 7 Jan 2022 11:12:29 +0000 (03:12 -0800)
committerOleg Drokin <green@whamcloud.com>
Thu, 20 Jan 2022 06:40:11 +0000 (06:40 +0000)
In kernel 5.14 commit f39650de687e35766572ac89dbcd16a5911e2f0a,
panic and oops helpers are split out from include/linux/kernel.h.

This patch accommodates the above changes and fixes the
"'panic_notifier_list' undeclared" error.

Change-Id: I6888f9f4878906c572bb40d950a70ff642d3474e
Signed-off-by: Jian Yu <yujian@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/45812
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
libcfs/autoconf/lustre-libcfs.m4
libcfs/libcfs/debug.c

index 08dcb53..c711c85 100644 (file)
@@ -1785,6 +1785,38 @@ AC_DEFUN([LIBCFS_PROG_LINUX_RESULTS], [
 ])
 
 #
+# LIBCFS_HAVE_CIPHER_HEADER
+#
+# Kernel 5.12 commit 0eb76ba29d16df2951d37c54ca279c4e5630b071
+# crypto: remove cipher routines from public crypto API
+#
+AC_DEFUN([LIBCFS_HAVE_CIPHER_HEADER], [
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_CHECK_LINUX_HEADER([crypto/internal/cipher.h], [
+       AC_DEFINE(HAVE_CIPHER_H, 1,
+               [crypto/internal/cipher.h is present])
+])
+EXTRA_KCFLAGS="$tmp_flags"
+]) # LIBCFS_HAVE_CIPHER_HEADER
+
+#
+# LIBCFS_HAVE_PANIC_NOTIFIER_HEADER
+#
+# Kernel 5.14 commit f39650de687e35766572ac89dbcd16a5911e2f0a
+# kernel.h: split out panic and oops helpers
+#
+AC_DEFUN([LIBCFS_HAVE_PANIC_NOTIFIER_HEADER], [
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_CHECK_LINUX_HEADER([linux/panic_notifier.h], [
+       AC_DEFINE(HAVE_PANIC_NOTIFIER_H, 1,
+               [linux/panic_notifier.h is present])
+])
+EXTRA_KCFLAGS="$tmp_flags"
+]) # LIBCFS_HAVE_PANIC_NOTIFIER_HEADER
+
+#
 # LIBCFS_PARAM_SET_UINT_MINMAX
 #
 # Kernel 5.15-rc1 commit 2a14c9ae15a38148484a128b84bff7e9ffd90d68
@@ -1803,22 +1835,6 @@ param_set_uint_minmax, [
 ]) # LIBCFS_PARAM_SET_UINT_MINMAX
 
 #
-# LIBCFS_HAVE_CIPHER_HEADER
-#
-# Kernel 5.12 commit 0eb76ba29d16df2951d37c54ca279c4e5630b071
-# crypto: remove cipher routines from public crypto API
-#
-AC_DEFUN([LIBCFS_HAVE_CIPHER_HEADER], [
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_CHECK_LINUX_HEADER([crypto/internal/cipher.h], [
-       AC_DEFINE(HAVE_CIPHER_H, 1,
-               [crypto/internal/cipher.h is present])
-])
-EXTRA_KCFLAGS="$tmp_flags"
-]) # LIBCFS_HAVE_CIPHER_HEADER
-
-#
 # LIBCFS_PROG_LINUX
 #
 # LibCFS linux kernel checks
@@ -1954,6 +1970,8 @@ LIBCFS_HAVE_CRYPTO_SHA2_HEADER
 LIBCFS_HAVE_LIST_CMP_FUNC_T
 # 5.12
 LIBCFS_HAVE_CIPHER_HEADER
+# 5.14
+LIBCFS_HAVE_PANIC_NOTIFIER_HEADER
 # 5.15
 LIBCFS_PARAM_SET_UINT_MINMAX
 ]) # LIBCFS_PROG_LINUX
index 8873cfb..e29d07c 100644 (file)
@@ -43,6 +43,9 @@
 #include <linux/stacktrace.h>
 #include <linux/utsname.h>
 #include <linux/kallsyms.h>
+#ifdef HAVE_PANIC_NOTIFIER_H
+#include <linux/panic_notifier.h>
+#endif
 #include "tracefile.h"
 
 static char debug_file_name[1024];