Whamcloud - gitweb
LU-17662 osd-zfs: Support for ZFS 2.2.3 36/59136/2
authorShaun Tancheff <shaun.tancheff@hpe.com>
Wed, 7 May 2025 19:28:35 +0000 (12:28 -0700)
committerOleg Drokin <green@whamcloud.com>
Wed, 21 May 2025 03:42:22 +0000 (03:42 +0000)
ZFS commit zfs-2.2.99-269-g9b1677fb5
   dmu: Allow buffer fills to fail
Adds a boolean_t to dmu_buf_will_fill() and dmu_buf_fill_done()

Lustre always uses B_FALSE for this argument.

Also re-arrange and split some configure macros so we can all
the zfs and ldiskfs tests can be run in the same parallel pass.

Lustre-change: https://review.whamcloud.com/54530
Lustre-commit: a13fc434c57fd72e5f8908a8a197fca1a0d373e5

Was-Change-Id: I71a4723bfa8ce62ae6f270e26ab149bf98278d3f

LU-18515 build: fix configure checks for ZFS 2.2.3

These config checks were missing certain headers. Thus,
the checks failed which caused the build to also fail when
trying to compile against ZFS 2.3.0+.

Lustre-change: https://review.whamcloud.com/57452
Lustre-commit: d33e96cdd472f76d56f0e543cb1b3afb07785e54

Was-Change-Id: I8e231f0c4581f435cb4209c767fc4727cb6cbfa0

Fixes: a13fc434c57f ("LU-17662 osd-zfs: Support for ZFS 2.2.3")
Signed-off-by: Timothy Day <timday@amazon.com>
LU-16664 build: Debian server fails building crypto.c

When building deb files against a server built without
CONFIG_FS_ENCRYPTION it still attempts to build crypto.c
when it should not.

Lustre-change: https://review.whamcloud.com/50406
Lustre-commit: 71746b6277a59ede2110420f5907fe2dafd9ac2a

Was-Change-Id: Id1e67daa7b021fdfee49be4eb0beb2b86ca62c39

Fixes: 068e5f13fb ("LU-13743 build: Explicitly require encryption support")

LU-13743 build: Explicitly require encryption support

Linux commit v5.18-rc5-17-gb1241c8eb977
  ext4: move ext4 crypto code to its own file crypto.c

Update the ldiskfs Makefile to exclude crypto.c when
CONFIG_FS_ENCRYPTION is not enabled.

Lustre-change: https://review.whamcloud.com/39243
Lustre-commit: 068e5f13fb94802ced68712ee11e7f9cb106d0ae

Was-Change-Id: Ic8a40f3d395286bb52ed20693fd7cc4755b10556

LU-13485 ldiskfs: Parallel configure tests for ldiskfs

Transform the compile tests in ldiskfs to run in parallel

Lustre-change: https://review.whamcloud.com/38351
Lustre-commit: 3774b6afbe3b67e869bb61c9cb212cc37e8705fa

Was-Change-Id: I3a097ab5cd18b57e9311980d9aa708ed25f58464

LU-6142 misc: update headers in config, debian, rpm

Update the file header to have the SPDX license and
use the standard format.

Fix minor style issues with comments in a few files.
Remove `dnl` from m4 files.

Files that are uncertain are left as NOASSERTION
for the license identifier. This makes no claim
about the file. It is used to track files so they
can be addressed later.

https://spdx.github.io/spdx-spec/v2-draft/package-information/#75-package-supplier-field

Lustre-change: https://review.whamcloud.com/52106
Lustre-commit: f89529a06ed2cf6e3a02df6093e047d4d7da15ea

Was-Change-Id: I212ce05a4292bbb0d71372d9d75880ce45a219f3

Signed-off-by: Timothy Day <timday@amazon.com>
LU-13530 build: Add kernel version to depmod

The depmod commands in the postrm and
postinst scripts should use the kernel
version the package is built against.
Otherwise, depmod will use the current
kernel version - which might be different.

This patch also adds a line indicating that
the file has been modified.

Lustre-change: https://review.whamcloud.com/49573
Lustre-commit: 98338572a671e1a9c227a8589f7a9b5972b924bf

Was-Change-Id: I355420a85ea0ed301433816588758197795b5ede

Signed-off-by: Timothy Day <timday@amazon.com>
LU-13906 build: Conditionally require kmod-zfs-devel

Server with zfs support requires either kmod-zfs-devel
or a configure that points to the required headers and
library files via configure.

Here we check the configure arguments for '--with-zfs-obj='
if the zfs path is specified for configure the package
requirement is not needed.

Otherwise require the kmod-zfs-devel package and require
one of libzfs-devel, libzfs4-devel or libzfs5-devel

Lustre-change: https://review.whamcloud.com/46356
Lustre-commit: 77d01c485e00468b2ef6e3eb64544d30c049a411

HPE-bug-id: LUS-9743, LUS-10363
Was-Change-Id: Ia12239ac7e3912ff50ec7c8e2ceb888862afbc34

LU-17171 test: improve sanity-quota test_41

On zfs backend, df result of project quota may print be a slightly
larger block used than quota result because the former is calcuated
in filesystem block size which is 4K.

Update sanity-quota test_41 to make it more robust.

Lustre-change: https://review.whamcloud.com/52591
Lustre-commit: a504f2c869bada922c6211822be432b253921096

Was-Change-Id: Ide51d9aaeb8907eb77acc30fa4fc76dcc16e8de0

Signed-off-by: Lai Siyao <lai.siyao@whamcloud.com>
LU-16743 lod: create stripe with correct attr

lod_xattr_set_lmv() create directory stripe with master object attr,
but it shouldn't change attr->la_valid, otherwise bogus data may be
set on stripe object.

Zfs osd_create() copies attr to object directly, clear la_flags if
LA_FLAGS is not set in la_valid.

Lustre-change: https://review.whamcloud.com/52052
Lustre-commit: 6be9476e790ceef71e874b2745a8280443d5c90b

Was-Change-Id: I8385f36bd2eee0e55cbe6bd031b0e013cda40e06

Signed-off-by: Lai Siyao <lai.siyao@whamcloud.com>
Test-Parameters: trivial fstype=zfs
Test-Parameters: optional fstype=zfs mdtcount=4 mdscount=2 \
  clientdistro=el9.5 serverdistro=el8.10 testgroup=full-dne-zfs-part-1
Test-Parameters: optional fstype=zfs mdtcount=4 mdscount=2 \
  clientdistro=el9.5 serverdistro=el8.10 testgroup=full-dne-zfs-part-2
Test-Parameters: optional fstype=zfs mdtcount=4 mdscount=2 \
  clientdistro=el9.5 serverdistro=el8.10 testgroup=full-dne-zfs-part-3

Signed-off-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Change-Id: I71a4723bfa8ce62ae6f270e26ab149bf98278d3f
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/59136
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
21 files changed:
config/Makefile.am
config/lustre-build-ldiskfs.m4
config/lustre-build-linux.m4
config/lustre-build-zfs.m4
config/lustre-build.m4
config/lustre-version.m4
debian/dkms.conf.in
debian/lustre-client-modules-dkms.postinst
debian/lustre-client-modules-dkms.prerm
debian/postinst
debian/postrm
debian/rules
ldiskfs/Makefile.in
lustre.spec.in
lustre/lod/lod_object.c
lustre/osd-zfs/osd_io.c
lustre/osd-zfs/osd_object.c
lustre/tests/sanity-quota.sh
rpm/find-provides
rpm/find-provides.ksyms
rpm/kmp-lustre-osd-zfs.preamble

index 63804c6..128d9e9 100644 (file)
@@ -1,2 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0
+
+#
+# This file is part of Lustre, http://www.lustre.org/
+#
+# config/Makefile.am
+#
+# Template to generate Makefile
+#
+
 EXTRA_DIST  = lustre-build.m4 lustre-build-linux.m4
 EXTRA_DIST += lustre-build-ldiskfs.m4 lustre-build-zfs.m4
index d6466ec..cc8099b 100644 (file)
@@ -1,3 +1,13 @@
+# SPDX-License-Identifier: GPL-2.0
+
+#
+# This file is part of Lustre, http://www.lustre.org/
+#
+# config/lustre-build-ldiskfs.m4
+#
+# ldiskfs OSD related configuration
+#
+
 #
 # LDISKFS_LINUX_SERIES
 #
@@ -166,17 +176,20 @@ AC_SUBST(LDISKFS_SERIES)
 # 2.6.32-rc7 ext4_free_blocks requires struct buffer_head
 # Note that RHEL6 is pre 2.6.32-rc7 so this check is still needed.
 #
+AC_DEFUN([LB_SRC_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD], [
+       LB2_LINUX_TEST_SRC([ext4_free_blocks_with_buffer_head], [
+               #include <linux/fs.h>
+               #include "$EXT4_SRC_DIR/ext4.h"
+       ],[
+               ext4_free_blocks(NULL, NULL, NULL, 0, 0, 0);
+       ],[],[],[ext4_free_blocks])
+])
 AC_DEFUN([LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD], [
-LB_CHECK_COMPILE([if 'ext4_free_blocks' needs 'struct buffer_head'],
-ext4_free_blocks_with_buffer_head, [
-       #include <linux/fs.h>
-       #include "$EXT4_SRC_DIR/ext4.h"
-],[
-       ext4_free_blocks(NULL, NULL, NULL, 0, 0, 0);
-],[
+AC_MSG_CHECKING([if 'ext4_free_blocks' needs 'struct buffer_head'])
+LB2_LINUX_TEST_RESULT([ext4_free_blocks_with_buffer_head], [
        AC_DEFINE(HAVE_EXT_FREE_BLOCK_WITH_BUFFER_HEAD, 1,
                [ext4_free_blocks do not require struct buffer_head])
-])
+       ])
 ]) # LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
 
 #
