From 1abd574b8203676951f676e979c14605752dd0b1 Mon Sep 17 00:00:00 2001 From: Shaun Tancheff Date: Fri, 30 Apr 2021 06:43:46 -0500 Subject: [PATCH] LU-14706 libcfs: ___wait_event() update for older kernels A couple of wait issues fail to build correctly on older 3.0 kernels Fixes: f6df31a163 ("LU-10467 lustre: add wait_event macros suitable for upstream") Fixes: d05427a785 ("LU-10428 lnet: call event handlers without res_lock") HPE-bug-id: LUS-9975 Signed-off-by: Shaun Tancheff Change-Id: I275fbf79c4472575d867075a3e3ebd3d6ec1cdfa Reviewed-on: https://review.whamcloud.com/43785 Reviewed-by: Neil Brown Reviewed-by: James Simmons Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- libcfs/autoconf/lustre-libcfs.m4 | 25 +++++++++++++++++++++++++ libcfs/include/libcfs/linux/linux-wait.h | 4 ++-- lnet/include/lnet/lib-lnet.h | 2 +- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/libcfs/autoconf/lustre-libcfs.m4 b/libcfs/autoconf/lustre-libcfs.m4 index 6442571..b223340 100644 --- a/libcfs/autoconf/lustre-libcfs.m4 +++ b/libcfs/autoconf/lustre-libcfs.m4 @@ -1017,6 +1017,30 @@ wait_queue_task_list, [ ]) # LIBCFS_WAIT_QUEUE_TASK_LIST_RENAME # +# LIBCFS_WAIT_BIT_QUEUE_ENTRY_EXISTS +# +# Kernel version v4.12-rc6-23-g76c85ddc4695 +# sched/wait: Standardize wait_bit_queue naming +# +# renamed struct wait_bit_queue => wait_bit_queue_entry +# +AC_DEFUN([LIBCFS_WAIT_BIT_QUEUE_ENTRY_EXISTS], [ +LB_CHECK_COMPILE([if struct wait_bit_queue_entry exists], +struct_wait_bit_queue_entry_exists, [ + #include + #if HAVE_WAIT_BIT_HEADER_H + #include + #endif +],[ + struct wait_bit_queue_entry entry; + memset(&entry, 0, sizeof(entry)); +],[ + AC_DEFINE(HAVE_WAIT_BIT_QUEUE_ENTRY, 1, + [if struct wait_bit_queue_entry exists]) +]) +]) # LIBCFS_WAIT_BIT_QUEUE_ENTRY_EXISTS + +# # LIBCFS_NLA_STRDUP # # Kernel version 4.13-rc1 commit 2cf0c8b3e6942ecafe6ebb1a6d0328a81641bf39 @@ -1821,6 +1845,7 @@ LIBCFS_UUID_T # 4.13 LIBCFS_NLA_STRDUP LIBCFS_WAIT_QUEUE_ENTRY +LIBCFS_WAIT_BIT_QUEUE_ENTRY_EXISTS # 4.14 LIBCFS_DEFINE_TIMER LIBCFS_NEW_KERNEL_WRITE diff --git a/libcfs/include/libcfs/linux/linux-wait.h b/libcfs/include/libcfs/linux/linux-wait.h index 1043977b..aa257fc 100644 --- a/libcfs/include/libcfs/linux/linux-wait.h +++ b/libcfs/include/libcfs/linux/linux-wait.h @@ -190,12 +190,12 @@ static inline void prepare_to_wait_exclusive_head( #define ___wait_event(wq_head, condition, state, exclusive, ret, cmd) \ ({ \ __label__ __out; \ - wait_queue_entry_ __wq_entry; \ + wait_queue_entry_t __wq_entry; \ long __ret = ret; /* explicit shadow */ \ \ init_wait(&__wq_entry); \ if (exclusive) \ - __wq_entry.flags = WQ_FLAG_EXCLUSIVE \ + __wq_entry.flags = WQ_FLAG_EXCLUSIVE; \ for (;;) { \ long __int = prepare_to_wait_event(&wq_head, \ &__wq_entry, state); \ diff --git a/lnet/include/lnet/lib-lnet.h b/lnet/include/lnet/lib-lnet.h index d5334c0..f195303 100644 --- a/lnet/include/lnet/lib-lnet.h +++ b/lnet/include/lnet/lib-lnet.h @@ -264,7 +264,7 @@ lnet_ni_set_status(struct lnet_ni *ni, __u32 status) static inline void lnet_md_wait_handling(struct lnet_libmd *md, int cpt) { wait_queue_head_t *wq = __var_waitqueue(md); -#ifdef HAVE_WAIT_QUEUE_ENTRY +#if defined(HAVE_WAIT_BIT_QUEUE_ENTRY) || !defined(HAVE_WAIT_VAR_EVENT) struct wait_bit_queue_entry entry; wait_queue_entry_t *wqe = &entry.wq_entry; #else -- 1.8.3.1