Whamcloud - gitweb
LU-14651 llite: extend inode methods with user namespace arg
[fs/lustre-release.git] / lustre / autoconf / lustre-core.m4
index 1e23d85..8a66bd9 100644 (file)
@@ -5,7 +5,6 @@
 #
 AC_DEFUN([LC_CONFIG_SRCDIR], [
 AC_CONFIG_SRCDIR([lustre/obdclass/obdo.c])
-libcfs_is_module="yes"
 ldiskfs_is_ext4="yes"
 ])
 
@@ -57,6 +56,55 @@ AC_CHECK_FUNCS([name_to_handle_at],
 ]) # LC_GLIBC_SUPPORT_FHANDLES
 
 #
+# LC_GLIBC_SUPPORT_COPY_FILE_RANGE
+#
+AC_DEFUN([LC_GLIBC_SUPPORT_COPY_FILE_RANGE], [
+AC_CHECK_FUNCS([copy_file_range],
+       [AC_DEFINE(HAVE_COPY_FILE_RANGE, 1,
+               [copy_file_range() is supported])],
+       [AC_MSG_WARN([copy_file_range() is not supported])])
+]) # LC_GLIBC_SUPPORT_COPY_FILE_RANGE
+
+#
+# LC_FID2PATH_UNION
+#
+AC_DEFUN([LC_FID2PATH_ANON_UNION], [
+AC_MSG_CHECKING([if 'struct getinfo_fid2path' has anony•mous union])
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+       #include <linux/lustre/lustre_idl.h>
+
+       int main(void) {
+               struct getinfo_fid2path gf;
+               struct lu_fid root_fid;
+
+               *gf.gf_root_fid = root_fid;
+               return 0;
+       }
+])],[
+       AC_DEFINE(HAVE_FID2PATH_ANON_UNIONS, 1, [union is unnamed])
+       AC_MSG_RESULT("yes")
+])
+]) # LC_FID2PATH_ANON_UNION
+
+#
+# LC_IOC_REMOVE_ENTRY
+#
+AC_DEFUN([LC_IOC_REMOVE_ENTRY], [
+AC_MSG_CHECKING([if ioctl IOC_REMOVE_ENTRY' is supported])
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+       #include <sys/ioctl.h>
+       #include <linux/lustre/lustre_ioctl.h>
+
+       int main(void) {
+               return ioctl(0, LL_IOC_REMOVE_ENTRY, NULL);
+       }
+])],[
+       AC_DEFINE(HAVE_IOC_REMOVE_ENTRY, 1,
+               [IOC_REMOVE_ENTRY ioctl exists])
+])
+]) # LC_IOC_REMOVE_ENTRY
+
+#
 # LC_STACK_SIZE
 #
 # Ensure the stack size is at least 8k in Lustre server (all kernels)
@@ -103,7 +151,7 @@ AC_ARG_ENABLE([pinger],
        [], [enable_pinger="yes"])
 AC_MSG_RESULT([$enable_pinger])
 AS_IF([test "x$enable_pinger" != xno],
-       [AC_DEFINE(ENABLE_PINGER, 1,[Use the Pinger])])
+       [AC_DEFINE(CONFIG_LUSTRE_FS_PINGER, 1,[Use the Pinger])])
 ]) # LC_CONFIG_PINGER
 
 #
@@ -220,7 +268,9 @@ AC_MSG_CHECKING([whether to enable gss keyring backend])
 AC_ARG_ENABLE([gss_keyring],
        [AC_HELP_STRING([--disable-gss-keyring],
                [disable gss keyring backend])],
-       [], [enable_gss_keyring="auto"])
+       [], [AS_IF([test "x$enable_gss" != xno], [
+                       enable_gss_keyring="yes"], [
+                       enable_gss_keyring="auto"])])
 AC_MSG_RESULT([$enable_gss_keyring])
 AS_IF([test "x$enable_gss_keyring" != xno], [
        LB_CHECK_CONFIG_IM([KEYS], [], [
@@ -239,7 +289,10 @@ AS_IF([test "x$enable_gss_keyring" != xno], [
                AS_IF([test "x$enable_gss_keyring" = xyes], [
                        AC_MSG_ERROR([Cannot enable gss_keyring. See above for details.])
                ])
+               enable_ssk="no"
        ])
+], [
+       enable_ssk="no"
 ])
 ]) # LC_CONFIG_GSS_KEYRING
 
@@ -286,6 +339,18 @@ AC_ARG_ENABLE([gss],
        [], [enable_gss="auto"])
 AC_MSG_RESULT([$enable_gss])
 
