File 0024-LU-15220-libcfs-fix-panic_notifier_list-undeclared-e.patch of Package lustre_2_12

From 0c61e4f8e0361b7db2e8ba4826385fe48227f0f3 Mon Sep 17 00:00:00 2001
From: Jian Yu <yujian@whamcloud.com>
Date: Fri, 7 Jan 2022 03:12:29 -0800
Subject: [PATCH 24/35] LU-15220 libcfs: fix panic_notifier_list undeclared
 error

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  | 18 ++++++++++++++++++
 libcfs/libcfs/linux/linux-debug.c |  3 +++
 2 files changed, 21 insertions(+)

diff --git a/libcfs/autoconf/lustre-libcfs.m4 b/libcfs/autoconf/lustre-libcfs.m4
index 7d380635278f..90931c6b7f0a 100644
--- a/libcfs/autoconf/lustre-libcfs.m4
+++ b/libcfs/autoconf/lustre-libcfs.m4
@@ -1356,6 +1356,22 @@ kernel_setsockopt_exists, [
 EXTRA_KCFLAGS="$tmp_flags"
 ]) # LIBCFS_KERNEL_SETSOCKOPT
 
+#
+# 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
 #
@@ -1494,6 +1510,8 @@ LIBCFS_HAVE_PROC_OPS
 LIBCFS_HAVE_MMAP_LOCK
 LIBCFS_KERNEL_SETSOCKOPT
 LIBCFS_VMALLOC_2ARGS
+# 5.14
+LIBCFS_HAVE_PANIC_NOTIFIER_HEADER
 # 5.15
 LIBCFS_PARAM_SET_UINT_MINMAX
 ]) # LIBCFS_PROG_LINUX
diff --git a/libcfs/libcfs/linux/linux-debug.c b/libcfs/libcfs/linux/linux-debug.c
index e40106691fcd..19fc7e2c92d5 100644
--- a/libcfs/libcfs/linux/linux-debug.c
+++ b/libcfs/libcfs/linux/linux-debug.c
@@ -51,6 +51,9 @@
 # define DEBUG_SUBSYSTEM S_LNET
 
 #include <libcfs/libcfs.h>
+#ifdef HAVE_PANIC_NOTIFIER_H
+#include <linux/panic_notifier.h>
+#endif
 
 #include "tracefile.h"
 
-- 
2.41.0

openSUSE Build Service is sponsored by