From 0c6b2bfcf4c09a34503a1496bfc0b9234117061d Mon Sep 17 00:00:00 2001 From: Shaun Tancheff Date: Wed, 30 Oct 2024 10:25:58 -0700 Subject: [PATCH] LU-18387 kernel: new kernel [RHEL 9.5 5.14.0-503.2.1.el9_5] This patch makes changes to support new RHEL 9.5 release for Lustre client. Lustre-change: https://review.whamcloud.com/56748 Lustre-commit: TBD (from a347e8bece92e00af02d5499b092700954c4fb8e) LU-17243 build: compatibility updates for kernel 6.6 linux kernel v5.19-rc1-4-gc4f135d64382 workqueue: Wrap flush_workqueue() using a macro linux kernel v6.5-rc1-7-g20bdedafd2f6 workqueue: Warn attempt to flush system-wide workqueues. If __flush_workqueue(system_wq) is not available fall back to flush_scheduled_work() Lustre-change: https://review.whamcloud.com/52908 Lustre-commit: a0e6d6f7327598d13661bb14098a9f21f2035285 LU-17592 build: compatibility updates for kernel 6.8 Linux commit v6.7-rc1-3-gda549bdd15c2 dentry: switch the lists of children to hlist Provide trival wrappers to abstract the changed members Lustre-change: https://review.whamcloud.com/54229 Lustre-commit: 6d27c2c8c72e853a238fd3fc7f42d658188ca02f Test-Parameters: trivial \ mdtcount=4 mdscount=2 clientdistro=el9.5 testlist=sanity Test-Parameters: optional clientdistro=el9.5 testgroup=full-part-1 Test-Parameters: optional clientdistro=el9.5 testgroup=full-part-2 Test-Parameters: optional clientdistro=el9.5 testgroup=full-part-3 Change-Id: I1bce12b2b7190bcbd880916049667630aba700c8 Signed-off-by: Shaun Tancheff Signed-off-by: Jian Yu Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56754 Tested-by: jenkins Reviewed-by: Yang Sheng Reviewed-by: Oleg Drokin --- contrib/lbuild/funcs.sh | 1 + libcfs/libcfs/linux/linux-prim.c | 2 +- lustre/ChangeLog | 1 + lustre/autoconf/lustre-core.m4 | 57 ++++++++++++++++++++++ lustre/include/lustre_compat.h | 15 ++++++ .../kernel_patches/targets/5.14-rhel9.5.target.in | 26 ++++++++++ lustre/llite/dcache.c | 2 +- lustre/llite/namei.c | 2 +- 8 files changed, 103 insertions(+), 3 deletions(-) create mode 100644 lustre/kernel_patches/targets/5.14-rhel9.5.target.in diff --git a/contrib/lbuild/funcs.sh b/contrib/lbuild/funcs.sh index a13d7c1..0dfbce8 100644 --- a/contrib/lbuild/funcs.sh +++ b/contrib/lbuild/funcs.sh @@ -197,6 +197,7 @@ autodetect_target() { rhel-9.2) target="5.14-rhel9.2";; rhel-9.3) target="5.14-rhel9.3";; rhel-9.4) target="5.14-rhel9.4";; + rhel-9.5) target="5.14-rhel9.5";; sles11.4) target="$(uname -r | cut -d . -f 1,2)-sles11sp4";; sles11.3) target="$(uname -r | cut -d . -f 1,2)-sles11sp3";; sles11*) target="$(uname -r | cut -d . -f 1,2)-sles11";; diff --git a/libcfs/libcfs/linux/linux-prim.c b/libcfs/libcfs/linux/linux-prim.c index f318aee..bb6e566 100644 --- a/libcfs/libcfs/linux/linux-prim.c +++ b/libcfs/libcfs/linux/linux-prim.c @@ -226,7 +226,7 @@ void __init cfs_arch_init(void) void __exit cfs_arch_exit(void) { /* exit_libcfs_vfree_atomic */ - flush_scheduled_work(); + __flush_workqueue(system_wq); } int cfs_kernel_write(struct file *filp, const void *buf, size_t count, diff --git a/lustre/ChangeLog b/lustre/ChangeLog index 3e871ca..718d347 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -30,6 +30,7 @@ vanilla linux 5.4.136 (ZFS + ldiskfs) * ldiskfs needs an ldiskfs patch series for that kernel, ZFS does not * Client primary kernels built and tested during release cycle: + 5.14.0-503.2.1.el9_5 (RHEL9.5) 5.14.0-427.20.1.el9 (RHEL9.4) 5.14.0-362.24.1.el9 (RHEL9.3) 4.18.0-553.5.1.el8 (RHEL8.10) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 4594cf9..308e61b 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -3595,6 +3595,50 @@ AC_DEFUN([LC_HAVE_FILEMAP_GET_FOLIOS_CONTIG], [ ]) # LC_HAVE_FILEMAP_GET_FOLIOS_CONTIG # +# LC_HAVE_FLUSH___WORKQUEUE +# +# linux kernel v6.5-rc1-7-g20bdedafd2f6 +# workqueue: Warn attempt to flush system-wide workqueues. +# +AC_DEFUN([LC_SRC_HAVE_FLUSH___WORKQUEUE], [ + LB2_LINUX_TEST_SRC([flush_scheduled_work_warning], [ + #include + ],[ + __flush_workqueue(system_wq); + ],[-Werror]) +]) +AC_DEFUN([LC_HAVE_FLUSH___WORKQUEUE], [ + AC_MSG_CHECKING([if 'flush_scheduled_work()' throws warning]) + LB2_LINUX_TEST_RESULT([flush_scheduled_work_warning], [ + AC_DEFINE(HAVE_FLUSH___WORKQUEUE, 1, + ['__flush_workqueue(system_wq)' is available]) + ]) +]) # LC_HAVE_FLUSH___WORKQUEUE + +# +# LC_HAVE_DENTRY_D_CHILDREN +# +# Linux commit v6.7-rc1-3-gda549bdd15c2 +# dentry: switch the lists of children to hlist +# +AC_DEFUN([LC_SRC_HAVE_DENTRY_D_CHILDREN], [ + LB2_LINUX_TEST_SRC([dentry_d_children], [ + #include + ],[ + struct dentry *dentry = NULL; + + return hlist_empty(&dentry->d_children); + ],[-Werror]) +]) +AC_DEFUN([LC_HAVE_DENTRY_D_CHILDREN], [ + AC_MSG_CHECKING([if sruct dentry has d_children member]) + LB2_LINUX_TEST_RESULT([dentry_d_children], [ + AC_DEFINE(HAVE_DENTRY_D_CHILDREN, 1, + [sruct dentry has d_children member]) + ]) +]) # LC_HAVE_DENTRY_D_CHILDREN + +# # LC_PROG_LINUX # # Lustre linux kernel checks @@ -3828,6 +3872,12 @@ AC_DEFUN([LC_PROG_LINUX_SRC], [ LC_SRC_NFS_FILLDIR_USE_CTX_RETURN_BOOL LC_SRC_HAVE_FILEMAP_GET_FOLIOS_CONTIG + # 6.6 + LC_SRC_HAVE_FLUSH___WORKQUEUE + + # 6.8 + LC_SRC_HAVE_DENTRY_D_CHILDREN + # kernel patch to extend integrity interface LC_SRC_BIO_INTEGRITY_PREP_FN ]) @@ -4074,6 +4124,12 @@ AC_DEFUN([LC_PROG_LINUX_RESULTS], [ LC_NFS_FILLDIR_USE_CTX_RETURN_BOOL LC_HAVE_FILEMAP_GET_FOLIOS_CONTIG + # 6.6 + LC_HAVE_FLUSH___WORKQUEUE + + # 6.8 + LC_HAVE_DENTRY_D_CHILDREN + # kernel patch to extend integrity interface LC_BIO_INTEGRITY_PREP_FN ]) @@ -4498,6 +4554,7 @@ lustre/doc/Makefile lustre/include/Makefile lustre/include/lustre/Makefile lustre/include/uapi/linux/lustre/Makefile +lustre/kernel_patches/targets/5.14-rhel9.5.target lustre/kernel_patches/targets/5.14-rhel9.4.target lustre/kernel_patches/targets/5.14-rhel9.3.target lustre/kernel_patches/targets/5.14-rhel9.2.target diff --git a/lustre/include/lustre_compat.h b/lustre/include/lustre_compat.h index 8169052..d7cc6ac 100644 --- a/lustre/include/lustre_compat.h +++ b/lustre/include/lustre_compat.h @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -86,6 +87,16 @@ static inline int d_in_lookup(struct dentry *dentry) } #endif +#ifdef HAVE_DENTRY_D_CHILDREN +#define d_no_children(dentry) (hlist_empty(&(dentry)->d_children)) +#define d_for_each_child(child, dentry) \ + hlist_for_each_entry((child), &(dentry)->d_children, d_sib) +#else +#define d_no_children(dentry) (list_empty(&(dentry)->d_subdirs)) +#define d_for_each_child(child, dentry) \ + list_for_each_entry((child), &(dentry)->d_subdirs, d_child) +#endif + #ifndef HAVE_VM_FAULT_T #define vm_fault_t int #endif @@ -622,4 +633,8 @@ static inline struct page *ll_read_cache_page(struct address_space *mapping, #endif /* HAVE_READ_CACHE_PAGE_WANTS_FILE */ } +#ifndef HAVE_FLUSH___WORKQUEUE +#define __flush_workqueue(wq) flush_scheduled_work() +#endif + #endif /* _LUSTRE_COMPAT_H */ diff --git a/lustre/kernel_patches/targets/5.14-rhel9.5.target.in b/lustre/kernel_patches/targets/5.14-rhel9.5.target.in new file mode 100644 index 0000000..cafc16c --- /dev/null +++ b/lustre/kernel_patches/targets/5.14-rhel9.5.target.in @@ -0,0 +1,26 @@ +lnxmaj="5.14.0" +lnxrel="503.2.1.el9_5" + +KERNEL_SRPM=kernel-${lnxmaj}-${lnxrel}.src.rpm +SERIES="" +EXTRA_VERSION=${lnxrel}_lustre.@VERSION@ +LUSTRE_VERSION=@VERSION@ + +DEVEL_PATH_ARCH_DELIMETER="." +OFED_VERSION=inkernel + +BASE_ARCHS="i686 x86_64 ia64 ppc64" +BIGMEM_ARCHS="" +BOOT_ARCHS="" +JENSEN_ARCHS="" +#SMP_ARCHS="i686 x86_64 ia64 ppc64" +# RHEL8 doesn't use smp specific kernels +SMP_ARCHS="" +UP_ARCHS="" + +for cc in gcc ; do + if which $cc >/dev/null 2>/dev/null ; then + export CC=$cc + break + fi +done diff --git a/lustre/llite/dcache.c b/lustre/llite/dcache.c index 7de0f5f..a9d3a3a 100644 --- a/lustre/llite/dcache.c +++ b/lustre/llite/dcache.c @@ -130,7 +130,7 @@ static int ll_ddelete(const struct dentry *de) d_lustre_invalid(de) ? "deleting" : "keeping", de, de, de->d_parent, de->d_inode, d_unhashed((struct dentry *)de) ? "" : "hashed,", - list_empty(&de->d_subdirs) ? "" : "subdirs"); + d_no_children(de) ? "" : "subdirs"); if (d_lustre_invalid(de)) RETURN(1); diff --git a/lustre/llite/namei.c b/lustre/llite/namei.c index 0bcc053..2742820 100644 --- a/lustre/llite/namei.c +++ b/lustre/llite/namei.c @@ -178,7 +178,7 @@ restart: spin_lock(&dir->i_lock); hlist_for_each_entry(dentry, &dir->i_dentry, d_alias) { spin_lock(&dentry->d_lock); - list_for_each_entry(child, &dentry->d_subdirs, d_child) { + d_for_each_child(child, dentry) { if (child->d_inode) continue; -- 1.8.3.1