+AC_ARG_VAR([TEST_JOBS],
+    [simultaneous jobs during configure (defaults to $(nproc))])
+if test "x$ac_cv_env_TEST_JOBS_set" != "xset"; then
+       TEST_JOBS=${TEST_JOBS:-$(nproc)}
+fi
+AC_SUBST(TEST_JOBS)
+
+AC_ARG_VAR([TEST_DIR],
+    [location of temporary parallel configure tests (defaults to $PWD/lb2)])
+       TEST_DIR=${TEST_DIR:-$PWD/_lpb}
+AC_SUBST(TEST_DIR)
+
 AS_IF([test "x$enable_gss" != xno], [
        LC_CONFIG_GSS_KEYRING
        LC_KEY_TYPE_INSTANTIATE_2ARGS
@@ -320,7 +385,9 @@ AS_IF([test "x$enable_gss" != xno], [
                enable_gss="no"
        ])
 
-       enable_ssk=$enable_gss
+       AS_IF([test "x$enable_ssk" != xno], [
+               enable_ssk=$enable_gss
+       ])
 ], [
        enable_gss_keyring="no"
 ])
@@ -366,12 +433,19 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
        enable_getsepol="no"
        AC_MSG_WARN([
 
-No openssk-devel headers found, unable to build l_getsepol and SELinux status checking
+No openssl-devel headers found, unable to build l_getsepol and SELinux status checking
 ])
 ])
 AC_MSG_RESULT([$enable_getsepol])
 ]) # LC_OPENSSL_GETSEPOL
 
+# LC_HAVE_LIBAIO
+AC_DEFUN([LC_HAVE_LIBAIO], [
+       AC_CHECK_HEADER([libaio.h],
+               enable_libaio="yes",
+               AC_MSG_WARN([libaio is not installed in the system]))
+]) # LC_HAVE_LIBAIO
+
 AC_DEFUN([LC_HAVE_PROJECT_QUOTA], [
 LB_CHECK_COMPILE([if get_projid exists],
 get_projid, [
@@ -387,6 +461,21 @@ get_projid, [
 ])
 ]) # LC_HAVE_PROJECT_QUOTA
 
+AC_DEFUN([LC_HAVE_GET_INODE_USAGE], [
+LB_CHECK_COMPILE([if get_inode_usage exists],
+get_inode_usage, [
+       struct inode;
+       #include <linux/quota.h>
+],[
+       struct dquot_operations ops = { };
+
+       ops.get_inode_usage(NULL, NULL);
+],[
+       AC_DEFINE(HAVE_GET_INODE_USAGE, 1,
+               [get_inode_usage function exists])
+])
+]) # LC_HAVE_GET_INODE_USAGE
+
 #
 # LC_INVALIDATE_RANGE
 #
@@ -591,25 +680,22 @@ kiocb_ki_left, [
 ]) # LC_KIOCB_KI_LEFT
 
 #
-# LC_INIT_LIST_HEAD_RCU
+# LC_REGISTER_SHRINKER_RET
 #
-# 3.12 added INIT_LIST_HEAD_RCU in commit 2a855b644c310d5db5
-# which is unfortunately an inline function and not a macro
-# that can be tested directly, so it needs a configure check.
+# v3.11-8748-g1d3d4437eae1 register_shrinker returns a status
 #
-AC_DEFUN([LC_INIT_LIST_HEAD_RCU], [
-LB_CHECK_COMPILE([if 'INIT_LIST_HEAD_RCU' exists],
-init_list_head_rcu, [
-       #include <linux/list.h>
-       #include <linux/rculist.h>
+AC_DEFUN([LC_REGISTER_SHRINKER_RET], [
+LB_CHECK_COMPILE([if register_shrinker() returns status],
+register_shrinker_ret, [
+       #include <linux/mm.h>
 ],[
-       struct list_head list;
-       INIT_LIST_HEAD_RCU(&list);
+       if (register_shrinker(NULL))
+               unregister_shrinker(NULL);
 ],[
-       AC_DEFINE(HAVE_INIT_LIST_HEAD_RCU, 1,
-                 [INIT_LIST_HEAD_RCU exists])
+       AC_DEFINE(HAVE_REGISTER_SHRINKER_RET, 1,
+               [register_shrinker() returns status])
 ])
-]) # LC_INIT_LIST_HEAD_RCU
+]) # LC_REGISTER_SHRINKER_RET
 
 #
 # LC_VFS_RENAME_5ARGS
@@ -989,6 +1075,23 @@ aio_complete, [
 ]) # LC_HAVE_AIO_COMPLETE
 
 #
+# LC_HAVE_IS_ROOT_INODE
+#
+# 3.19 kernel adds is_root_inode()
+# Commit a7400222e3eb ("new helper: is_root_inode()")
+#
+AC_DEFUN([LC_HAVE_IS_ROOT_INODE], [
+LB_CHECK_COMPILE([if kernel has is_root_inode() ],
+is_root_inode, [
+       #include <linux/fs.h>
+],[
+       is_root_inode(NULL);
+],[
+       AC_DEFINE(HAVE_IS_ROOT_INODE, 1, [is_root_inode defined])
+])
+]) # LC_HAVE_IS_ROOT_INODE
+
+#
 # LC_BACKING_DEV_INFO_REMOVAL
 #
 # 3.20 kernel removed backing_dev_info from address_space
@@ -1136,6 +1239,24 @@ account_page_dirtied, [
 ]) # LC_ACCOUNT_PAGE_DIRTIED_3ARGS
 
 #