@@ -184,16 +197,20 @@ ext4_free_blocks_with_buffer_head, [
 #
 # 3.9 added a type argument to ext4_journal_start and friends
 #
-AC_DEFUN([LB_EXT4_JOURNAL_START_3ARGS], [
-LB_CHECK_COMPILE([if ext4_journal_start takes 3 arguments],
-ext4_journal_start, [
-       #include <linux/fs.h>
-       #include "$EXT4_SRC_DIR/ext4_jbd2.h"
-],[
-       ext4_journal_start(NULL, 0, 0);
-],[
-       AC_DEFINE(JOURNAL_START_HAS_3ARGS, 1, [ext4_journal_start takes 3 arguments])
+AC_DEFUN([LB_SRC_EXT4_JOURNAL_START_3ARGS], [
+       LB2_LINUX_TEST_SRC([ext4_journal_start], [
+               #include <linux/fs.h>
+               #include "$EXT4_SRC_DIR/ext4_jbd2.h"
+       ],[
+               ext4_journal_start(NULL, 0, 0);
+       ],[],[],[__ext4_journal_start_sb])
 ])
+AC_DEFUN([LB_EXT4_JOURNAL_START_3ARGS], [
+       AC_MSG_CHECKING([if ext4_journal_start takes 3 arguments])
+       LB2_LINUX_TEST_RESULT([ext4_journal_start], [
+               AC_DEFINE(JOURNAL_START_HAS_3ARGS, 1,
+                       [ext4_journal_start takes 3 arguments])
+       ])
 ]) # LB_EXT4_JOURNAL_START_3ARGS
 
 #
@@ -202,27 +219,32 @@ ext4_journal_start, [
 # 3.18 ext4_bread has 4 arguments
 # NOTE: It may not be exported for modules, use a positive compiler test here.
 #
-AC_DEFUN([LB_EXT4_BREAD_4ARGS], [
-LB_CHECK_COMPILE([if ext4_bread takes 4 arguments],
-ext4_bread, [
-       #include <linux/fs.h>
-       #include "$EXT4_SRC_DIR/ext4.h"
-
-       struct buffer_head *ext4_bread(handle_t *handle, struct inode *inode,
-                                      ext4_lblk_t block, int map_flags)
-       {
-               struct buffer_head *bh = NULL;
-               (void)handle;
-               (void)inode;
-               (void)block;
-               (void)map_flags;
-               return bh;
-       }
-],[
-       ext4_bread(NULL, NULL, 0, 0);
-],[
-       AC_DEFINE(HAVE_EXT4_BREAD_4ARGS, 1, [ext4_bread takes 4 arguments])
+AC_DEFUN([LB_SRC_EXT4_BREAD_4ARGS], [
+       LB2_LINUX_TEST_SRC([ext4_bread], [
+               #include <linux/fs.h>
+               #include "$EXT4_SRC_DIR/ext4.h"
+
+               struct buffer_head *ext4_bread(handle_t *handle,
+                                              struct inode *inode,
+                                              ext4_lblk_t block, int map_flags)
+               {
+                       struct buffer_head *bh = NULL;
+                       (void)handle;
+                       (void)inode;
+                       (void)block;
+                       (void)map_flags;
+                       return bh;
+               }
+       ],[
+               ext4_bread(NULL, NULL, 0, 0);
+       ],[],[],[ext4_bread])
 ])
+AC_DEFUN([LB_EXT4_BREAD_4ARGS], [
+       AC_MSG_CHECKING([if ext4_bread takes 4 arguments])
+       LB2_LINUX_TEST_RESULT([ext4_bread], [
+               AC_DEFINE(HAVE_EXT4_BREAD_4ARGS, 1,
+                       [ext4_bread takes 4 arguments])
+       ])
 ]) # LB_EXT4_BREAD_4ARGS
 
 #
@@ -230,20 +252,24 @@ ext4_bread, [
 #
 # in linux 4.4 i_dqout is in ext4_inode_info, not in struct inode
 #
-AC_DEFUN([LB_EXT4_HAVE_INFO_DQUOT], [
-LB_CHECK_COMPILE([if i_dquot is in ext4_inode_info],
-ext4_info_dquot, [
-       #include <linux/fs.h>
-       #include <linux/quota.h>
-       #include "$EXT4_SRC_DIR/ext4.h"
-],[
-       struct ext4_inode_info in;
-       struct dquot *dq;
+AC_DEFUN([LB_SRC_EXT4_HAVE_INFO_DQUOT], [
+       LB2_LINUX_TEST_SRC([ext4_info_dquot], [
+               #include <linux/fs.h>
+               #include <linux/quota.h>
+               #include "$EXT4_SRC_DIR/ext4.h"
+       ],[
+               struct ext4_inode_info in;
+               struct dquot *dq;
 
-       dq = in.i_dquot[0];
-],[
-       AC_DEFINE(HAVE_EXT4_INFO_DQUOT, 1, [i_dquot is in ext4_inode_info])
+               dq = in.i_dquot[0];
+       ])
 ])
+AC_DEFUN([LB_EXT4_HAVE_INFO_DQUOT], [
+       AC_MSG_CHECKING([if i_dquot is in ext4_inode_info])
+       LB2_LINUX_TEST_RESULT([ext4_info_dquot], [
+               AC_DEFINE(HAVE_EXT4_INFO_DQUOT, 1,
+                       [i_dquot is in ext4_inode_info])
+       ])
 ]) # LB_EXT4_HAVE_INFO_DQUOT
 
 #
@@ -257,29 +283,33 @@ ext4_info_dquot, [
 # Otherwise i_crypy_info is in struct inode, we need to check kernel
 # config option to determine that.
 #
-AC_DEFUN([LB_EXT4_HAVE_I_CRYPT_INFO], [
-LB_CHECK_COMPILE([if i_crypt_info is in ext4_inode_info],
-ext4_i_crypt_info, [
-       #define CONFIG_EXT4_FS_ENCRYPTION 1
-       #include <linux/fs.h>
-       #include "$EXT4_SRC_DIR/ext4.h"
-],[
-       struct ext4_inode_info in;
+AC_DEFUN([LB_SRC_EXT4_HAVE_I_CRYPT_INFO], [
+       LB2_SRC_CHECK_CONFIG([EXT4_FS_ENCRYPTION])
+       LB2_LINUX_TEST_SRC([ext4_i_crypt_info], [
+               #define CONFIG_EXT4_FS_ENCRYPTION 1
+               #include <linux/fs.h>
+               #include "$EXT4_SRC_DIR/ext4.h"
+       ],[
+               struct ext4_inode_info in;
 
-       in.i_crypt_info = NULL;
-],[
-       AC_DEFINE(
-               CONFIG_LDISKFS_FS_ENCRYPTION, 1,
-               [enable encryption for ldiskfs]
-       )
-],[
-       LB_CHECK_CONFIG([EXT4_FS_ENCRYPTION],[
-               AC_DEFINE(
-                       CONFIG_LDISKFS_FS_ENCRYPTION, 1,
-                       [enable encryption for ldiskfs]
-               )
+               in.i_crypt_info = NULL;
        ])
 ])
+AC_DEFUN([LB_EXT4_HAVE_I_CRYPT_INFO], [
+       AC_MSG_CHECKING([if i_crypt_info is in ext4_inode_info])
+       LB2_LINUX_TEST_RESULT([ext4_i_crypt_info], [
+               AC_DEFINE(CONFIG_LDISKFS_FS_ENCRYPTION, 1,
+                       [enable encryption for ldiskfs])
+               test_have_i_crypt_info=yes
+       ],[
+               test_have_i_crypt_info=no
+       ])
+       AS_IF([test x$test_have_i_crypt_info = xno], [
+               LB2_TEST_CHECK_CONFIG([EXT4_FS_ENCRYPTION],[
+                       AC_DEFINE(CONFIG_LDISKFS_FS_ENCRYPTION, 1,
+                               [enable encryption for ldiskfs])
+               ])
+       ])
 ]) # LB_EXT4_HAVE_I_CRYPT_INFO
 
 #
@@ -292,21 +322,21 @@ ext4_i_crypt_info, [
 # has at least requested amount of credits available, and possibly
 # restarting transaction if needed.
 #
-AC_DEFUN([LB_LDISKFS_JOURNAL_ENSURE_CREDITS], [
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_CHECK_COMPILE([if 'ext4_journal_ensure_credits' exists],
-ext4_journal_ensure_credits, [
-       #include "$EXT4_SRC_DIR/ext4_jbd2.h"
-       int __ext4_journal_ensure_credits(handle_t *handle, int check_cred,
-               int extend_cred, int revoke_cred) { return 0; }
-],[
-       ext4_journal_ensure_credits(NULL, 0, 0);
-],[
-       AC_DEFINE(HAVE_LDISKFS_JOURNAL_ENSURE_CREDITS, 1,
-               ['ext4_journal_ensure_credits' exists])
+AC_DEFUN([LB_SRC_LDISKFS_JOURNAL_ENSURE_CREDITS], [
+       LB2_LINUX_TEST_SRC([ext4_journal_ensure_credits], [
+               #include "$EXT4_SRC_DIR/ext4_jbd2.h"
+               int __ext4_journal_ensure_credits(handle_t *handle, int check_cred,
+                       int extend_cred, int revoke_cred) { return 0; }
+       ],[
+               ext4_journal_ensure_credits(NULL, 0, 0);
+       ],[-Werror],[],[__ext4_journal_ensure_credits])
 ])
-EXTRA_KCFLAGS="$tmp_flags"
+AC_DEFUN([LB_LDISKFS_JOURNAL_ENSURE_CREDITS], [
+       AC_MSG_CHECKING([if 'ext4_journal_ensure_credits' exists])
+       LB2_LINUX_TEST_RESULT([ext4_journal_ensure_credits], [
+               AC_DEFINE(HAVE_LDISKFS_JOURNAL_ENSURE_CREDITS, 1,
+                       ['ext4_journal_ensure_credits' exists])
+       ])
 ]) # LB_LDISKFS_JOURNAL_ENSURE_CREDITS
 
 #
@@ -315,21 +345,21 @@ EXTRA_KCFLAGS="$tmp_flags"
 # kernel 4.19 commit 8a363970d1dc38c4ec4ad575c862f776f468d057
 # ext4_iget changed to a macro with 3 args was function with 2 args
 #
-AC_DEFUN([LB_LDISKFS_IGET_HAS_FLAGS_ARG], [
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_CHECK_COMPILE([if ldiskfs_iget takes a flags argument],
-ext4_iget_3args, [
-       #include <linux/fs.h>
-       #include "$EXT4_SRC_DIR/ext4.h"
-],[
-       int f = EXT4_IGET_SPECIAL;
-       (void)f;
-],[
-       AC_DEFINE(HAVE_LDISKFS_IGET_WITH_FLAGS, 1,
-               [if ldiskfs_iget takes a flags argument])
+AC_DEFUN([LB_SRC_LDISKFS_IGET_HAS_FLAGS_ARG], [
+       LB2_LINUX_TEST_SRC([ext4_iget_3args], [
+               #include <linux/fs.h>
+               #include "$EXT4_SRC_DIR/ext4.h"
+       ],[
+               int f = EXT4_IGET_SPECIAL;
+               (void)f;
+       ],[-Werror])
 ])
-EXTRA_KCFLAGS="$tmp_flags"
+AC_DEFUN([LB_LDISKFS_IGET_HAS_FLAGS_ARG], [
+       AC_MSG_CHECKING([if ldiskfs_iget takes a flags argument])
+       LB2_LINUX_TEST_RESULT([ext4_iget_3args], [
+               AC_DEFINE(HAVE_LDISKFS_IGET_WITH_FLAGS, 1,
+                       [if ldiskfs_iget takes a flags argument])
+       ])
 ]) # LB_LDISKFS_IGET_HAS_FLAGS_ARG
 
 #
@@ -378,24 +408,24 @@ AC_DEFUN([LDISKFS_AC_PATCH_PROGRAM], [
 # When the following check succeeds __ext4_find_entry helper is not
 # used.
 #
-AC_DEFUN([LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS], [
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_CHECK_COMPILE([if __ldiskfs_find_entry is available],
-ldiskfs_find_entry_locked, [
-       #include <linux/fs.h>
-       #include "$EXT4_SRC_DIR/ext4.h"
-       #include "$EXT4_SRC_DIR/namei.c"
+AC_DEFUN([LB_SRC_LDISKFS_FIND_ENTRY_LOCKED_EXISTS], [
+       LB2_LINUX_TEST_SRC([ldiskfs_find_entry_locked], [
+               #include <linux/fs.h>
+               #include "$EXT4_SRC_DIR/ext4.h"
+               #include "$EXT4_SRC_DIR/namei.c"
 
-       static int __ext4_find_entry(void) { return 0; }
-],[
-       int x = __ext4_find_entry();
-       (void)x;
-],[
-       AC_DEFINE(HAVE___LDISKFS_FIND_ENTRY, 1,
-               [if __ldiskfs_find_entry is available])
+               static int __ext4_find_entry(void) { return 0; }
+       ],[
+               int x = __ext4_find_entry();
+               (void)x;
+       ],[-Werror])
 ])
-EXTRA_KCFLAGS="$tmp_flags"
+AC_DEFUN([LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS], [
+       AC_MSG_CHECKING([if __ldiskfs_find_entry is available])
+       LB2_LINUX_TEST_RESULT([ldiskfs_find_entry_locked], [
+               AC_DEFINE(HAVE___LDISKFS_FIND_ENTRY, 1,
+                       [if __ldiskfs_find_entry is available])
+       ])
 ]) # LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS
 
 #
@@ -404,31 +434,21 @@ EXTRA_KCFLAGS="$tmp_flags"
 # kernel 5.2 commit 8a363970d1dc38c4ec4ad575c862f776f468d057
 # ext4fs_dirhash UNICODE support
 #
-AC_DEFUN([LB_LDISKFSFS_DIRHASH_WANTS_DIR], [
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_CHECK_COMPILE([if ldiskfsfs_dirhash takes an inode argument],
-ext4fs_dirhash, [
-       #include <linux/fs.h>
-       #include "$EXT4_SRC_DIR/ext4.h"
-
-       int ext4fs_dirhash(const struct inode *dir, const char *name, int len,
-                         struct dx_hash_info *hinfo)
-       {
-               (void)dir;
-               (void)name;
-               (void)len;
-               (void)hinfo;
-               return 0;
-       }
-],[
-       int f = ext4fs_dirhash(NULL, NULL, 0, NULL);
-       (void)f;
-],[
-       AC_DEFINE(HAVE_LDISKFSFS_GETHASH_INODE_ARG, 1,
-               [ldiskfsfs_dirhash takes an inode argument])
+AC_DEFUN([LB_SRC_LDISKFSFS_DIRHASH_WANTS_DIR], [
+       LB2_LINUX_TEST_SRC([ext4fs_dirhash], [
+               #include <linux/fs.h>
+               #include "$EXT4_SRC_DIR/ext4.h"
+       ],[
+               int f = ext4fs_dirhash(NULL, NULL, 0, NULL);
+               (void)f;
+       ],[-Werror],[],[ext4fs_dirhash])
 ])
-EXTRA_KCFLAGS="$tmp_flags"
+AC_DEFUN([LB_LDISKFSFS_DIRHASH_WANTS_DIR], [
+       AC_MSG_CHECKING([if ldiskfsfs_dirhash takes an inode argument])
+       LB2_LINUX_TEST_RESULT([ext4fs_dirhash], [
+               AC_DEFINE(HAVE_LDISKFSFS_DIRHASH_WITH_DIR, 1,
+                       [if ldiskfsfs_dirhash takes an inode argument])
+       ])
 ]) # LB_LDISKFSFS_DIRHASH_WANTS_DIR
 
 #
@@ -437,20 +457,20 @@ EXTRA_KCFLAGS="$tmp_flags"
 # kernel 5.5 commit 933f1c1e0b75bbc29730eef07c9e196c6dfd37e5
 # jbd2: Reserve space for revoke descriptor blocks
 #
-AC_DEFUN([LB_JBD2_H_TOTAL_CREDITS], [
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_CHECK_COMPILE([if struct jbd2_journal_handle has h_total_credits member],
-handle_t_h_revoke_credits, [
-       #include <linux/jbd2.h>
-],[
-       int x = offsetof(struct jbd2_journal_handle, h_total_credits);
-       (void)x;
-],[
-       AC_DEFINE(HAVE_JOURNAL_TOTAL_CREDITS, 1,
-               [struct jbd2_journal_handle has h_total_credits member])
+AC_DEFUN([LB_SRC_JBD2_H_TOTAL_CREDITS], [
+       LB2_LINUX_TEST_SRC([handle_t_h_revoke_credits], [
+               #include <linux/jbd2.h>
+       ],[
+               int x = offsetof(struct jbd2_journal_handle, h_total_credits);
+               (void)x;
+       ],[-Werror])
 ])
-EXTRA_KCFLAGS="$tmp_flags"
+AC_DEFUN([LB_JBD2_H_TOTAL_CREDITS], [
+       AC_MSG_CHECKING([if struct jbd2_journal_handle has h_total_credits member])
+       LB2_LINUX_TEST_RESULT([handle_t_h_revoke_credits], [
+               AC_DEFINE(HAVE_JOURNAL_TOTAL_CREDITS, 1,
+                       [struct jbd2_journal_handle has h_total_credits member])
+       ])
 ]) # LB_JBD2_H_TOTAL_CREDITS
 
 #
@@ -498,21 +518,21 @@ AC_DEFUN([LB_EXT4_INC_DEC_COUNT_2ARGS], [
 # Linux commit v5.10-rc2-9-gede7dc7fa0af
 #  jbd2: rename j_maxlen to j_total_len and add jbd2_journal_max_txn_bufs
 #
-AC_DEFUN([LB_JBD2_JOURNAL_GET_MAX_TXN_BUFS], [
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_CHECK_COMPILE([if jbd2_journal_get_max_txn_bufs is available],
-jbd2_journal_get_max_txn_bufs, [
-       #include <linux/jbd2.h>
-],[
-       journal_t *journal = NULL;
-       int x = jbd2_journal_get_max_txn_bufs(journal);
-       (void)x;
-],[
-       AC_DEFINE(HAVE_JBD2_JOURNAL_GET_MAX_TXN_BUFS, 1,
-               [if jbd2_journal_get_max_txn_bufs is available])
+AC_DEFUN([LB_SRC_JBD2_JOURNAL_GET_MAX_TXN_BUFS], [
+       LB2_LINUX_TEST_SRC([jbd2_journal_get_max_txn_bufs], [
+               #include <linux/jbd2.h>
+       ],[
+               journal_t *journal = NULL;
+               int x = jbd2_journal_get_max_txn_bufs(journal);
+               (void)x;
+       ],[-Werror],[],[])
 ])
-EXTRA_KCFLAGS="$tmp_flags"
+AC_DEFUN([LB_JBD2_JOURNAL_GET_MAX_TXN_BUFS], [
+       AC_MSG_CHECKING([if jbd2_journal_get_max_txn_bufs is available])
+       LB2_LINUX_TEST_RESULT([jbd2_journal_get_max_txn_bufs], [
+               AC_DEFINE(HAVE_JBD2_JOURNAL_GET_MAX_TXN_BUFS, 1,
+                       [if jbd2_journal_get_max_txn_bufs is available])
+       ])
 ]) # LB_JBD2_JOURNAL_GET_MAX_TXN_BUFS
 
 #
@@ -558,19 +578,8 @@ AS_IF([test x$enable_ldiskfs != xno],[
 
        LDISKFS_LINUX_SERIES
        LDISKFS_AC_PATCH_PROGRAM
-       LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
-       LB_EXT4_JOURNAL_START_3ARGS
-       LB_EXT4_BREAD_4ARGS
-       LB_EXT4_HAVE_INFO_DQUOT
-       LB_EXT4_HAVE_I_CRYPT_INFO
-       LB_LDISKFS_JOURNAL_ENSURE_CREDITS
-       LB_LDISKFS_IGET_HAS_FLAGS_ARG
-       LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS
-       LB_LDISKFSFS_DIRHASH_WANTS_DIR
-       LB_JBD2_H_TOTAL_CREDITS
        LB_EXT4_GET_BLOCKS_KEEP_SIZE
        LB_EXT4_INC_DEC_COUNT_2ARGS
-       LB_JBD2_JOURNAL_GET_MAX_TXN_BUFS
        AC_DEFINE(CONFIG_LDISKFS_FS_POSIX_ACL, 1, [posix acls for ldiskfs])
        AC_DEFINE(CONFIG_LDISKFS_FS_SECURITY, 1, [fs security for ldiskfs])
        AC_DEFINE(CONFIG_LDISKFS_FS_XATTR, 1, [extened attributes for ldiskfs])
@@ -587,9 +596,42 @@ AC_MSG_RESULT([$enable_ldiskfs])
 AM_CONDITIONAL([LDISKFS_ENABLED], [test x$enable_ldiskfs = xyes])
 ]) # LB_CONFIG_LDISKFS
 
-
-AC_DEFUN([LB_EXT4_SRC_DIR_SRC], [])
-AC_DEFUN([LB_EXT4_SRC_DIR_RESULTS], [])
+AC_DEFUN([LB_KABI_LDISKFS], [AS_IF([test x$enable_ldiskfs != xno],[
+       AC_DEFUN([LB_EXT4_LDISKFS_TESTS],[
+               LB_SRC_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
+               LB_SRC_EXT4_JOURNAL_START_3ARGS
+               LB_SRC_EXT4_BREAD_4ARGS
+               LB_SRC_EXT4_HAVE_INFO_DQUOT
+               LB_SRC_EXT4_HAVE_I_CRYPT_INFO
+               LB_SRC_LDISKFS_JOURNAL_ENSURE_CREDITS
+               LB_SRC_LDISKFS_IGET_HAS_FLAGS_ARG
+               LB_SRC_LDISKFS_FIND_ENTRY_LOCKED_EXISTS
+               LB_SRC_LDISKFSFS_DIRHASH_WANTS_DIR
+               LB_SRC_JBD2_H_TOTAL_CREDITS
+               LB_SRC_JBD2_JOURNAL_GET_MAX_TXN_BUFS
+               LB2_SRC_CHECK_CONFIG_IM([FS_ENCRYPTION])
+
+               LB2_LINUX_TEST_COMPILE_ALL([ldiskfs],
+                       [for available ldiskfs ext4 interfaces])
+       ])
+       AC_DEFUN([LB_EXT4_LDISKFS_CHECKS], [
+               LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
+               LB_EXT4_JOURNAL_START_3ARGS
+               LB_EXT4_BREAD_4ARGS
+               LB_EXT4_HAVE_INFO_DQUOT
+               LB_EXT4_HAVE_I_CRYPT_INFO
+               LB_LDISKFS_JOURNAL_ENSURE_CREDITS
+               LB_LDISKFS_IGET_HAS_FLAGS_ARG
+               LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS
+               LB_LDISKFSFS_DIRHASH_WANTS_DIR
+               LB_JBD2_H_TOTAL_CREDITS
+               LB_JBD2_JOURNAL_GET_MAX_TXN_BUFS
+               LB2_TEST_CHECK_CONFIG_IM([FS_ENCRYPTION], [
+                       EXT4_CRYPTO=],[
+                       EXT4_CRYPTO='%/crypto.c'])
+       ])
+       AC_SUBST(EXT4_CRYPTO)
+])])
 
 #
 # LB_VALIDATE_EXT4_SRC_DIR
@@ -635,12 +677,12 @@ and kernel-debuginfo-common-<arch> packages are installed.
 ]) # LB_VALIDATE_EXT4_SRC_DIR
 
 #
-# LB_EXT4_SRC_DIR
+# LB_EXT4_SOURCE_PATH
 #
 # Determine the location of the ext4 source code.  It it required
 # for several configure tests and to build ldiskfs.
 #
-AC_DEFUN([LB_EXT4_SRC_DIR], [
+AC_DEFUN([LB_EXT4_SOURCE_PATH], [
 AC_MSG_CHECKING([ext4 source directory])
 # Kernel ext source located with devel headers
 linux_src=$LINUX
@@ -668,7 +710,7 @@ AC_MSG_RESULT([$EXT4_SRC_DIR])
 AC_SUBST(EXT4_SRC_DIR)
 
 LB_VALIDATE_EXT4_SRC_DIR
-]) # LB_EXT4_SRC_DIR
+]) # LB_EXT4_SOURCE_PATH
 
 #
 # LB_DEFINE_E2FSPROGS_NAMES
index 5092648..2834c2c 100644 (file)
@@ -793,6 +793,10 @@ ifneq (\$(SINC),)
 LINUXINCLUDE += -I\$(SINC)
 else
 LINUXINCLUDE += -I\$(ZINC)/include/spl
+LINUXINCLUDE += -I\$(ZINC)/include/zfs
+LINUXINCLUDE += -I\$(ZINC)/include/os/linux/spl
+LINUXINCLUDE += -I\$(ZINC)/include/os/linux/zfs
+LINUXINCLUDE += -I\$(ZINC)/include/os/linux/kernel
 endif
 endif
 LINUXINCLUDE += -include $CONFIG_INCLUDE
index d8147f8..bf19db5 100644 (file)
@@ -1,61 +1,75 @@
-dnl #
-dnl # Supported configure options.  When no options are specified support
-dnl # for ZFS OSDs will be autodetected assuming server support is enabled.
-dnl # If the ZFS OSD cannot be built support for it is disabled and a
-dnl # warning is issued but the configure process is allowed to continue.
-dnl #
-dnl # --without-zfs   - Disable zfs support.
-dnl # --with-zfs=no
-dnl #
-dnl # --with-zfs      - Enable zfs support and attempt to autodetect the zfs
-dnl # --with-zfs=yes    headers in one of the following places.  Because zfs
-dnl #                   support was explicitly required if the headers cannot
-dnl #                   be located it is treated as a fatal error.
-dnl #
-dnl #                       * /var/lib/dkms/zfs/${VERSION}/source
-dnl #                       * /usr/src/zfs-${VERSION}/${LINUXRELEASE}
-dnl #                       * /usr/src/zfs-${VERSION}
-dnl #                       * ../zfs/
-dnl #                       * $LINUX/zfs
-dnl #
-dnl # --with-zfs-devel=path
-dnl #                 - User provided directory where zfs development headers
-dnl #                   are located. This option is typically used when user
-dnl #                   uses rpm2cpio to unpack src rpm.
-dnl #                   Assumes layout of:
-dnl #                     ${zfs-devel-path}/usr/include/libzfs
-dnl #                     ${zfs-devel-path}/usr/include/libspl
-dnl #                     ${zfs-devel-path}/lib64/libzfs.so.* or
-dnl #                     ${zfs-devel-path}/lib/libzfs.so.*
-dnl #
-dnl # --with-zfs=path - Enable zfs support and use the zfs headers in the
-dnl #                   provided path.  No autodetection is performed and
-dnl #                   if no headers are found this is a fatal error.
-dnl #
-dnl # --with-zfs-obj  - When zfs support is enabled the object directory
-dnl #                   will be based on the --with-zfs directory.  If this
-dnl #                   is detected incorrectly it can be explicitly
-dnl #                   specified using this option.
-dnl #
-dnl # --without-spl   - Disable spl support.
-dnl # --with-spl=no
-dnl #
-dnl # --with-spl      - Enable spl support and attempt to autodetect the spl
-dnl # --with-spl=yes    headers in one of the following places in this order:
-dnl #                   * /var/lib/dkms/spl/${VERSION}/source
-dnl #                   * /usr/src/spl-${VERSION}/${LINUXRELEASE}
-dnl #                   * /usr/src/spl-${VERSION}
-dnl #                   * ../spl/
-dnl #                   * $LINUX/spl
-dnl #
-dnl # --with-spl=path - Enable spl support and use the spl headers in the
-dnl #                   provided path.  No autodetection is performed.
-dnl #
-dnl # --with-spl-obj  - When spl support is enabled the object directory
-dnl #                   will be based on the --with-spl directory.  If this
-dnl #                   is detected incorrectly it can be explicitly
-dnl #                   specified using this option.
-dnl #
+# SPDX-License-Identifier: NOASSERTION
+
+#
+# This file is part of Lustre, http://www.lustre.org/
+#
+# config/lustre-build-zfs.m4
+#
+# openZFS OSD related configuration
+#
+
+#
+# Supported configure options.  When no options are specified support
+# for ZFS OSDs will be autodetected assuming server support is enabled.
+# If the ZFS OSD cannot be built support for it is disabled and a
+# warning is issued but the configure process is allowed to continue.
+#
+# --without-zfs   - Disable zfs support.
+# --with-zfs=no
+#
+# --with-zfs      - Enable zfs support and attempt to autodetect the zfs
+# --with-zfs=yes    headers in one of the following places.  Because zfs
+#                   support was explicitly required if the headers cannot
+#                   be located it is treated as a fatal error.
+#
+#                       * /var/lib/dkms/zfs/${VERSION}/source
+#                       * /usr/src/zfs-${VERSION}/${LINUXRELEASE}
+#                       * /usr/src/zfs-${VERSION}
+#                       * ../zfs/
+#                       * $LINUX/zfs
+#
+# --with-zfs-devel=path
+#                 - User provided directory where zfs development headers
+#                   are located. This option is typically used when user
+#                   uses rpm2cpio to unpack src rpm.
+#                   Assumes layout of:
+#                     ${zfs-devel-path}/usr/include/libzfs
+#                     ${zfs-devel-path}/usr/include/libspl
+#                     ${zfs-devel-path}/lib64/libzfs.so.* or
+#                     ${zfs-devel-path}/lib/libzfs.so.*
+#
+# --with-zfs=path - Enable zfs support and use the zfs headers in the
+#                   provided path.  No autodetection is performed and
+#                   if no headers are found this is a fatal error.
+#
+# --with-zfs-obj  - When zfs support is enabled the object directory
+#                   will be based on the --with-zfs directory.  If this
+#                   is detected incorrectly it can be explicitly
+#                   specified using this option.
+#
+# --without-spl   - Disable spl support.
+# --with-spl=no
+#
+# --with-spl      - Enable spl support and attempt to autodetect the spl
+# --with-spl=yes    headers in one of the following places in this order:
+#                   * /var/lib/dkms/spl/${VERSION}/source
+#                   * /usr/src/spl-${VERSION}/${LINUXRELEASE}
+#                   * /usr/src/spl-${VERSION}
+#                   * ../spl/
+#                   * $LINUX/spl
+#
+# --with-spl=path - Enable spl support and use the spl headers in the
+#                   provided path.  No autodetection is performed.
+#
+# --with-spl-obj  - When spl support is enabled the object directory
+#                   will be based on the --with-spl directory.  If this
+#                   is detected incorrectly it can be explicitly
+#                   specified using this option.
+#
+
+#
+# LB_SPL
+#
 AC_DEFUN([LB_SPL], [
        AC_ARG_WITH([spl],
                AS_HELP_STRING([--with-spl=PATH],
@@ -67,10 +81,10 @@ AC_DEFUN([LB_SPL], [
                [Path to spl build objects]),
                [splobj="$withval"])
 
-       dnl #
-       dnl # The existence of spl.release[.in] is used to identify a valid
-       dnl # source directory.  In order of preference:
-       dnl #
+       #
+       # The existence of spl.release[.in] is used to identify a valid
+       # source directory.  In order of preference:
+       #
        splver=$(ls -1 /usr/src/ | grep ^spl- | cut -f2 -d'-' |
                 sort -V | head -n1)
        spldkms="/var/lib/dkms/spl/${splver}"
@@ -102,14 +116,14 @@ AC_DEFUN([LB_SPL], [
                enable_zfs=no
        ])
 
-       dnl #
-       dnl # The existence of the spl_config.h is used to identify a valid
-       dnl # spl object directory.  In many cases the object and source
-       dnl # directory are the same, however the objects may also reside
-       dnl # is a subdirectory named after the kernel version.  When
-       dnl # weak modules are used, the kernel version may not be the
-       dnl # same as the LINUXRELEASE against which we are building lustre.
-       dnl #
+       #
+       # The existence of the spl_config.h is used to identify a valid
+       # spl object directory.  In many cases the object and source
+       # directory are the same, however the objects may also reside
+       # is a subdirectory named after the kernel version.  When
+       # weak modules are used, the kernel version may not be the
+       # same as the LINUXRELEASE against which we are building lustre.
+       #
        AC_MSG_CHECKING([spl build directory])
        AS_IF([test -z "$splobj"], [
                last_spl_obj_dir=$(ls -d ${splsrc}/[[0-9]]*/  2> /dev/null | tail -n 1 | sed 's|/$||')
@@ -135,9 +149,9 @@ AC_DEFUN([LB_SPL], [
                enable_zfs=no
        ])
 
-       dnl #
-       dnl # Verify the source version using SPL_META_VERSION in spl_config.h
-       dnl #
+       #
+       # Verify the source version using SPL_META_VERSION in spl_config.h
+       #
        AS_IF([test x$enable_zfs = xyes], [
                AC_MSG_CHECKING([spl source version])
                AS_IF([fgrep -q SPL_META_VERSION $splobj/spl_config.h], [
@@ -152,9 +166,9 @@ AC_DEFUN([LB_SPL], [
                AC_MSG_RESULT([$splver])
        ])
 
-       dnl #
-       dnl # Verify the modules systems exist by the expect name.
-       dnl #
+       #
+       # Verify the modules systems exist by the expect name.
+       #
        AS_IF([test x$enable_zfs = xyes], [
                AC_MSG_CHECKING([spl file name for module symbols])
                AS_IF([test -r $splobj/$SYMVERFILE], [
@@ -181,18 +195,21 @@ AC_DEFUN([LB_SPL], [
                AC_SUBST(EXTRA_SYMBOLS)
        ])
 
-])
+]) # LB_SPL
 
+#
+# LB_ZFS
+#
 AC_DEFUN([LB_ZFS], [
        AC_ARG_WITH([zfs-obj],
                AS_HELP_STRING([--with-zfs-obj=PATH],
                [Path to zfs build objects]),
                [zfsobj="$withval"])
 
-       dnl #
-       dnl # The existence of zfs.release[.in] is used to identify a valid
-       dnl # source directory.  In order of preference:
-       dnl #
+       #
+       # The existence of zfs.release[.in] is used to identify a valid
+       # source directory.  In order of preference:
+       #
        zfsver=$(ls -1 /usr/src/ | grep ^zfs- | cut -f2 -d'-' |
                 sort -V | head -n1)
        zfsdkms="/var/lib/dkms/zfs/${zfsver}"
@@ -224,14 +241,14 @@ AC_DEFUN([LB_ZFS], [
                enable_zfs=no
        ])
 
-       dnl #
-       dnl # The existence of the zfs_config.h is used to identify a valid
-       dnl # zfs object directory.  In many cases the object and source
-       dnl # directory are the same, however the objects may also reside
-       dnl # is a subdirectory named after the kernel version.  When
-       dnl # weak modules are used, the kernel version may not be the
-       dnl # same as the LINUXRELEASE against which we are building lustre.
-       dnl #
+       #
+       # The existence of the zfs_config.h is used to identify a valid
+       # zfs object directory.  In many cases the object and source
+       # directory are the same, however the objects may also reside
+       # is a subdirectory named after the kernel version.  When
+       # weak modules are used, the kernel version may not be the
+       # same as the LINUXRELEASE against which we are building lustre.
+       #
        AC_MSG_CHECKING([zfs build directory])
        AS_IF([test -z "$zfsobj"], [
                last_zfs_obj_dir=$(ls -d ${zfssrc}/[[0-9]]*/ 2> /dev/null | tail -n 1 | sed 's|/$||')
@@ -257,9 +274,9 @@ AC_DEFUN([LB_ZFS], [
                enable_zfs=no
        ])
 
-       dnl #
-       dnl # Verify the source version using SPL_META_VERSION in spl_config.h
-       dnl #
+       #
+       # Verify the source version using SPL_META_VERSION in spl_config.h
+       #
        AS_IF([test x$enable_zfs = xyes], [
                AC_MSG_CHECKING([zfs source version])
                AS_IF([fgrep -q ZFS_META_VERSION $zfsobj/zfs_config.h], [
@@ -274,9 +291,9 @@ AC_DEFUN([LB_ZFS], [
                AC_MSG_RESULT([$zfsver])
        ])
 
-       dnl #
-       dnl # Verify the modules systems exist by the expect name.
-       dnl #
+       #
+       # Verify the modules systems exist by the expect name.
+       #
        AS_IF([test x$enable_zfs = xyes], [
                AC_MSG_CHECKING([zfs file name for module symbols])
                AS_IF([test -r $zfsobj/$SYMVERFILE], [
@@ -303,8 +320,11 @@ AC_DEFUN([LB_ZFS], [
                AC_SUBST(EXTRA_SYMBOLS)
        ])
 
-])
+]) # LB_ZFS
 
+#
+# LB_ZFS_DEVEL
+#
 AC_DEFUN([LB_ZFS_DEVEL], [
        AC_ARG_WITH([zfs-devel],
                [AS_HELP_STRING([--with-zfs-devel=PATH],
@@ -321,12 +341,15 @@ AC_DEFUN([LB_ZFS_DEVEL], [
                ])
        ])
        AC_MSG_RESULT([$zfsinc])
-])
+]) # LB_ZFS_DEVEL
 
+#
+# LB_ZFS_USER
+#
 AC_DEFUN([LB_ZFS_USER], [
-       dnl #
-       dnl # Detect user space zfs development headers.
-       dnl #
+       #
+       # Detect user space zfs development headers.
+       #
        AC_MSG_CHECKING([zfs devel headers])
        AS_IF([test -z "${zfsinc}"], [
                AS_IF([test -e "${zfssrc}/include/libzfs.h" && test -e "${zfssrc}/lib/libspl/include"], [
@@ -349,8 +372,100 @@ AC_DEFUN([LB_ZFS_USER], [
        AC_SUBST(ZFS_LIBZFS_INCLUDE)
        AC_SUBST(ZFS_LIBZFS_LDFLAGS)
        AC_SUBST(ZFS_LIBZFS_LIBS)
+]) # LB_ZFS_USER
+
+AC_DEFUN([LZ_KABI_ZFS], [
+       #
+       ## LZ_ZFS_NVLIST_CONST_INTERFACES
+       #
+       # ZFS 2.2.0 nvpair now returns and expects constant args
+       #
+       AC_DEFUN([LZ_SRC_ZFS_NVLIST_CONST_INTERFACES], [
+               LB2_LINUX_TEST_SRC([zfs_nvpair_const], [
+                       #include <sys/nvpair.h>
+               ],[
+                       nvpair_t *nvp = NULL;
+                       nvlist_t *nvl = NULL;
+                       const char *name = nvpair_name(nvp);
+                       nvlist_lookup_string(nvl, name, &name);
+                       nvlist_lookup_nvlist(nvl, name, &nvl);
+               ],[-Werror],[],[])
+       ])
+       AC_DEFUN([LZ_ZFS_NVLIST_CONST_INTERFACES], [
+               AC_MSG_CHECKING([if ZFS nvlist interfaces require const])
+               LB2_LINUX_TEST_RESULT([zfs_nvpair_const], [
+                       AC_DEFINE(HAVE_ZFS_NVLIST_CONST_INTERFACES, 1,
+                           [ZFS nvlist interfaces require const])
+               ])
+       ]) # LZ_ZFS_NVLIST_CONST_INTERFACES
+
+       #
+       ## LZ_ZFS_ARC_PRUNE_FUNC_UINT64
+       #
+       # ZFS 2.2.1 arc_prune_func_t now uses uint64_t for the
+       # first parameter
+       #
+       AC_DEFUN([LZ_SRC_ZFS_ARC_PRUNE_FUNC_UINT64], [
+               LB2_LINUX_TEST_SRC([zfs_arc_prune_func_uint64], [
+                       #include <sys/arc.h>
+               ],[
+                       void arc_prune_func(uint64_t bytes, void *priv) {}
+                       arc_prune_t *arc_p __attribute__ ((unused)) =
+                               arc_add_prune_callback(arc_prune_func, NULL);
+               ],[-Werror],[],[])
+       ])
+       AC_DEFUN([LZ_ZFS_ARC_PRUNE_FUNC_UINT64], [
+               AC_MSG_CHECKING([if ZFS arc_prune_func_t uses uint64_t])
+               LB2_LINUX_TEST_RESULT([zfs_arc_prune_func_uint64], [
+                       AC_DEFINE(HAVE_ZFS_ARC_PRUNE_FUNC_UINT64, 1,
+                               [ZFS arc_prune_func_t uses uint64_t])
+               ])
+       ]) # LZ_ZFS_ARC_PRUNE_FUNC_UINT64
+
+       #
+       ## LZ_DMU_BUF_WILL_FILL_3ARGS
+       #
+       # ZFS 2.2.3:
+       #   Adds a boolean_t to dmu_buf_will_fill() and dmu_buf_fill_done()
+       #
+       # introduced in zfs commit 9b1677fb5a0824b5f4b425c0ee950aaecf252029
+       #   dmu: Allow buffer fills to fail
+       #
+       AC_DEFUN([LZ_SRC_DMU_BUF_WILL_FILL_3ARGS], [
+               LB2_LINUX_TEST_SRC([dmu_buf_will_fill_3args], [
+                       #include <sys/dbuf.h>
+               ],[
+                       dmu_buf_t *db = NULL;
+                       dmu_tx_t *tx = NULL;
+                       dmu_buf_will_fill(db, tx, B_TRUE);
+               ],[-Werror],[],[])
+       ])
+       AC_DEFUN([LZ_DMU_BUF_WILL_FILL_3ARGS], [
+               AC_MSG_CHECKING([if dmu_buf_will_fill() has 3 args])
+               LB2_LINUX_TEST_RESULT([dmu_buf_will_fill_3args], [
+                       AC_DEFINE(HAVE_DMU_BUF_WILL_FILL_3ARGS, 1,
+                                [dmu_buf_will_fill() has 3 args])
+                       AC_DEFINE(LL_BFILL, [, B_FALSE], [buf bool arg])
+               ],[
+                       AC_DEFINE(LL_BFILL, [], [buf bool arg])
+               ])
+       ]) # LZ_DMU_BUF_WILL_FILL_3ARGS
+
+       AC_DEFUN([LZ_KABI_ZFS_TESTS], [
+               LZ_SRC_ZFS_NVLIST_CONST_INTERFACES
+               LZ_SRC_ZFS_ARC_PRUNE_FUNC_UINT64
+               LZ_SRC_DMU_BUF_WILL_FILL_3ARGS
+       ])
+       AC_DEFUN([LZ_KABI_ZFS_CHECKS], [
+               LZ_ZFS_NVLIST_CONST_INTERFACES
+               LZ_ZFS_ARC_PRUNE_FUNC_UINT64
+               LZ_DMU_BUF_WILL_FILL_3ARGS
+       ])
 ])
 
+#
+# LB_CONFIG_ZFS
+#
 AC_DEFUN([LB_CONFIG_ZFS], [
        AC_ARG_WITH([zfs],
                [AS_HELP_STRING([--with-zfs=PATH], [Path to zfs source])],
@@ -391,9 +506,9 @@ AC_DEFUN([LB_CONFIG_ZFS], [
                LB_ZFS_DEVEL
                LB_ZFS_USER
 
-               dnl #
-               dnl # Define zfs source code version
-               dnl #
+               #
+               # Define zfs source code version
+               #
                ZFS_MAJOR=$(echo $zfsver | sed -re ['s/([0-9]+)\.([0-9]+)\.([0-9]+)(\.([0-9]+))?.*/\1/'])
                ZFS_MINOR=$(echo $zfsver | sed -re ['s/([0-9]+)\.([0-9]+)\.([0-9]+)(\.([0-9]+))?.*/\2/'])
                ZFS_PATCH=$(echo $zfsver | sed -re ['s/([0-9]+)\.([0-9]+)\.([0-9]+)(\.([0-9]+))?.*/\3/'])
@@ -405,9 +520,9 @@ AC_DEFUN([LB_CONFIG_ZFS], [
                AC_DEFINE_UNQUOTED([ZFS_PATCH], [$ZFS_PATCH], [zfs patch version])
                AC_DEFINE_UNQUOTED([ZFS_FIX],   [$ZFS_FIX],   [zfs fix version])
 
-               dnl #
-               dnl # SPL is only needed if ZFS is prior to 0.8.0
-               dnl #
+               #
+               # SPL is only needed if ZFS is prior to 0.8.0
+               #
                AS_IF([test x$enable_modules = xyes && test -n "$ZFS_MAJOR" &&
                            test $ZFS_MAJOR -eq 0 && test $ZFS_MINOR -lt 8], [
                        LB_SPL
@@ -415,10 +530,10 @@ AC_DEFUN([LB_CONFIG_ZFS], [
                        enable_spl=no
                ])
 
-               dnl #
-               dnl # enable_zfs will be set to no in LB_SPL or LB_ZFS if
-               dnl # one of more of the build requirements is not met.
-               dnl #
+               #
+               # enable_zfs will be set to no in LB_SPL or LB_ZFS if
+               # one of more of the build requirements is not met.
+               #
                AS_IF([test x$enable_zfs = xyes], [
                        AC_DEFINE(HAVE_ZFS_OSD, 1, Enable zfs osd)
                ],[
@@ -443,391 +558,6 @@ your distribution.
                        ])
                ])
        ])
-
-
-       AS_IF([test "x$enable_zfs" = xyes], [
-               LB_CHECK_COMPILE([if zfs defines dsl_pool_config_enter/exit],
-               dsl_pool_config_enter, [
-                       #include <sys/dsl_pool.h>
-               ],[
-                       dsl_pool_config_enter(NULL, FTAG);
-               ],[
-                       AC_DEFINE(HAVE_DSL_POOL_CONFIG, 1,
-                               [Have dsl_pool_config_enter/exit in ZFS])
-               ],[
-                       AC_MSG_ERROR([dsl_pool_config_enter/exit do not exist])
-               ])
-               LB_CHECK_COMPILE([if zfs defines zio_buf_alloc/free],
-               zio_buf_alloc, [
-                       #include <sys/zio.h>
-               ],[
-                       void *ptr = zio_buf_alloc(1024);
-
-                       (void)ptr;
-               ],[
-                       AC_DEFINE(HAVE_ZIO_BUF_ALLOC, 1,
-                               [Have zio_buf_alloc/free in ZFS])
-               ],[
-                       AC_MSG_ERROR([zio_buf_alloc/free do not exist])
-               ])
-               LB_CHECK_COMPILE([if zfs defines spa_maxblocksize],
-               spa_maxblocksize, [
-                       #include <sys/spa.h>
-               ],[
-                       spa_t *spa = NULL;
-                       int size = spa_maxblocksize(spa);
-
-                       (void)size;
-               ],[
-                       AC_DEFINE(HAVE_SPA_MAXBLOCKSIZE, 1,
-                               [Have spa_maxblocksize in ZFS])
-               ],[
-                       AC_MSG_ERROR([spa_maxblocksize does not exist])
-               ])
-
-               dnl #
-               dnl # ZFS 0.7.x adds support for large dnodes.  This
-               dnl # allows Lustre to optionally specify the size of a
-               dnl # dnode which ZFS will then use to store metadata such
-               dnl # as xattrs. The default dnode size specified by the
-               dnl # 'dnodesize' dataset property will be used unless a
-               dnl # specific value is provided.
-               dnl #
-               LB_CHECK_COMPILE([if zfs defines dmu_object_alloc_dnsize],
-               dmu_object_alloc_dnsize, [
-                       #include <sys/dmu.h>
-                       #include <sys/dnode.h>
-               ],[
-                       objset_t *os = NULL;
-                       dmu_object_type_t objtype = DMU_OT_NONE;
-                       int blocksize = 0;
-                       dmu_object_type_t bonustype = DMU_OT_SA;
-                       int dnodesize = DNODE_MIN_SIZE;
-                       dmu_tx_t *tx = NULL;
-                       uint64_t id;
-
-                       id = dmu_object_alloc_dnsize(os, objtype, blocksize,
-                                                    bonustype,
-                                                    DN_BONUS_SIZE(dnodesize),
-                                                    dnodesize, tx);
-               ],[
-                       AC_DEFINE(HAVE_DMU_OBJECT_ALLOC_DNSIZE, 1,
-                               [Have dmu_object_alloc_dnsize in ZFS])
-               ],[
-                       AC_MSG_ERROR([dmu_object_alloc_dnsize does not exist])
-               ])
-
-               dnl #
-               dnl # ZFS 0.7.x extended dmu_prefetch() to take an additional
-               dnl # 'level' and 'priority' argument.  Use a level of 0 and a
-               dnl # priority of ZIO_PRIORITY_SYNC_READ to replicate the
-               dnl # behavior of the four argument version.
-               dnl #
-               LB_CHECK_COMPILE([if ZFS has 'dmu_prefetch' with 6 args],
-               dmu_prefetch, [
-                       #include <sys/dmu.h>
-               ],[
-                       objset_t *os = NULL;
-                       uint64_t object = 0;
-                       int64_t level = 0;
-                       uint64_t offset = 0;
-                       uint64_t len = 0;
-                       enum zio_priority pri = ZIO_PRIORITY_SYNC_READ;
-
-                       dmu_prefetch(os, object, level, offset, len, pri);
-               ],[
-                       AC_DEFINE(HAVE_DMU_PREFETCH_6ARG, 1,
-                               [Have 6 argument dmu_pretch in ZFS])
-               ],[
-                       AC_MSG_ERROR([6 argument dmu_pretch does not exist])
-               ])
-               dnl #
-               dnl # ZFS 0.7.0 feature: SPA_FEATURE_USEROBJ_ACCOUNTING
-               dnl #
-               LB_CHECK_COMPILE([if ZFS has native dnode accounting supported],
-               dmu_objset_userobjused_enabled, [
-                       #include <sys/dmu_objset.h>
-               ],[
-                       dmu_objset_userobjused_enabled(NULL);
-               ],[
-                       AC_DEFINE(HAVE_DMU_USEROBJ_ACCOUNTING, 1,
-                               [Have native dnode accounting in ZFS])
-               ],[
-                       AC_MSG_ERROR([native dnode accounting does not exist])
-               ])
-               dnl #
-               dnl # ZFS 0.7.0 feature: MULTIHOST
-               dnl #
-               LB_CHECK_COMPILE([if ZFS has multihost protection],
-               spa_multihost, [
-                       #include <sys/fs/zfs.h>
-               ],[
-                       zpool_prop_t prop = ZPOOL_PROP_MULTIHOST;
-
-                       (void)prop;
-               ],[
-                       AC_DEFINE(HAVE_ZFS_MULTIHOST, 1,
-                               [Have multihost protection in ZFS])
-               ],[
-                       AC_MSG_ERROR([multihost protection does not exist])
-               ])
-               dnl #
-               dnl # ZFS 0.7.x adds new method zap_lookup_by_dnode
-               dnl #
-               LB_CHECK_COMPILE([if ZFS has 'zap_lookup_by_dnode'],
-               zap_lookup_by_dnode, [
-                       #include <sys/zap.h>
-                       #include <sys/dnode.h>
-               ],[
-                       dnode_t *dn = NULL;
-                       zap_lookup_by_dnode(dn, NULL, 1, 1, NULL);
-               ],[
-                       AC_DEFINE(HAVE_ZAP_LOOKUP_BY_DNODE, 1,
-                               [Have zap_lookup_by_dnode() in ZFS])
-               ],[
-                       AC_MSG_ERROR([zap_lookup_by_dnode does not exist])
-               ])
-               dnl #
-               dnl # ZFS 0.7.x adds new method zap_add_by_dnode
-               dnl #
-               LB_CHECK_COMPILE([if ZFS has 'zap_add_by_dnode'],
-               zap_add_by_dnode, [
-                       #include <sys/zap.h>
-                       #include <sys/dnode.h>
-               ],[
-                       dnode_t *dn = NULL;
-                       zap_add_by_dnode(dn, NULL, 1, 1, NULL, NULL);
-               ],[
-                       AC_DEFINE(HAVE_ZAP_ADD_BY_DNODE, 1,
-                               [Have zap_add_by_dnode() in ZFS])
-               ],[
-                       AC_MSG_ERROR([zap_add_by_dnode does not exist])
-               ])
-               dnl #
-               dnl # ZFS 0.7.x adds new method zap_remove_by_dnode
-               dnl #
-               LB_CHECK_COMPILE([if ZFS has 'zap_remove_by_dnode'],
-               zap_remove_by_dnode, [
-                       #include <sys/zap.h>
-                       #include <sys/dnode.h>
-               ],[
-                       dnode_t *dn = NULL;
-                       zap_remove_by_dnode(dn, NULL, NULL);
-               ],[
-                       AC_DEFINE(HAVE_ZAP_REMOVE_ADD_BY_DNODE, 1,
-                               [Have zap_remove_by_dnode() in ZFS])
-               ],[
-                       AC_MSG_ERROR([zap_remove_by_dnode does not exist])
-               ])
-               dnl #
-               dnl # ZFS 0.7.x adds new method dmu_tx_hold_zap_by_dnode
-               dnl #
-               LB_CHECK_COMPILE([if ZFS has 'dmu_tx_hold_zap_by_dnode'],
-               dmu_tx_hold_zap_by_dnode, [
-                       #include <sys/zap.h>
-                       #include <sys/dnode.h>
-               ],[
-                       dnode_t *dn = NULL;
-                       dmu_tx_hold_zap_by_dnode(NULL, dn, TRUE, NULL);
-               ],[
-                       AC_DEFINE(HAVE_DMU_TX_HOLD_ZAP_BY_DNODE, 1,
-                               [Have dmu_tx_hold_zap_by_dnode() in ZFS])
-               ],[
-                       AC_MSG_ERROR([dmu_tx_hold_zap_by_dnode does not exist])
-               ])
-               dnl #
-               dnl # ZFS 0.7.x adds new method dmu_tx_hold_write_by_dnode
-               dnl #
-               LB_CHECK_COMPILE([if ZFS has 'dmu_tx_hold_write_by_dnode'],
-               dmu_tx_hold_write_by_dnode, [
-                       #include <sys/zap.h>
-                       #include <sys/dnode.h>
-               ],[
-                       dnode_t *dn = NULL;
-                       dmu_tx_hold_write_by_dnode(NULL, dn, 0, 0);
-               ],[
-                       AC_DEFINE(HAVE_DMU_TX_HOLD_WRITE_BY_DNODE, 1,
-                               [Have dmu_tx_hold_write_by_dnode() in ZFS])
-               ],[
-                       AC_MSG_ERROR([dmu_tx_hold_write_by_dnode does not exist])
-               ])
-               dnl #
-               dnl # ZFS 0.7.x adds new method dmu_write_by_dnode
-               dnl #
-               LB_CHECK_COMPILE([if ZFS has 'dmu_write_by_dnode'],
-               dmu_write_by_dnode, [
-                       #include <sys/zap.h>
-                       #include <sys/dnode.h>
-               ],[
-                       dnode_t *dn = NULL;
-                       dmu_write_by_dnode(dn, 0, 0, NULL, NULL);
-               ],[
-                       AC_DEFINE(HAVE_DMU_WRITE_BY_DNODE, 1,
-                               [Have dmu_write_by_dnode() in ZFS])
-               ],[
-                       AC_MSG_ERROR([dmu_write_by_dnode does not exist])
-               ])
-               dnl #
-               dnl # ZFS 0.7.x adds new method dmu_read_by_dnode
-               dnl #
-               LB_CHECK_COMPILE([if ZFS has 'dmu_read_by_dnode'],
-               dmu_read_by_dnode, [
-                       #include <sys/zap.h>
-                       #include <sys/dnode.h>
-               ],[
-                       dnode_t *dn = NULL;
-                       dmu_read_by_dnode(dn, 0, 0, NULL, 0);
-               ],[
-                       AC_DEFINE(HAVE_DMU_READ_BY_DNODE, 1,
-                               [Have dmu_read_by_dnode() in ZFS])
-               ],[
-                       AC_MSG_ERROR([dmu_read_by_dnode does not exist])
-               ])
-               dnl #
-               dnl # ZFS 0.7.2 adds new method dmu_tx_mark_netfree
-               dnl #
-               LB_CHECK_COMPILE([if ZFS has 'dmu_tx_mark_netfree'],
-               dmu_tx_mark_netfree, [
-                       #include <sys/dmu.h>
-               ],[
-                       dmu_tx_t *tx = NULL;
-                       dmu_tx_mark_netfree(tx);
-               ],[
-                       AC_DEFINE(HAVE_DMU_TX_MARK_NETFREE, 1,
-                               [Have dmu_tx_mark_netfree])
-               ])
-               dnl #
-               dnl # ZFS 0.7.10 changes timestruc_t to inode_timespec_t
-               dnl #
-               LB_CHECK_COMPILE([if SPL has 'inode_timespec_t'],
-               zfs_have_inode_timespec, [
-                       #include <sys/fs/zfs.h>
-               ],[
-                       inode_timespec_t now;
-                       gethrestime(&now);
-               ],[
-                       AC_DEFINE(HAVE_ZFS_INODE_TIMESPEC, 1,
-                               [Have inode_timespec_t])
-               ])
-               dnl # ZFS 0.7.12/0.8.x uses zfs_refcount_add() instead of
-               dnl # refcount_add().  ZFS 2.0 renamed sys/refcount.h to
-               dnl # sys/zfs_refcount.h, rather the add another check to
-               dnl # determine the correct header name include it
-               dnl # indirectly through sys/dnode.h.
-               dnl #
-               LB_CHECK_COMPILE([if ZFS has 'zfs_refcount_add'],
-               zfs_refcount_add, [
-                       #include <sys/dnode.h>
-               ],[
-                       zfs_refcount_add((zfs_refcount_t *) NULL, NULL);
-               ],[
-                       AC_DEFINE(HAVE_ZFS_REFCOUNT_ADD, 1,
-                               [Have zfs_refcount_add])
-               ])
-               dnl #
-               dnl # ZFS 0.8.x changes dmu_objset_own for encryption
-               dnl #
-               LB_CHECK_COMPILE([if ZFS has 'dmu_objset_own' with 6 args],
-               dmu_objset_own, [
-                       #include <sys/dmu_objset.h>
-               ],[
-                       objset_t *os = NULL;
-                       dmu_objset_type_t type = DMU_OST_ANY;
-                       dmu_objset_own(NULL, type, B_FALSE, B_TRUE, FTAG, &os);
-               ],[
-                       AC_DEFINE(HAVE_DMU_OBJSET_OWN_6ARG, 1,
-                               [Have dmu_objset_own() with 6 args])
-               ])
-               dnl #
-               dnl # ZFS 0.8.x changes dmu_objset_disown for encryption
-               dnl #
-               LB_CHECK_COMPILE([if ZFS has 'dmu_objset_disown' with 3 args],
-               dmu_objset_disown, [
-                       #include <sys/dmu_objset.h>
-               ],[
-                       objset_t *os = NULL;
-                       dmu_objset_disown(os, B_TRUE, FTAG);
-               ],[
-                       AC_DEFINE(HAVE_DMU_OBJSET_DISOWN_3ARG, 1,
-                               [Have dmu_objset_disown() with 3 args])
-               ])
-               dnl #
-               dnl # ZFS exports dmu_offet_next
-               dnl #
-               AC_CACHE_CHECK([if ZFS exports 'dmu_offset_next'],
-               [lb_cv_dmu_offset_next], [
-               lb_cv_dmu_offset_next="no"
-               AS_IF([grep -q -E "EXPORT_SYMBOL.*\(dmu_offset_next\)" "$zfssrc/module/zfs/dmu.c" 2>/dev/null],
-                       [lb_cv_dmu_offset_next="yes"])
-               ])
-               AS_IF([test "x$lb_cv_dmu_offset_next" = "xyes"], [
-                       AC_DEFINE(HAVE_DMU_OFFSET_NEXT, 1,
-                               [Have dmu_offset_next() exported])
-               ])
-               dnl #
-               dnl # ZFS 2.0 replaced .db_last_dirty / .dr_next with a list_t
-               dnl # and list_node_t named .db_dirty_records / .dr_dbuf_node.
-               dnl #
-               LB_CHECK_COMPILE([if ZFS has 'db_dirty_records' list_t],
-               db_dirty_records, [
-                       #include <sys/dbuf.h>
-               ],[
-                       dmu_buf_impl_t db;
-                       dbuf_dirty_record_t *dr;
-                       dr = list_head(&db.db_dirty_records);
-               ],[
-                       AC_DEFINE(HAVE_DB_DIRTY_RECORDS_LIST, 1,
-                               [Have db_dirty_records list_t])
-               ])
-               dnl #
-               dnl # ZFS 2.0 renamed sys/refcount.h to zfs_refcount.h
-               dnl # This build issue shows up with ZFS 2.0.7 and Lustre 2.12 LTS
-               dnl #
-               LB_CHECK_COMPILE([if ZFS renamed sys/refcount to zfs_refcount.h],
-               zfs_zfs_refcount, [
-                       #include <sys/zfs_refcount.h>
-               ],[
-                       zfs_refcount_add((zfs_refcount_t *) NULL, NULL);
-               ],[
-                       AC_DEFINE(HAVE_ZFS_REFCOUNT_HEADER, 1,
-                               [Have zfs_refcount.h])
-               ])
-               old_EXTRA_KCFLAGS=$EXTRA_KCFLAGS
-               EXTRA_KCFLAGS+=" -Werror"
-               dnl #
-               dnl # ZFS 2.2.0 nvpair now returns and expects constant args
-               dnl #
-               LB_CHECK_COMPILE([if ZFS nvlist interfaces require const],
-               zfs_nvpair_const, [
-                       #include <sys/nvpair.h>
-               ], [
-                       nvpair_t *nvp = NULL;
-                       nvlist_t *nvl = NULL;
-                       const char *name = nvpair_name(nvp);
-                       nvlist_lookup_string(nvl, name, &name);
-                       nvlist_lookup_nvlist(nvl, name, &nvl);
-               ], [
-                       AC_DEFINE(HAVE_ZFS_NVLIST_CONST_INTERFACES, 1,
-                           [ZFS nvlist interfaces require const])
-               ])
-               dnl #
-               dnl # ZFS 2.2.1 arc_prune_func_t now uses uint64_t for the
-               dnl # first parameter
-               dnl #
-               LB_CHECK_COMPILE([if ZFS arc_prune_func_t uses uint64_t],
-               zfs_arc_prune_func_uint64, [
-                       #include <sys/arc.h>
-               ], [
-                       void arc_prune_func(uint64_t bytes, void *priv) {}
-                       arc_prune_t *arc_p __attribute__ ((unused)) =
-                               arc_add_prune_callback(arc_prune_func, NULL);
-               ], [
-                       AC_DEFINE(HAVE_ZFS_ARC_PRUNE_FUNC_UINT64, 1,
-                               [ZFS arc_prune_func_t uses uint64_t])
-               ])
-               EXTRA_KCFLAGS=$old_EXTRA_KCFLAGS
-       ])
-
        AS_IF([test "x$enable_zfs" = xyes], [
                AC_SUBST(ENABLE_ZFS, yes)
        ], [
@@ -835,4 +565,353 @@ your distribution.
        ])
        AM_CONDITIONAL(ZFS_ENABLED, [test "x$enable_zfs" = xyes])
        AM_CONDITIONAL(SPL_ENABLED, [test "x$enable_spl" = xyes])
+]) # LB_CONFIG_ZFS
+
+AC_DEFUN([LZ_ZFS_KABI_SERIAL], [
+       LB_CHECK_COMPILE([if zfs defines dsl_pool_config_enter/exit],
+       dsl_pool_config_enter, [
+               #include <sys/dsl_pool.h>
+       ],[
+               dsl_pool_config_enter(NULL, FTAG);
+       ],[
+               AC_DEFINE(HAVE_DSL_POOL_CONFIG, 1,
+                       [Have dsl_pool_config_enter/exit in ZFS])
+       ],[
+               AC_MSG_ERROR([dsl_pool_config_enter/exit do not exist])
+       ])
+       LB_CHECK_COMPILE([if zfs defines zio_buf_alloc/free],
+       zio_buf_alloc, [
+               #include <sys/zio.h>
+       ],[
+               void *ptr = zio_buf_alloc(1024);
+
+               (void)ptr;
+       ],[
+               AC_DEFINE(HAVE_ZIO_BUF_ALLOC, 1,
+                       [Have zio_buf_alloc/free in ZFS])
+       ],[
+               AC_MSG_ERROR([zio_buf_alloc/free do not exist])
+       ])
+       LB_CHECK_COMPILE([if zfs defines spa_maxblocksize],
+       spa_maxblocksize, [
+               #include <sys/spa.h>
+       ],[
+               spa_t *spa = NULL;
+               int size = spa_maxblocksize(spa);
+
+               (void)size;
+       ],[
+               AC_DEFINE(HAVE_SPA_MAXBLOCKSIZE, 1,
+                       [Have spa_maxblocksize in ZFS])
+       ],[
+               AC_MSG_ERROR([spa_maxblocksize does not exist])
+       ])
+
+       #
+       # ZFS 0.7.x adds support for large dnodes.  This
+       # allows Lustre to optionally specify the size of a
+       # dnode which ZFS will then use to store metadata such
+       # as xattrs. The default dnode size specified by the
+       # 'dnodesize' dataset property will be used unless a
+       # specific value is provided.
+       #
+       LB_CHECK_COMPILE([if zfs defines dmu_object_alloc_dnsize],
+       dmu_object_alloc_dnsize, [
+               #include <sys/dmu.h>
+               #include <sys/dnode.h>
+       ],[
+               objset_t *os = NULL;
+               dmu_object_type_t objtype = DMU_OT_NONE;
+               int blocksize = 0;
+               dmu_object_type_t bonustype = DMU_OT_SA;
+               int dnodesize = DNODE_MIN_SIZE;
+               dmu_tx_t *tx = NULL;
+               uint64_t id;
+
+               id = dmu_object_alloc_dnsize(os, objtype, blocksize,
+                                            bonustype,
+                                            DN_BONUS_SIZE(dnodesize),
+                                            dnodesize, tx);
+       ],[
+               AC_DEFINE(HAVE_DMU_OBJECT_ALLOC_DNSIZE, 1,
+                       [Have dmu_object_alloc_dnsize in ZFS])
+       ],[
+               AC_MSG_ERROR([dmu_object_alloc_dnsize does not exist])
+       ])
+
+       #
+       # ZFS 0.7.x extended dmu_prefetch() to take an additional
+       # 'level' and 'priority' argument.  Use a level of 0 and a
+       # priority of ZIO_PRIORITY_SYNC_READ to replicate the
+       # behavior of the four argument version.
+       #
+       LB_CHECK_COMPILE([if ZFS has 'dmu_prefetch' with 6 args],
+       dmu_prefetch, [
+               #include <sys/dmu.h>
+       ],[
+               objset_t *os = NULL;
+               uint64_t object = 0;
+               int64_t level = 0;
+               uint64_t offset = 0;
+               uint64_t len = 0;
+               enum zio_priority pri = ZIO_PRIORITY_SYNC_READ;
+
+               dmu_prefetch(os, object, level, offset, len, pri);
+       ],[
+               AC_DEFINE(HAVE_DMU_PREFETCH_6ARG, 1,
+                       [Have 6 argument dmu_pretch in ZFS])
+       ],[
+               AC_MSG_ERROR([6 argument dmu_pretch does not exist])
+       ])
+       #
+       # ZFS 0.7.0 feature: SPA_FEATURE_USEROBJ_ACCOUNTING
+       #
+       LB_CHECK_COMPILE([if ZFS has native dnode accounting supported],
+       dmu_objset_userobjused_enabled, [
+               #include <sys/dmu_objset.h>
+       ],[
+               dmu_objset_userobjused_enabled(NULL);
+       ],[
+               AC_DEFINE(HAVE_DMU_USEROBJ_ACCOUNTING, 1,
+                       [Have native dnode accounting in ZFS])
+       ],[
+               AC_MSG_ERROR([native dnode accounting does not exist])
+       ])
+       #
+       # ZFS 0.7.0 feature: MULTIHOST
+       #
+       LB_CHECK_COMPILE([if ZFS has multihost protection],
+       spa_multihost, [
+               #include <sys/fs/zfs.h>
+       ],[
+               zpool_prop_t prop = ZPOOL_PROP_MULTIHOST;
+
+               (void)prop;
+       ],[
+               AC_DEFINE(HAVE_ZFS_MULTIHOST, 1,
+                       [Have multihost protection in ZFS])
+       ],[
+               AC_MSG_ERROR([multihost protection does not exist])
+       ])
+       #
+       # ZFS 0.7.x adds new method zap_lookup_by_dnode
+       #
+       LB_CHECK_COMPILE([if ZFS has 'zap_lookup_by_dnode'],
+       zap_lookup_by_dnode, [
+               #include <sys/zap.h>
+               #include <sys/dnode.h>
+       ],[
+               dnode_t *dn = NULL;
+               zap_lookup_by_dnode(dn, NULL, 1, 1, NULL);
+       ],[
+               AC_DEFINE(HAVE_ZAP_LOOKUP_BY_DNODE, 1,
+                       [Have zap_lookup_by_dnode() in ZFS])
+       ],[
+               AC_MSG_ERROR([zap_lookup_by_dnode does not exist])
+       ])
+       #
+       # ZFS 0.7.x adds new method zap_add_by_dnode
+       #
+       LB_CHECK_COMPILE([if ZFS has 'zap_add_by_dnode'],
+       zap_add_by_dnode, [
+               #include <sys/zap.h>
+               #include <sys/dnode.h>
+       ],[
+               dnode_t *dn = NULL;
+               zap_add_by_dnode(dn, NULL, 1, 1, NULL, NULL);
+       ],[
+               AC_DEFINE(HAVE_ZAP_ADD_BY_DNODE, 1,
+                       [Have zap_add_by_dnode() in ZFS])
+       ],[
+               AC_MSG_ERROR([zap_add_by_dnode does not exist])
+       ])
+       #
+       # ZFS 0.7.x adds new method zap_remove_by_dnode
+       #
+       LB_CHECK_COMPILE([if ZFS has 'zap_remove_by_dnode'],
+       zap_remove_by_dnode, [
+               #include <sys/zap.h>
+               #include <sys/dnode.h>
+       ],[
+               dnode_t *dn = NULL;
+               zap_remove_by_dnode(dn, NULL, NULL);
+       ],[
+               AC_DEFINE(HAVE_ZAP_REMOVE_ADD_BY_DNODE, 1,
+                       [Have zap_remove_by_dnode() in ZFS])
+       ],[
+               AC_MSG_ERROR([zap_remove_by_dnode does not exist])
+       ])
+       #
+       # ZFS 0.7.x adds new method dmu_tx_hold_zap_by_dnode
+       #
+       LB_CHECK_COMPILE([if ZFS has 'dmu_tx_hold_zap_by_dnode'],
+       dmu_tx_hold_zap_by_dnode, [
+               #include <sys/zap.h>
+               #include <sys/dnode.h>
+       ],[
+               dnode_t *dn = NULL;
+               dmu_tx_hold_zap_by_dnode(NULL, dn, TRUE, NULL);
+       ],[
+               AC_DEFINE(HAVE_DMU_TX_HOLD_ZAP_BY_DNODE, 1,
+                       [Have dmu_tx_hold_zap_by_dnode() in ZFS])
+       ],[
+               AC_MSG_ERROR([dmu_tx_hold_zap_by_dnode does not exist])
+       ])
+       #
+       # ZFS 0.7.x adds new method dmu_tx_hold_write_by_dnode
+       #
+       LB_CHECK_COMPILE([if ZFS has 'dmu_tx_hold_write_by_dnode'],
+       dmu_tx_hold_write_by_dnode, [
+               #include <sys/zap.h>
+               #include <sys/dnode.h>
+       ],[
+               dnode_t *dn = NULL;
+               dmu_tx_hold_write_by_dnode(NULL, dn, 0, 0);
+       ],[
+               AC_DEFINE(HAVE_DMU_TX_HOLD_WRITE_BY_DNODE, 1,
+                       [Have dmu_tx_hold_write_by_dnode() in ZFS])
+       ],[
+               AC_MSG_ERROR([dmu_tx_hold_write_by_dnode does not exist])
+       ])
+       #
+       # ZFS 0.7.x adds new method dmu_write_by_dnode
+       #
+       LB_CHECK_COMPILE([if ZFS has 'dmu_write_by_dnode'],
+       dmu_write_by_dnode, [
+               #include <sys/zap.h>
+               #include <sys/dnode.h>
+       ],[
+               dnode_t *dn = NULL;
+               dmu_write_by_dnode(dn, 0, 0, NULL, NULL);
+       ],[
+               AC_DEFINE(HAVE_DMU_WRITE_BY_DNODE, 1,
+                       [Have dmu_write_by_dnode() in ZFS])
+       ],[
+               AC_MSG_ERROR([dmu_write_by_dnode does not exist])
+       ])
+       #
+       # ZFS 0.7.x adds new method dmu_read_by_dnode
+       #
+       LB_CHECK_COMPILE([if ZFS has 'dmu_read_by_dnode'],
+       dmu_read_by_dnode, [
+               #include <sys/zap.h>
+               #include <sys/dnode.h>
+       ],[
+               dnode_t *dn = NULL;
+               dmu_read_by_dnode(dn, 0, 0, NULL, 0);
+       ],[
+               AC_DEFINE(HAVE_DMU_READ_BY_DNODE, 1,
+                       [Have dmu_read_by_dnode() in ZFS])
+       ],[
+               AC_MSG_ERROR([dmu_read_by_dnode does not exist])
+       ])
+       #
+       # ZFS 0.7.2 adds new method dmu_tx_mark_netfree
+       #
+       LB_CHECK_COMPILE([if ZFS has 'dmu_tx_mark_netfree'],
+       dmu_tx_mark_netfree, [
+               #include <sys/dmu.h>
+       ],[
+               dmu_tx_t *tx = NULL;
+               dmu_tx_mark_netfree(tx);
+       ],[
+               AC_DEFINE(HAVE_DMU_TX_MARK_NETFREE, 1,
+                       [Have dmu_tx_mark_netfree])
+       ])
+       #
+       # ZFS 0.7.10 changes timestruc_t to inode_timespec_t
+       #
+       LB_CHECK_COMPILE([if SPL has 'inode_timespec_t'],
+       zfs_have_inode_timespec, [
+               #include <sys/fs/zfs.h>
+       ],[
+               inode_timespec_t now;
+               gethrestime(&now);
+       ],[
+               AC_DEFINE(HAVE_ZFS_INODE_TIMESPEC, 1,
+                       [Have inode_timespec_t])
+       ])
+       # ZFS 0.7.12/0.8.x uses zfs_refcount_add() instead of
+       # refcount_add().  ZFS 2.0 renamed sys/refcount.h to
+       # sys/zfs_refcount.h, rather the add another check to
+       # determine the correct header name include it
+       # indirectly through sys/dnode.h.
+       #
+       LB_CHECK_COMPILE([if ZFS has 'zfs_refcount_add'],
+       zfs_refcount_add, [
+               #include <sys/dnode.h>
+       ],[
+               zfs_refcount_add((zfs_refcount_t *) NULL, NULL);
+       ],[
+               AC_DEFINE(HAVE_ZFS_REFCOUNT_ADD, 1,
+                       [Have zfs_refcount_add])
+       ])
+       #
+       # ZFS 0.8.x changes dmu_objset_own for encryption
+       #
+       LB_CHECK_COMPILE([if ZFS has 'dmu_objset_own' with 6 args],
+       dmu_objset_own, [
+               #include <sys/dmu_objset.h>
+       ],[
+               objset_t *os = NULL;
+               dmu_objset_type_t type = DMU_OST_ANY;
+               dmu_objset_own(NULL, type, B_FALSE, B_TRUE, FTAG, &os);
+       ],[
+               AC_DEFINE(HAVE_DMU_OBJSET_OWN_6ARG, 1,
+                       [Have dmu_objset_own() with 6 args])
+       ])
+       #
+       # ZFS 0.8.x changes dmu_objset_disown for encryption
+       #
+       LB_CHECK_COMPILE([if ZFS has 'dmu_objset_disown' with 3 args],
+       dmu_objset_disown, [
+               #include <sys/dmu_objset.h>
+       ],[
+               objset_t *os = NULL;
+               dmu_objset_disown(os, B_TRUE, FTAG);
+       ],[
+               AC_DEFINE(HAVE_DMU_OBJSET_DISOWN_3ARG, 1,
+                       [Have dmu_objset_disown() with 3 args])
+       ])
+       #
+       # ZFS exports dmu_offet_next
+       #
+       AC_CACHE_CHECK([if ZFS exports 'dmu_offset_next'],
+       [lb_cv_dmu_offset_next], [
+       lb_cv_dmu_offset_next="no"
+       AS_IF([grep -q -E "EXPORT_SYMBOL.*\(dmu_offset_next\)" "$zfssrc/module/zfs/dmu.c" 2>/dev/null],
+               [lb_cv_dmu_offset_next="yes"])
+       ])
+       AS_IF([test "x$lb_cv_dmu_offset_next" = "xyes"], [
+               AC_DEFINE(HAVE_DMU_OFFSET_NEXT, 1,
+                       [Have dmu_offset_next() exported])
+       ])
+       #
+       # ZFS 2.0 replaced .db_last_dirty / .dr_next with a list_t
+       # and list_node_t named .db_dirty_records / .dr_dbuf_node.
+       #
+       LB_CHECK_COMPILE([if ZFS has 'db_dirty_records' list_t],
+       db_dirty_records, [
+               #include <sys/dbuf.h>
+       ],[
+               dmu_buf_impl_t db;
+               dbuf_dirty_record_t *dr;
+               dr = list_head(&db.db_dirty_records);
+       ],[
+               AC_DEFINE(HAVE_DB_DIRTY_RECORDS_LIST, 1,
+                       [Have db_dirty_records list_t])
+       ])
+       #
+       # ZFS 2.0 renamed sys/refcount.h to zfs_refcount.h
+       # This build issue shows up with ZFS 2.0.7 and Lustre 2.12 LTS
+       #
+       LB_CHECK_COMPILE([if ZFS renamed sys/refcount to zfs_refcount.h],
+       zfs_zfs_refcount, [
+               #include <sys/zfs_refcount.h>
+       ],[
+               zfs_refcount_add((zfs_refcount_t *) NULL, NULL);
+       ],[
+               AC_DEFINE(HAVE_ZFS_REFCOUNT_HEADER, 1,
+                       [Have zfs_refcount.h])
+       ])
 ])
index 3d80397..5ee233d 100644 (file)
@@ -1,3 +1,13 @@
+# SPDX-License-Identifier: GPL-2.0
+
+#
+# This file is part of Lustre, http://www.lustre.org/
+#
+# config/lustre-build.m4
+#
+# Generic Lustre configuration options
+#
+
 #
 # LB_CANONICAL_SYSTEM
 #
@@ -152,29 +162,46 @@ AC_ARG_ENABLE([modules],
                LC_TARGET_SUPPORTED([enable_modules="yes"],
                                    [enable_modules="no"])
        ])
-AC_MSG_RESULT([$enable_modules ($target_os)])
+       AC_MSG_RESULT([$enable_modules ($target_os)])
+       AS_IF([test "x$enable_modules" = xyes], [
+               AS_IF([test "x$FLEX" = "x"], [AC_MSG_ERROR(
+                       [flex package is required to build kernel modules])])
+               AS_IF([test "x$BISON" = "x"], [AC_MSG_ERROR(
+                       [bison package is required to build kernel modules])])
+       AS_CASE([$target_os], [linux*], [
+                       # Ensure SUBARCH is defined
+                       SUBARCH=$(echo $target_cpu | sed -e 's/powerpc.*/powerpc/' -e 's/ppc.*/powerpc/' -e 's/x86_64/x86/' -e 's/i.86/x86/' -e 's/k1om/x86/' -e 's/aarch64.*/arm64/' -e 's/armv7.*/arm/')
+                       LB_PROG_LINUX
+                       AS_IF([test "x$enable_server" != xno],
+                               [LB_EXT4_SOURCE_PATH])
+               ], [*], [
+                       # This is strange - Lustre supports a target we don't
+                       AC_MSG_ERROR([Modules are not supported on $target_os])
+       ])
+])
 
-AS_IF([test "x$enable_modules" = xyes], [
-       AS_IF([test "x$FLEX" = "x"], [AC_MSG_ERROR([flex package is required to build kernel modules])])
-       AS_IF([test "x$BISON" = "x"], [AC_MSG_ERROR([bison package is required to build kernel modules])])
+AC_DEFUN([LB_KABI_CHECKS], [
        AS_CASE([$target_os],
                [linux*], [
                        # Ensure SUBARCH is defined
                        SUBARCH=$(echo $target_cpu | sed -e 's/powerpc.*/powerpc/' -e 's/ppc.*/powerpc/' -e 's/x86_64/x86/' -e 's/i.86/x86/' -e 's/k1om/x86/' -e 's/aarch64.*/arm64/' -e 's/armv7.*/arm/')
 
                        # Run serial tests
-                       LB_PROG_LINUX
                        LIBCFS_PROG_LINUX
                        LN_PROG_LINUX
-                       AS_IF([test "x$enable_server" != xno], [LB_EXT4_SRC_DIR])
                        LC_PROG_LINUX
+                       AS_IF([test "x$enable_zfs" = xyes],
+                               [LZ_ZFS_KABI_SERIAL])
 
                        # Run any parallel compile tests
                        LB_PROG_LINUX_SRC
                        LIBCFS_PROG_LINUX_SRC
                        LN_PROG_LINUX_SRC
-                       AS_IF([test "x$enable_server" != xno], [LB_EXT4_SRC_DIR_SRC])
+                       AS_IF([test "x$enable_server" != xno],
+                               [LB_EXT4_LDISKFS_TESTS])
                        LC_PROG_LINUX_SRC
+                       AS_IF([test "x$enable_zfs" = xyes],
+                               [LZ_KABI_ZFS_TESTS])
 
                        LB2_LINUX_TEST_COMPILE_ALL([lustre],
                                [for available lustre kapi interfaces])
@@ -183,8 +210,11 @@ AS_IF([test "x$enable_modules" = xyes], [
                        LB_PROG_LINUX_RESULTS
                        LIBCFS_PROG_LINUX_RESULTS
                        LN_PROG_LINUX_RESULTS
-                       AS_IF([test "x$enable_server" != xno], [LB_EXT4_SRC_DIR_RESULTS])
+                       AS_IF([test "x$enable_server" != xno],
+                               [LB_EXT4_LDISKFS_CHECKS])
                        LC_PROG_LINUX_RESULTS
+                       AS_IF([test "x$enable_zfs" = xyes],
+                               [LZ_KABI_ZFS_CHECKS])
 
                ], [*], [
                        # This is strange - Lustre supports a target we don't
@@ -516,6 +546,11 @@ LB_CONFIG_MODULES
 AS_IF([test x$enable_modules = xno], [enable_server=no])
 LB_CONFIG_LDISKFS
 LB_CONFIG_ZFS
+AS_IF([test "x$enable_dist" = xno], [
+       LB_KABI_LDISKFS
+       LZ_KABI_ZFS
+       LB_KABI_CHECKS
+])
 
 # If no backends were configured, and the user did not explicitly
 # require servers to be enabled, we just disable servers.
index d5485af..fbc10a9 100644 (file)
@@ -1,3 +1,13 @@
+# SPDX-License-Identifier: GPL-2.0
+
+#
+# This file is part of Lustre, http://www.lustre.org/
+#
+# config/lustre-version.m4
+#
+# Defines variables for Lustre version number
+#
+
 #
 # LUSTRE_VERSION_CPP_MACROS
 #
@@ -17,4 +27,4 @@ AC_DEFINE_UNQUOTED([LUSTRE_FIX], [$LUSTRE_FIX], [Fourth number in the Lustre ver
 # divergence from the Lustre client code in the upstream Linux kernel code.
 AC_DEFINE_UNQUOTED([LUSTRE_VERSION_STRING], ["$PACKAGE_VERSION"], [A copy of PACKAGE_VERSION])
 
-])
+]) # LUSTRE_VERSION_CPP_MACROS
index 6a8a1b6..44c5aa3 100644 (file)
@@ -1,8 +1,20 @@
+# SPDX-License-Identifier: NOASSERTION
+
+#
+# Copyright 2012 Genome Research Ltd.
+#           2017-2018 Universität Hamburg
+#
+
+#
+# This file is part of Lustre, http://www.lustre.org/
+#
+# debian/dkms.conf.in
+#
 # Lustre Linux kernel module (DKMS)
+#
 # Created by Guy Coates
 # Updated by Michael Kuhn
-# Copyright 2012 Genome Research Ltd.
-#           2017-2018 Universität Hamburg
+#
 
 PACKAGE_NAME="lustre-client-modules"
 PACKAGE_VERSION="@UPVERSION@"
index 5fbf15c..6cf4990 100644 (file)
@@ -1,4 +1,13 @@
 #!/bin/sh
+# SPDX-License-Identifier: NOASSERTION
+
+#
+# This file is part of Lustre, http://www.lustre.org/
+#
+# debian/lustre-client-module-dkms.postinst
+#
+# Script run after Lustre DKMS modules are installed
+#
 
 set -e
 
index a1565f5..31afc59 100644 (file)
@@ -1,4 +1,13 @@
 #!/bin/sh
+# SPDX-License-Identifier: NOASSERTION
+
+#
+# This file is part of Lustre, http://www.lustre.org/
+#
+# debian/lustre-client-module-dkms.prerm
+#
+# Script run before Lustre DKMS modules are removed
+#
 
 set -e
 
index a05e2a5..ba571b5 100755 (executable)
@@ -1,4 +1,13 @@
 #!/bin/sh
+# SPDX-License-Identifier: NOASSERTION
+
+#
+# This file is part of Lustre, http://www.lustre.org/
+#
+# debian/postinst
+#
+# Script run before Lustre module/utils are installed
+#
 
 DEPMOD_DIR="/etc/depmod.d"
 LUSTRE_DEPMOD_FILE="${DEPMOD_DIR}/lustre.conf"
index 2affdf0..cd9b909 100755 (executable)
@@ -1,4 +1,13 @@
 #!/bin/sh
+# SPDX-License-Identifier: NOASSERTION
+
+#
+# This file is part of Lustre, http://www.lustre.org/
+#
+# debian/postrm
+#
+# Script run before Lustre module/utils are removed
+#
 
 DEPMOD_DIR="/etc/depmod.d"
 LUSTRE_DEPMOD_FILE="${DEPMOD_DIR}/lustre.conf"
index 344f255..2196056 100755 (executable)
@@ -1,11 +1,21 @@
 #!/usr/bin/make -f
+# SPDX-License-Identifier: NOASSERTION
+
+#
+# This file is part of Lustre, http://www.lustre.org/
+#
+# debian/rules
+#
+# Debian rules file
+#
+# Copying and modification is unlimited, provided that the modified
+# version is marked as being modified.
+# (This version has been modified from the original)
 #
 # Created 2009 by Brian J. Murrell based on work by
 # Alastair McKinstry, <alastair.mckinstry@ichec.ie>, <mckinstry@debian.org>
 # Patrick Winnertz, and the pkg-lustre Debian maintainers
 #
-# Copying and modification is unlimited, provided that the modified
-# version is marked as being modified.
 
 # Uncomment this to turn on verbose mode.
 # export DH_VERBOSE=1
@@ -33,11 +43,6 @@ else
         CFLAGS += -O2
 endif
 
-# We need the kernels to be built with gcc-3.3; suspect that gcc-4.1 uses too
-# much stack and crashes because of it.
-#CC?=gcc-3.3
-#export CC
-
 # This is the debhelper compatibility version to use.
 export DH_COMPAT=11
 
@@ -543,6 +548,9 @@ binary-modules: prep-deb-files
        dh_installmodules -p $(PKGNAME)
        dh_compress -p $(PKGNAME)
        dh_fixperms -p $(PKGNAME)
+       sed "s/depmod -a/depmod -a $(KVERS)/" $(CURDIR)/debian/postinst > $(CURDIR)/debian/$(PKGNAME).postinst
+       sed "s/depmod -a/depmod -a $(KVERS)/" $(CURDIR)/debian/postrm > $(CURDIR)/debian/$(PKGNAME).postrm
+       chmod +x $(CURDIR)/debian/$(PKGNAME).postinst $(CURDIR)/debian/$(PKGNAME).postrm
        dh_installdeb -p $(PKGNAME)
        dh_gencontrol -- -v$(VERSION)
        dh_md5sums -p $(PKGNAME)
index 811b1f4..932f182 100644 (file)
@@ -10,7 +10,7 @@ linux_headers := $(wildcard @LINUX@/include/linux/ext4*.h)
 linux_new_headers := htree_lock.h
 trace_headers := $(wildcard @LINUX@/include/trace/events/ext4*.h)
 
-backfs_sources := $(filter-out %.mod.c %/inode-test.c,$(wildcard @EXT4_SRC_DIR@/*.c))
+backfs_sources := $(filter-out %.mod.c %/inode-test.c @EXT4_CRYPTO@,$(wildcard @EXT4_SRC_DIR@/*.c))
 
 new_sources := mmp.c htree_lock.c critical_encode.h
 new_headers :=
index 9c5ed6c..ef340a9 100644 (file)
@@ -303,6 +303,7 @@ LDISKFS hooks for mount/mkfs into a dynamic library.
 %endif
 
 %if %{with zfs}
+%global confzfsdobjpath %(echo '%configure_args' | grep -q -- --with-zfs-obj= ; echo $?)
 %kernel_module_package -n %{name}-osd-zfs -p %SOURCE5 -f %SOURCE6 %{_flavor}
 %if %{with lustre_utils}
 %package osd-zfs-mount
@@ -311,9 +312,16 @@ BuildRequires: libmount-devel
 Requires: libmount
 Provides: lustre-osd-mount = %{version}
 Obsoletes: lustre-osd-mount < %{version}
+%if 0%{confzfsdobjpath} != 0
+BuildRequires: (libzfs-devel or libzfs4-devel or libzfs5-devel)
+%endif
+# end confzfsdobjpath
 # Tests also require zpool from zfs package:
 Requires: zfs
 Requires: %{requires_kmod_osd_zfs_name}
+Provides: %{name}-osd-mount = %{version}
+Provides: %{name}-osd-zfs-mount = %{version}
+Requires: %{name}-osd-zfs = %{version}
 Group: System Environment/Kernel
 
 %description osd-zfs-mount
index cd8f0cb..f0d30c2 100644 (file)
@@ -4268,8 +4268,8 @@ static int lod_xattr_set_lmv(const struct lu_env *env, struct dt_object *dt,
        if (rc != 0)
                RETURN(rc);
 
-       attr->la_valid = LA_ATIME | LA_MTIME | LA_CTIME | LA_FLAGS |
-                        LA_MODE | LA_UID | LA_GID | LA_TYPE | LA_PROJID;
+       attr->la_valid &= LA_ATIME | LA_MTIME | LA_CTIME | LA_FLAGS |
+                         LA_MODE | LA_UID | LA_GID | LA_TYPE | LA_PROJID;
        dof->dof_type = DFT_DIR;
 
        rc = lod_prep_lmv_md(env, dt, &lmv_buf);
index d206acd..ac98fba 100644 (file)
@@ -296,7 +296,7 @@ static ssize_t osd_write_llog_header(struct osd_object *obj,
                bufoff = offset - db->db_offset;
                tocpy = MIN(db->db_size - bufoff, len);
                if (tocpy == db->db_size)
-                       dmu_buf_will_fill(db, oh->ot_tx);
+                       dmu_buf_will_fill(db, oh->ot_tx LL_BFILL);
                else
                        dmu_buf_will_dirty(db, oh->ot_tx);
                LASSERT(offset >= db->db_offset);
@@ -304,7 +304,7 @@ static ssize_t osd_write_llog_header(struct osd_object *obj,
                (void) memcpy((char *)db->db_data + bufoff, data, tocpy);
 
                if (tocpy == db->db_size)
-                       dmu_buf_fill_done(db, oh->ot_tx);
+                       dmu_buf_fill_done(db, oh->ot_tx LL_BFILL);
 
                offset += tocpy;
                data += tocpy;
index 743ec6e..a421ff8 100644 (file)
@@ -2003,6 +2003,8 @@ static int osd_create(const struct lu_env *env, struct dt_object *dt,
        obj->oo_attr.la_size = 0;
        obj->oo_attr.la_nlink = 0;
        obj->oo_attr.la_valid |= LA_SIZE | LA_NLINK | LA_TYPE;
+       if (!(obj->oo_attr.la_valid & LA_FLAGS))
+               obj->oo_attr.la_flags = 0;
 
 #ifdef ZFS_PROJINHERIT
        if (osd->od_projectused_dn) {
index c0368a1..3a14397 100755 (executable)
@@ -3733,14 +3733,21 @@ test_41() {
        df -kP $dir; df -iP $dir
        local bused=$(getquota -p $projid global curspace)
        local iused=$(getquota -p $projid global curinodes)
-       # note trailing space to match double printf from awk
-       local expected="$blimit $bused $ilimit $iused "
+       local expected="$ilimit$iused"
 
        wait_update $HOSTNAME \
-               "{ df -kP $dir; df -iP $dir; } |
-                awk '/$FSNAME/ { printf \\\"%d %d \\\", \\\$2,\\\$3 }'" \
+               "df -iP $dir | awk \\\"/$FSNAME/\\\"'{print \\\$2 \\\$3}'" \
                "$expected" ||
                error "failed to get correct statfs for project quota"
+
+       expected=$(df -kP $dir | awk "/$FSNAME/"' {print $2}')
+       (( expected == blimit )) ||
+               error "blimit mismatch: $expected != $blimit"
+
+       # zfs block size is 4K, while quota is printed in 1K, df result may be
+       # larger than quota result, but it's no more than 3K
+       expected=$(df -kP $dir | awk "/$FSNAME/"' {print $3}')
+       (( expected - bused < 4)) || error "bused mismatch: $expected != $bused"
 }
 run_test 41 "df should return projid-specific values"
 
index e0738e0..f25d4e6 100755 (executable)
@@ -1,11 +1,18 @@
 #!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
 
+#
+# This file is part of Lustre, http://www.lustre.org/
+#
+# rpm/find-provides
+#
 # This script reads filenames from STDIN and outputs any relevant provides
 # information that needs to be included in the package.
+#
 
 if [ "$1" ]
 then
-   package_name="$1"
+    package_name="$1"
 fi
 
 filelist=`sed "s/['\"]/\\\&/g"`
@@ -18,7 +25,7 @@ filelist=`sed "s/['\"]/\\\&/g"`
 for i in /usr/lib/rpm/redhat/find-provides.d/*.prov
 do
     [ -x $i ] &&
-        (echo $filelist | tr '[:blank:]' \\n | $i | sort -u)
+       (echo $filelist | tr '[:blank:]' \\n | $i | sort -u)
 done
 
 #
@@ -32,7 +39,7 @@ is_kmod=1
 for f in $filelist; do
     if [ $(echo "$f" | sed -r -ne 's:^.*/lib/modules/(.*)/(.*)\.ko(\.gz|\.bz2|\.xz)?$:\2:p') ]
     then
-        is_kernel=1;
+       is_kernel=1;
     fi
     if [ $(echo "$f" | sed -r -ne 's:^.*/boot/(.*):\1:p') ]
     then
index 7f4c863..b290135 100755 (executable)
@@ -1,4 +1,13 @@
-#! /bin/bash
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+
+#
+# This file is part of Lustre, http://www.lustre.org/
+#
+# rpm/find-provides.ksyms
+#
+# Find which kernel symbols a particular module provides
+#
 
 IFS=$'\n'
 
index e17709c..34a36b1 100644 (file)
@@ -1,4 +1,8 @@
 Summary:        Lustre osd-zfs feature support
 Requires:       %{name}-osd-zfs-mount = %{version}
+%if 0%{confzfsdobjpath} != 0
+BuildRequires:  kmod-zfs-devel
+%endif
 Provides:       %{name}-osd = %{version}
+Provides:       %{name}-osd-zfs = %{version}
 Obsoletes:      %{name}-osd-zfs < %{version}