+# LC_HAVE_CRYPTO_ALLOC_SKCIPHER
+#
+# Kernel version 4.12 commit 7a7ffe65c8c5
+# introduced crypto_alloc_skcipher().
+#
+AC_DEFUN([LC_HAVE_CRYPTO_ALLOC_SKCIPHER], [
+LB_CHECK_COMPILE([if crypto_alloc_skcipher is defined],
+crypto_alloc_skcipher, [
+       #include <crypto/skcipher.h>
+],[
+       crypto_alloc_skcipher(NULL, 0, 0);
+],[
+       AC_DEFINE(HAVE_CRYPTO_ALLOC_SKCIPHER, 1,
+               [crypto_alloc_skcipher is defined])
+])
+]) # LC_HAVE_CRYPTO_ALLOC_SKCIPHER
+
+#
 # LC_HAVE_INTERVAL_EXP_BLK_INTEGRITY
 #
 # 4.3 replace interval with interval_exp in 'struct blk_integrity'
@@ -1232,6 +1353,28 @@ bio_integrity_prep_fn, [
 ])
 ]) # LC_BIO_INTEGRITY_PREP_FN
 
+# LC_BIO_INTEGRITY_PREP_FN_RETURNS_BOOL
+#
+# 13 kernel integrity API has changed and in 4.13+
+# (as well as in rhel 8.4) bio_integrity_prep() returns boolean true
+# on success.
+#
+AC_DEFUN([LC_BIO_INTEGRITY_PREP_FN_RETURNS_BOOL], [
+LB_CHECK_COMPILE([if 'bio_integrity_prep_fn' returns bool],
+bio_integrity_prep, [
+       #include <linux/bio.h>
+       #include <linux/typecheck.h>
+],[
+       #pragma GCC diagnostic warning "-Werror"
+       typedef bool (*bio_integrity_prep_type)(struct bio *bio) ;
+
+       typecheck_fn(bio_integrity_prep_type, bio_integrity_prep);
+],[
+       AC_DEFINE(HAVE_BIO_INTEGRITY_PREP_FN_RETURNS_BOOL, 1,
+               [bio_integrity_prep_fn returns bool])
+])
+]) # LC_BIO_INTEGRITY_PREP_FN_RETURNS_BOOL
+
 #
 # LC_HAVE_BI_OPF
 #
@@ -1280,8 +1423,7 @@ LB_CHECK_COMPILE([if kernel has clean_bdev_aliases],
 have_clean_bdev_aliases, [
        #include <linux/buffer_head.h>
 ],[
-       struct block_device bdev;
-       clean_bdev_aliases(&bdev,1,1);
+       clean_bdev_aliases(NULL,1,1);
 ], [
        AC_DEFINE(HAVE_CLEAN_BDEV_ALIASES, 1,
                [kernel has clean_bdev_aliases])
@@ -1478,6 +1620,26 @@ lock_page_memcg, [
 ]) # LC_LOCK_PAGE_MEMCG
 
 #
+# LC_D_INIT
+#
+# Kernel version 4.7-rc5 commit 285b102d3b745f3c2c110c9c327741d87e64aacc
+# add new d_init to initialize dentry at allocation time
+#
+AC_DEFUN([LC_D_INIT], [
+LB_CHECK_COMPILE([if dentry operations supports 'd_init'],
+d_init, [
+       #include <linux/dcache.h>
+],[
+       struct dentry_operations ops = { };
+       int rc;
+
+       rc = ops.d_init(NULL);
+],[
+       AC_DEFINE(HAVE_D_INIT, 1, ['d_init' exists])
+])
+]) # LC_D_INIT
+
+#
 # LC_DIRECTIO_2ARGS
 #
 # Kernel version 4.7 commit c8b8e32d700fe943a935e435ae251364d016c497
@@ -1540,6 +1702,19 @@ fop_iterate_shared, [
 ]) # LC_FOP_ITERATE_SHARED
 
 #
+# LC_EXPORT_DEFAULT_FILE_SPLICE_READ
+#
+# 4.8-rc8 commit 82c156f853840645604acd7c2cebcb75ed1b6652 switched
+# generic_file_splice_read() to using ->read_iter. We can test this
+# change since default_file_splice_read() is no longer exported.
+#
+AC_DEFUN([LC_EXPORT_DEFAULT_FILE_SPLICE_READ], [
+LB_CHECK_EXPORT([default_file_splice_read], [fs/splice.c],
+       [AC_DEFINE(HAVE_DEFAULT_FILE_SPLICE_READ_EXPORT, 1,
+                       [default_file_splice_read is exported])])
+]) # LC_EXPORT_DEFAULT_FILE_SPLCE_READ
+
+#
 # LC_HAVE_POSIX_ACL_VALID_USER_NS
 #
 # 4.8 posix_acl_valid takes struct user_namespace
@@ -1722,8 +1897,8 @@ LB_CHECK_COMPILE([if 'struct vm_fault' replaced virtual_address with address fie
 vm_fault_address, [
        #include <linux/mm.h>
 ],[
-       struct vm_fault vmf;
-       vmf.address = NULL;
+       unsigned long vaddr = ((struct vm_fault *)0)->address;
+       (void)vaddr;
 ],[
        AC_DEFINE(HAVE_VM_FAULT_ADDRESS, 1,
                [virtual_address has been replaced by address field])
@@ -1935,6 +2110,49 @@ bi_bdev, [
 ]) # LC_BI_BDEV
 
 #
+# LC_INTERVAL_TREE_CACHED
+#
+# 4.14 f808c13fd3738948e10196496959871130612b61
+# switched INTERVAL_TREE_DEFINE to use cached RB_Trees.
+#
+AC_DEFUN([LC_INTERVAL_TREE_CACHED], [
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_CHECK_COMPILE([if interval_trees use rb_tree_cached],
+itree_cached, [
+       #include <linux/interval_tree_generic.h>
+       struct foo { struct rb_node rb; int last; int a,b;};
+       #define START(n) ((n)->a)
+       #define LAST(n) ((n)->b)
+       struct rb_root_cached tree;
+       INTERVAL_TREE_DEFINE(struct foo, rb, int, last,
+               START, LAST, , foo);
+],[
+       foo_insert(NULL, &tree);
+],[
+       AC_DEFINE(HAVE_INTERVAL_TREE_CACHED, 1,
+               [interval trees use rb_tree_cached])
+])
+EXTRA_KCFLAGS="$tmp_flags"
+]) # LC_INTERVAL_TREE_CACHED
+
+#
+# LC_IS_ENCRYPTED
+#
+# 4.14 introduced IS_ENCRYPTED and S_ENCRYPTED
+#
+AC_DEFUN([LC_IS_ENCRYPTED], [
+LB_CHECK_COMPILE([if IS_ENCRYPTED is defined],
+is_encrypted, [
+       #include <linux/fs.h>
+],[
+       IS_ENCRYPTED((struct inode *)0);
+],[
+       has_is_encrypted="yes"
+])
+]) # LC_IS_ENCRYPTED
+
+#
 # LC_I_PAGES
 #
 # kernel 4.17 commit b93b016313b3ba8003c3b8bb71f569af91f19fc7
@@ -1974,6 +2192,47 @@ vm_fault_t, [
 ]) # LC_VM_FAULT_T
 
 #
+# LC_VM_FAULT_RETRY
+#
+# kernel 4.17 commit 3d3539018d2cbd12e5af4a132636ee7fd8d43ef0
+# mm: VM_FAULT_RETRY is defined in enum vm_fault_reason
+#
+AC_DEFUN([LC_VM_FAULT_RETRY], [
+LB_CHECK_COMPILE([if VM_FAULT_RETRY is defined],
+VM_FAULT_RETRY, [
+       #include <linux/mm.h>
+],[
+       #ifndef VM_FAULT_RETRY
+               vm_fault_t x;
+               x = VM_FAULT_RETRY;
+       #endif
+],[
+       AC_DEFINE(HAVE_VM_FAULT_RETRY, 1,
+               [if VM_FAULT_RETRY is defined])
+])
+]) # LC_VM_FAULT_RETRY
+
+#
+# LC_ALLOC_FILE_PSEUDO
+#
+# kernel 4.18-rc1 commit d93aa9d82aea80b80f225dbf9c7986df444d8106
+# new wrapper: alloc_file_pseudo()
+#
+AC_DEFUN([LC_ALLOC_FILE_PSEUDO], [
+LB_CHECK_COMPILE([if 'alloc_file_pseudo' is defined],
+alloc_file_pseudo, [
+       #include <linux/file.h>
+],[
+       struct file *file;
+       file = alloc_file_pseudo(NULL, NULL, "[test]",
+                                00000002, NULL);
+],[
+       AC_DEFINE(HAVE_ALLOC_FILE_PSEUDO, 1,
+               ['alloc_file_pseudo' exist])
+])
+]) # LC_ALLOC_FILE_PSEUDO
+
+#
 # LC_INODE_TIMESPEC64
 #
 # kernel 4.17-rc7 commit 8efd6894ff089adeeac7cb9f32125b85d963d1bc
@@ -1988,6 +2247,9 @@ vm_fault_t, [
 # When inode times are timespec64 stop using the deprecated
 # time interfaces.
 #
+# kernel v5.5-rc1-6-gba70609d5ec6 ba70609d5ec664a8f36ba1c857fcd97a478adf79
+# fs: Delete timespec64_trunc()
+#
 AC_DEFUN([LC_INODE_TIMESPEC64], [
 tmp_flags="$EXTRA_KCFLAGS"
 EXTRA_KCFLAGS="-Werror"
@@ -1996,9 +2258,9 @@ inode_timespec64, [
        #include <linux/fs.h>
 ],[
        struct inode *inode = NULL;
-       struct timespec64 ts = {};
+       struct timespec64 ts = {0, 1};
 
-       inode->i_atime = timespec64_trunc(ts, 1);
+       inode->i_atime = ts;
        (void)inode;
 ],[
        AC_DEFINE(HAVE_INODE_TIMESPEC64, 1,
@@ -2008,42 +2270,26 @@ EXTRA_KCFLAGS="$tmp_flags"
 ]) # LC_INODE_TIMESPEC64
 
 #
-# LC_XA_IS_VALUE
-# kernel 4.19-rc6 commit 3159f943aafdbacb2f94c38fdaadabf2bbde2a14
-# xarray: Replace exceptional entries
-# adds xa_is_value
-#
-AC_DEFUN([LC_XA_IS_VALUE], [
-LB_CHECK_COMPILE([xa_is_value exist],
-xa_is_value, [
-       #include <linux/xarray.h>
-],[
-       xa_is_value(NULL);
-],[
-       AC_DEFINE(HAVE_XA_IS_VALUE, 1, [xa_is_value exist])
-])
-]) # LC_XA_IS_VALUE
-
-#
-# LC___XA_SET_MARK
+# LC_RADIX_TREE_TAG_SET
 #
 # kernel 4.20 commit v4.19-rc5-248-g9b89a0355144
-# xarray: Add XArray marks
+# xarray: Add XArray marks - replaced radix_tree_tag_set
 #
-AC_DEFUN([LC___XA_SET_MARK], [
-LB_CHECK_COMPILE([if '__xa_set_mark' exists],
-__xa_set_mark, [
-       #include <linux/xarray.h>
+AC_DEFUN([LC_RADIX_TREE_TAG_SET], [
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_CHECK_COMPILE([if 'radix_tree_tag_set' exists],
+radix_tree_tag_set, [
        #include <linux/fs.h>
+       #include <linux/radix-tree.h>
 ],[
-       struct xarray *xa = NULL;
-
-       __xa_set_mark(xa, 0, PAGECACHE_TAG_DIRTY);
+       radix_tree_tag_set(NULL, 0, PAGECACHE_TAG_DIRTY);
 ],[
-       AC_DEFINE(HAVE___XA_SET_MARK, 1,
-               [__xa_set_mark exists])
+       AC_DEFINE(HAVE_RADIX_TREE_TAG_SET, 1,
+               [radix_tree_tag_set exists])
 ])
-]) # LC___XA_SET_MARK
+EXTRA_KCFLAGS="$tmp_flags"
+]) # LC_RADIX_TREE_TAG_SET
 
 #
 # LC_UAPI_LINUX_MOUNT_H
@@ -2115,6 +2361,28 @@ EXTRA_KCFLAGS="$tmp_flags"
 ]) # LC_HAS_LINUX_SELINUX_ENABLED
 
 #
+# LB_HAVE_BVEC_ITER_ALL
+#
+# kernel 5.1 commit 6dc4f100c175dd0511ae8674786e7c9006cdfbfa
+# block: allow bio_for_each_segment_all() to iterate over multi-page bvec
+#
+AC_DEFUN([LB_HAVE_BVEC_ITER_ALL], [
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_CHECK_COMPILE([if bvec_iter_all exists for multi-page bvec iternation],
+ext4fs_dirhash, [
+       #include <linux/bvec.h>
+],[
+       struct bvec_iter_all iter;
+       (void)iter;
+],[
+       AC_DEFINE(HAVE_BVEC_ITER_ALL, 1,
+               [if bvec_iter_all exists for multi-page bvec iternation])
+])
+EXTRA_KCFLAGS="$tmp_flags"
+]) # LB_HAVE_BVEC_ITER_ALL
+
+#
 # LC_ACCOUNT_PAGE_DIRTIED
 #
 # After 5.2 kernel page dirtied is not exported
@@ -2126,6 +2394,25 @@ LB_CHECK_EXPORT([account_page_dirtied], [mm/page-writeback.c],
 ]) # LC_ACCOUNT_PAGE_DIRTIED
 
 #
+# LC_KEYRING_SEARCH_4ARGS
+#
+# Kernel 5.2 commit dcf49dbc8077
+# keys: Add a 'recurse' flag for keyring searches
+#
+AC_DEFUN([LC_KEYRING_SEARCH_4ARGS], [
+LB_CHECK_COMPILE([if 'keyring_search' has 4 args],
+keyring_search_4args, [
+       #include <linux/key.h>
+],[
+       key_ref_t keyring;
+       keyring_search(keyring, NULL, NULL, false);
+],[
+       AC_DEFINE(HAVE_KEYRING_SEARCH_4ARGS, 1,
+               [keyring_search has 4 args])
+])
+]) # LC_KEYRING_SEARCH_4ARGS
+
+#
 # LC_BIO_BI_PHYS_SEGMENTS
 #
 # kernel 5.3-rc1 commit 14ccb66b3f585b2bc21e7256c96090abed5a512c
@@ -2171,6 +2458,49 @@ EXTRA_KCFLAGS="$tmp_flags"
 ]) # LC_LM_COMPARE_OWNER_EXISTS
 
 #
+# LC_FSCRYPT_SUPPORT
+#
+# 5.4 introduced fscrypt encryption policies v2
+#
+AC_DEFUN([LC_FSCRYPT_SUPPORT], [
+LB_CHECK_COMPILE([for fscrypt in-kernel support],
+fscrypt_support, [
+       #define __FS_HAS_ENCRYPTION 0
+       #include <linux/fscrypt.h>
+],[
+       fscrypt_ioctl_get_policy_ex(NULL, NULL);
+],[
+       has_fscrypt_support="yes"
+])
+]) # LC_FSCRYPT_SUPPORT
+
+#
+# LC_HAVE_USER_NAMESPACE_ARG
+#
+# kernel 5.12 commit 549c7297717c32ee53f156cd949e055e601f67bb
+# fs: make helpers idmap mount aware
+# Extend some inode methods with an additional user namespace argument.
+#
+AC_DEFUN([LC_HAVE_USER_NAMESPACE_ARG], [
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_CHECK_COMPILE([if 'inode_operations' members have user namespace argument],
+user_namespace_argument, [
+       #include <linux/fs.h>
+],[
+       ((struct inode_operations *)1)->getattr((struct user_namespace *)NULL,
+                                               NULL, NULL, 0, 0);
+],[
+       AC_DEFINE(HAVE_USER_NAMESPACE_ARG, 1,
+               ['inode_operations' members have user namespace argument])
+])
+EXTRA_KCFLAGS="$tmp_flags"
+]) # LC_HAVE_USER_NAMESPACE_ARG
+
+AC_DEFUN([LC_PROG_LINUX_SRC], [])
+AC_DEFUN([LC_PROG_LINUX_RESULTS], [])
+
+#
 # LC_PROG_LINUX
 #
 # Lustre linux kernel checks
@@ -2187,10 +2517,6 @@ AC_DEFUN([LC_PROG_LINUX], [
        LC_CONFIG_FHANDLE
        LC_CONFIG_GSS
 
-       LC_GLIBC_SUPPORT_FHANDLES
-       LC_OPENSSL_SSK
-       LC_OPENSSL_GETSEPOL
-
        # 3.10
        LC_HAVE_PROJECT_QUOTA
 
@@ -2207,7 +2533,7 @@ AC_DEFUN([LC_PROG_LINUX], [
        LC_OLDSIZE_TRUNCATE_PAGECACHE
        LC_PTR_ERR_OR_ZERO_MISSING
        LC_KIOCB_KI_LEFT
-       LC_INIT_LIST_HEAD_RCU
+       LC_REGISTER_SHRINKER_RET
 
        # 3.13
        LC_VFS_RENAME_5ARGS
@@ -2241,6 +2567,7 @@ AC_DEFUN([LC_PROG_LINUX], [
        LC_KIOCB_HAS_NBYTES
        LC_HAVE_DQUOT_QC_DQBLK
        LC_HAVE_AIO_COMPLETE
+       LC_HAVE_IS_ROOT_INODE
 
        # 3.20
        LC_BACKING_DEV_INFO_REMOVAL
@@ -2255,6 +2582,7 @@ AC_DEFUN([LC_PROG_LINUX], [
        LC_BIO_ENDIO_USES_ONE_ARG
        LC_SYMLINK_OPS_USE_NAMEIDATA
        LC_ACCOUNT_PAGE_DIRTIED_3ARGS
+       LC_HAVE_CRYPTO_ALLOC_SKCIPHER
 
        # 4.3
        LC_HAVE_INTERVAL_EXP_BLK_INTEGRITY
@@ -2284,11 +2612,13 @@ AC_DEFUN([LC_PROG_LINUX], [
 
        # 4.7
        LC_D_IN_LOOKUP
+       LC_D_INIT
        LC_DIRECTIO_2ARGS
        LC_GENERIC_WRITE_SYNC_2ARGS
        LC_FOP_ITERATE_SHARED
 
        # 4.8
+       LC_EXPORT_DEFAULT_FILE_SPLICE_READ
        LC_HAVE_POSIX_ACL_VALID_USER_NS
        LC_D_COMPARE_4ARGS
        LC_FULL_NAME_HASH_3ARGS
@@ -2318,35 +2648,43 @@ AC_DEFUN([LC_PROG_LINUX], [
 
        # 4.13
        LC_BIO_INTEGRITY_ENABLED
+       LC_BIO_INTEGRITY_PREP_FN_RETURNS_BOOL
+       LC_HAVE_GET_INODE_USAGE
 
        # 4.14
        LC_PAGEVEC_INIT_ONE_PARAM
        LC_BI_BDEV
+       LC_INTERVAL_TREE_CACHED
 
        # 4.17
        LC_VM_FAULT_T
+       LC_VM_FAULT_RETRY
        LC_I_PAGES
 
        # 4.18
+       LC_ALLOC_FILE_PSEUDO
        LC_INODE_TIMESPEC64
-       LC_XA_IS_VALUE
 
        # 4.20
-       LC___XA_SET_MARK
+       LC_RADIX_TREE_TAG_SET
        LC_UAPI_LINUX_MOUNT_H
        LC_HAVE_SUNRPC_CACHE_HASH_LOCK_IS_A_SPINLOCK
-       LC_REPLACE_EXCEPTIONAL_ENTRIES
 
        # 5.1
        LC_HAS_LINUX_SELINUX_ENABLED
+       LB_HAVE_BVEC_ITER_ALL
 
        # 5.2
        LC_ACCOUNT_PAGE_DIRTIED
+       LC_KEYRING_SEARCH_4ARGS
 
        # 5.3
        LC_BIO_BI_PHYS_SEGMENTS
        LC_LM_COMPARE_OWNER_EXISTS
 
+       # 5.12
+       LC_HAVE_USER_NAMESPACE_ARG
+
        # kernel patch to extend integrity interface
        LC_BIO_INTEGRITY_PREP_FN
 
@@ -2494,6 +2832,43 @@ AC_SUBST(OSDADDON)
 ]) # LC_OSD_ADDON
 
 #
+# LC_CONFIG_CRYPTO
+#
+# Check whether to enable Lustre client crypto
+#
+AC_DEFUN([LC_CONFIG_CRYPTO], [
+AC_MSG_CHECKING([whether to enable Lustre client crypto])
+AC_ARG_ENABLE([crypto],
+       AC_HELP_STRING([--enable-crypto=yes|no|in-kernel],
+               [enable Lustre client crypto (default is yes), use 'in-kernel' to force use of in-kernel fscrypt instead of embedded llcrypt]),
+       [], [enable_crypto="auto"])
+AS_IF([test "x$enable_crypto" != xno -a "x$enable_dist" = xno], [
+       AC_MSG_RESULT(
+       )
+       LC_IS_ENCRYPTED
+       LC_FSCRYPT_SUPPORT])
+AS_IF([test "x$enable_crypto" = xin-kernel], [
+       AS_IF([test "x$has_fscrypt_support" = xyes], [
+             AC_DEFINE(HAVE_LUSTRE_CRYPTO, 1, [Enable Lustre client crypto via in-kernel fscrypt])], [
+             AC_MSG_ERROR([Lustre client crypto cannot be enabled via in-kernel fscrypt.])
+             enable_crypto=no])],
+       [AS_IF([test "x$has_is_encrypted" = xyes], [
+             AC_DEFINE(HAVE_LUSTRE_CRYPTO, 1, [Enable Lustre client crypto via embedded llcrypt])
+             AC_DEFINE(CONFIG_LL_ENCRYPTION, 1, [embedded llcrypt])
+             enable_crypto="embedded llcrypt"
+             enable_llcrypt=yes], [
+             AS_IF([test "x$enable_crypto" = xyes],
+                   [AC_MSG_ERROR([Lustre client crypto cannot be enabled because of lack of encryption support in your kernel.])])
+             AS_IF([test "x$enable_crypto" != xno -a "x$enable_dist" = xno],
+                   [AC_MSG_WARN(Lustre client crypto cannot be enabled because of lack of encryption support in your kernel.)])
+             enable_crypto=no])])
+AS_IF([test "x$enable_dist" != xno], [
+       enable_crypto=yes
+       enable_llcrypt=yes])
+AC_MSG_RESULT([$enable_crypto])
+]) # LC_CONFIG_CRYPTO
+
+#
 # LC_CONFIGURE
 #
 # other configure checks
@@ -2526,6 +2901,9 @@ ext2fs.h not found. Please install e2fsprogs development package.
        ])
 ])
 
+# lustre/tests/statx_test.c
+AC_CHECK_FUNCS([statx])
+
 # lustre/utils/lfs.c
 AS_IF([test "$enable_dist" = "no"], [
                AC_CHECK_LIB([z], [crc32], [
@@ -2556,6 +2934,8 @@ No selinux package found, unable to build selinux enabled tools
 ])
 AC_SUBST(SELINUX)
 
+AC_CHECK_LIB([keyutils], [add_key])
+
 # Super safe df
 AC_MSG_CHECKING([whether to report minimum OST free space])
 AC_ARG_ENABLE([mindf],
@@ -2593,7 +2973,7 @@ AC_ARG_ENABLE([lu_ref],
        [], [enable_lu_ref="no"])
 AC_MSG_RESULT([$enable_lu_ref])
 AS_IF([test "x$enable_lu_ref" = xyes],
-       [AC_DEFINE([USE_LU_REF], 1,
+       [AC_DEFINE([CONFIG_LUSTRE_DEBUG_LU_REF], 1,
                [enable lu_ref reference tracking code])])
 
 AC_MSG_CHECKING([whether to enable page state tracking])
@@ -2632,7 +3012,7 @@ AC_ARG_WITH([bash-completion-dir],
 AS_IF([test "x$with_bash_completion_dir" = "xyes"], [
        BASH_COMPLETION_DIR="`pkg-config --variable=completionsdir bash-completion`"
        AS_IF([test "x$BASH_COMPLETION_DIR" = "x"], [
-               [BASH_COMPLETION_DIR="$datadir/bash-completion/completions"]
+               [BASH_COMPLETION_DIR="/usr/share/bash-completion/completions"]
        ])
 ], [
        BASH_COMPLETION_DIR="$with_bash_completion_dir"
@@ -2662,6 +3042,8 @@ AM_CONDITIONAL(ENABLE_BASH_COMPLETION, test "x$with_bash_completion_dir" != "xno
 AM_CONDITIONAL(XATTR_HANDLER, test "x$lb_cv_compile_xattr_handler_flags" = xyes)
 AM_CONDITIONAL(SELINUX, test "$SELINUX" = "-lselinux")
 AM_CONDITIONAL(GETSEPOL, test x$enable_getsepol = xyes)
+AM_CONDITIONAL(LLCRYPT, test x$enable_llcrypt = xyes)
+AM_CONDITIONAL(LIBAIO, test x$enable_libaio = xyes)
 ]) # LC_CONDITIONALS
 
 #
@@ -2681,21 +3063,24 @@ lustre/doc/Makefile
 lustre/include/Makefile
 lustre/include/lustre/Makefile
 lustre/include/uapi/linux/lustre/Makefile
+lustre/kernel_patches/targets/4.18-rhel8.5.target
+lustre/kernel_patches/targets/4.18-rhel8.4.target
+lustre/kernel_patches/targets/4.18-rhel8.3.target
+lustre/kernel_patches/targets/4.18-rhel8.2.target
 lustre/kernel_patches/targets/4.18-rhel8.1.target
 lustre/kernel_patches/targets/4.18-rhel8.target
+lustre/kernel_patches/targets/3.10-rhel7.9.target
+lustre/kernel_patches/targets/3.10-rhel7.8.target
 lustre/kernel_patches/targets/3.10-rhel7.7.target
 lustre/kernel_patches/targets/3.10-rhel7.6.target
 lustre/kernel_patches/targets/3.10-rhel7.5.target
 lustre/kernel_patches/targets/4.14-rhel7.5.target
 lustre/kernel_patches/targets/4.14-rhel7.6.target
-lustre/kernel_patches/targets/3.0-sles11.target
-lustre/kernel_patches/targets/3.0-sles11sp3.target
-lustre/kernel_patches/targets/3.0-sles11sp4.target
-lustre/kernel_patches/targets/3.12-sles12.target
-lustre/kernel_patches/targets/4.4-sles12.target
-lustre/kernel_patches/targets/4.4-sles12sp3.target
 lustre/kernel_patches/targets/4.12-sles12sp4.target
+lustre/kernel_patches/targets/4.12-sles12sp5.target
 lustre/kernel_patches/targets/4.12-sles15sp1.target
+lustre/kernel_patches/targets/5.3-sles15sp2.target
+lustre/kernel_patches/targets/5.3-sles15sp3.target
 lustre/kernel_patches/targets/3.x-fc18.target
 lustre/ldlm/Makefile
 lustre/fid/Makefile
@@ -2745,6 +3130,8 @@ lustre/scripts/Makefile
 lustre/scripts/systemd/Makefile
 lustre/tests/Makefile
 lustre/tests/mpi/Makefile
+lustre/tests/lutf/Makefile
+lustre/tests/lutf/src/Makefile
 lustre/tests/kernel/Makefile
 lustre/tests/kernel/autoMakefile
 lustre/utils/Makefile