From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id B4F541FF13A for ; Wed, 13 May 2026 18:08:47 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 7246016F56; Wed, 13 May 2026 18:08:45 +0200 (CEST) From: Stoiko Ivanov To: pve-devel@lists.proxmox.com Subject: [PATCH zfsonlinux] update submodule to 2.4.2 and refresh patches Date: Wed, 13 May 2026 18:08:17 +0200 Message-ID: <20260513160819.2000176-1-s.ivanov@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1778688504365 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.238 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_LOTSOFHASH 0.25 Emails with lots of hash-like gibberish KAM_SHORT 0.001 Use of a URL Shortener for very short URL POISEN_SPAM_PILL 0.1 Meta: its spam POISEN_SPAM_PILL_1 0.1 random spam to be learned in bayes POISEN_SPAM_PILL_3 0.1 random spam to be learned in bayes PROLO_LEO1 0.1 Meta Catches all Leo drug variations so far SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [zfs-tests.sh,linux.run,opensource.org,etc.com,makefile.am,libspl.la] Message-ID-Hash: 3HLXWWRL3NPCK6ZLCHNJGRYZXIRTAVNR X-Message-ID-Hash: 3HLXWWRL3NPCK6ZLCHNJGRYZXIRTAVNR X-MailFrom: s.ivanov@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: mostly drop all patches that are now included in 2.4.2 (most of those were the 7.0 compatibility fixes). The changes between 2.4.1 and 2.4.2 are kernel-compat patches (up to 7.1[0]), some bugfixes, a few patches addressing removal of the old mount-api [1,2], rework of tests and CI. Nothing stood out as too scary. Minimally tested on 2 VMs with replication (also including the recent changes of supporting sending encrypted datasets with --no-preserve-encryption). [0] https://github.com/openzfs/zfs/pull/18471 [1] https://github.com/openzfs/zfs/pull/18339 [2] https://github.com/openzfs/zfs/pull/18377 Signed-off-by: Stoiko Ivanov --- ...META-and-DCH-consistency-in-autoconf.patch | 9 +- .../0006-dont-symlink-zed-scripts.patch | 4 +- ...md-unit-for-importing-specific-pools.patch | 4 +- ...y-include-start-and-end-nv-pairs-if-.patch | 2 +- ...010-Add-no-preserve-encryption-flag.patch} | 4 +- ...itly-set-setlease-handler-to-kernel-.patch | 464 ------------------ ...ueue_nonrot-renamed-to-blk_queue_rot.patch | 86 ---- ...ix_acl_to_xattr-now-allocates-memory.patch | 115 ----- ...ims-for-the-fs_context-based-mount-A.patch | 153 ------ ...et-setlease-handler-on-directories-1.patch | 36 -- ...nf-Remove-copy-from-user-inatomic-AP.patch | 79 --- ...re-LSMs-get-to-process-mount-options.patch | 67 --- .../patches/0017-Linux-7.0-compat-META.patch | 28 -- ...0019-Fix-kernel-BUG-at-mm-usercopy.c.patch | 62 --- debian/patches/series | 11 +- upstream | 2 +- 16 files changed, 14 insertions(+), 1112 deletions(-) rename debian/patches/{0018-Add-no-preserve-encryption-flag.patch => 0010-Add-no-preserve-encryption-flag.patch} (98%) delete mode 100644 debian/patches/0010-Linux-7.0-explicitly-set-setlease-handler-to-kernel-.patch delete mode 100644 debian/patches/0011-Linux-7.0-blk_queue_nonrot-renamed-to-blk_queue_rot.patch delete mode 100644 debian/patches/0012-Linux-7.0-posix_acl_to_xattr-now-allocates-memory.patch delete mode 100644 debian/patches/0013-Linux-7.0-add-shims-for-the-fs_context-based-mount-A.patch delete mode 100644 debian/patches/0014-Linux-7.0-also-set-setlease-handler-on-directories-1.patch delete mode 100644 debian/patches/0015-Linux-7.0-autoconf-Remove-copy-from-user-inatomic-AP.patch delete mode 100644 debian/patches/0016-Linux-7.0-ensure-LSMs-get-to-process-mount-options.patch delete mode 100644 debian/patches/0017-Linux-7.0-compat-META.patch delete mode 100644 debian/patches/0019-Fix-kernel-BUG-at-mm-usercopy.c.patch diff --git a/debian/patches/0001-Check-for-META-and-DCH-consistency-in-autoconf.patch b/debian/patches/0001-Check-for-META-and-DCH-consistency-in-autoconf.patch index 41fa5b583..4d00dc970 100644 --- a/debian/patches/0001-Check-for-META-and-DCH-consistency-in-autoconf.patch +++ b/debian/patches/0001-Check-for-META-and-DCH-consistency-in-autoconf.patch @@ -10,10 +10,11 @@ Signed-off-by: Thomas Lamprecht 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/config/zfs-meta.m4 b/config/zfs-meta.m4 -index 20064a0fb5957288640494bd6a640942796050b4..4d5f545adc23c3c97604b7a1ac47e9711c81e9fd 100644 +index 72d424e2d47873c0049c2039c4b01a22eafad3ef..3e0943c797a35c7792e105206f68a3eff3e7d9d7 100644 --- a/config/zfs-meta.m4 +++ b/config/zfs-meta.m4 -@@ -1,9 +1,10 @@ +@@ -1,10 +1,11 @@ + dnl # SPDX-License-Identifier: CDDL-1.0 dnl # dnl # DESCRIPTION: -dnl # Read meta data from the META file. When building from a git repository @@ -28,7 +29,7 @@ index 20064a0fb5957288640494bd6a640942796050b4..4d5f545adc23c3c97604b7a1ac47e971 dnl # dnl # The META file format is as follows: dnl # ^[ ]*KEY:[ \t]+VALUE$ -@@ -49,6 +50,7 @@ AC_DEFUN([ZFS_AC_META], [ +@@ -50,6 +51,7 @@ AC_DEFUN([ZFS_AC_META], [ _zfs_ac_meta_type="none" if test -f "$META"; then _zfs_ac_meta_type="META file" @@ -36,7 +37,7 @@ index 20064a0fb5957288640494bd6a640942796050b4..4d5f545adc23c3c97604b7a1ac47e971 ZFS_META_NAME=_ZFS_AC_META_GETVAL([(Name|Project|Package)]); if test -n "$ZFS_META_NAME"; then -@@ -69,8 +71,30 @@ AC_DEFUN([ZFS_AC_META], [ +@@ -70,8 +72,30 @@ AC_DEFUN([ZFS_AC_META], [ AC_SUBST([ZFS_META_VERSION]) fi diff --git a/debian/patches/0006-dont-symlink-zed-scripts.patch b/debian/patches/0006-dont-symlink-zed-scripts.patch index d017f18fc..78b649510 100644 --- a/debian/patches/0006-dont-symlink-zed-scripts.patch +++ b/debian/patches/0006-dont-symlink-zed-scripts.patch @@ -32,10 +32,10 @@ Signed-off-by: Thomas Lamprecht 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/zed/zed.d/Makefile.am b/cmd/zed/zed.d/Makefile.am -index c0b161ecf2489ee2ba5988f51bda99ac0dd2f639..141116709dfbfb32f6b3da81b25d69499dc6e72c 100644 +index 4a02f8abfc22d44d2c4ae4f97a3fc8803d546239..213861cd1c9a9398e75cacd0c5fa476b579aed4c 100644 --- a/cmd/zed/zed.d/Makefile.am +++ b/cmd/zed/zed.d/Makefile.am -@@ -50,7 +50,7 @@ zed-install-data-hook: +@@ -51,7 +51,7 @@ zed-install-data-hook: set -x; for f in $(zedconfdefaults); do \ [ -f "$(DESTDIR)$(zedconfdir)/$${f}" ] ||\ [ -L "$(DESTDIR)$(zedconfdir)/$${f}" ] || \ diff --git a/debian/patches/0007-Add-systemd-unit-for-importing-specific-pools.patch b/debian/patches/0007-Add-systemd-unit-for-importing-specific-pools.patch index 28477cbcd..3313dd5d4 100644 --- a/debian/patches/0007-Add-systemd-unit-for-importing-specific-pools.patch +++ b/debian/patches/0007-Add-systemd-unit-for-importing-specific-pools.patch @@ -23,10 +23,10 @@ Signed-off-by: Thomas Lamprecht create mode 100644 etc/systemd/system/zfs-import@.service.in diff --git a/etc/Makefile.am b/etc/Makefile.am -index 808c729cd96838f4039a1e4476826a958414ce4f..88f85ca9bbebcc76e81adcad6d56c07b8661b09e 100644 +index 58b3cf563b624c716f1a3f82b15283758a19bc0c..2e539ae4623441db09a8baa166fca4deceed7930 100644 --- a/etc/Makefile.am +++ b/etc/Makefile.am -@@ -54,6 +54,7 @@ dist_systemdpreset_DATA = \ +@@ -55,6 +55,7 @@ dist_systemdpreset_DATA = \ systemdunit_DATA = \ %D%/systemd/system/zfs-import-cache.service \ %D%/systemd/system/zfs-import-scan.service \ diff --git a/debian/patches/0009-libzfs-scrub-only-include-start-and-end-nv-pairs-if-.patch b/debian/patches/0009-libzfs-scrub-only-include-start-and-end-nv-pairs-if-.patch index 0675045fb..0fd341e47 100644 --- a/debian/patches/0009-libzfs-scrub-only-include-start-and-end-nv-pairs-if-.patch +++ b/debian/patches/0009-libzfs-scrub-only-include-start-and-end-nv-pairs-if-.patch @@ -41,7 +41,7 @@ Signed-off-by: Stoiko Ivanov 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/libzfs/libzfs_pool.c b/lib/libzfs/libzfs_pool.c -index db5cd6dc00ac4882f3877b5b3bd4ac50967626b3..1b59b50cbd1cff7b14e79f10fd8bb8564e8e0e7e 100644 +index 42a1ddcf28a62efb17f45d1a7870248bcdbb7ca3..9420c346431d7841a8edebf5e60075a6cfd1516f 100644 --- a/lib/libzfs/libzfs_pool.c +++ b/lib/libzfs/libzfs_pool.c @@ -2797,8 +2797,11 @@ zpool_scan_range(zpool_handle_t *zhp, pool_scan_func_t func, diff --git a/debian/patches/0018-Add-no-preserve-encryption-flag.patch b/debian/patches/0010-Add-no-preserve-encryption-flag.patch similarity index 98% rename from debian/patches/0018-Add-no-preserve-encryption-flag.patch rename to debian/patches/0010-Add-no-preserve-encryption-flag.patch index ccb160f3f..0343a443b 100644 --- a/debian/patches/0018-Add-no-preserve-encryption-flag.patch +++ b/debian/patches/0010-Add-no-preserve-encryption-flag.patch @@ -21,7 +21,7 @@ Closes #18240 5 files changed, 62 insertions(+), 22 deletions(-) diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c -index d39b6fe5f76b4d8cb4169718c753b994870560bb..9b5891e0c86bc5621886ef9e8edc0c784a573802 100644 +index ce948951a028a22ba21aba87035ae4b64b443fb9..7cd9a3479d549973ff842386f760b27ab9ad5636 100644 --- a/cmd/zfs/zfs_main.c +++ b/cmd/zfs/zfs_main.c @@ -345,10 +345,10 @@ get_usage(zfs_help_t idx) @@ -76,7 +76,7 @@ index 14930fb90622b706d7c45991817746a61e0fdd2d..c67d5f353e99b4273728ccffde1f4db6 typedef boolean_t (snapfilter_cb_t)(zfs_handle_t *, void *); diff --git a/lib/libzfs/libzfs_sendrecv.c b/lib/libzfs/libzfs_sendrecv.c -index 0e5cecc6cca9e78e7eb015000b010bab8fa2e36c..9d693223e1c854e94b7b5a0fcf11b089c077caf5 100644 +index 2c38333e18a19c4750f6219d11020096581fbb1d..fb446516d81563227664e9dc039abc2fcaa7e7e0 100644 --- a/lib/libzfs/libzfs_sendrecv.c +++ b/lib/libzfs/libzfs_sendrecv.c @@ -258,6 +258,7 @@ typedef struct send_data { diff --git a/debian/patches/0010-Linux-7.0-explicitly-set-setlease-handler-to-kernel-.patch b/debian/patches/0010-Linux-7.0-explicitly-set-setlease-handler-to-kernel-.patch deleted file mode 100644 index 11cc352e0..000000000 --- a/debian/patches/0010-Linux-7.0-explicitly-set-setlease-handler-to-kernel-.patch +++ /dev/null @@ -1,464 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Rob Norris -Date: Mon, 23 Feb 2026 06:39:06 +1100 -Subject: [PATCH] Linux 7.0: explicitly set setlease handler to kernel - implementation - -The upcoming 7.0 kernel will no longer fall back to generic_setlease(), -instead returning EINVAL if .setlease is NULL. So, we set it explicitly. - -To ensure that we catch any future kernel change, adds a sanity test for -F_SETLEASE and F_GETLEASE too. Since this is a Linux-specific test, -also a small adjustment to the test runner to allow OS-specific helper -programs. - -Sponsored-by: TrueNAS -Reviewed-by: Tony Hutter -Reviewed-by: Brian Behlendorf -Signed-off-by: Rob Norris -Closes #18215 -(cherry picked from commit 168023b60316badde853a8264b3bdbe071bab0c1) -Signed-off-by: Thomas Lamprecht ---- - config/kernel-filelock.m4 | 23 ++++ - config/kernel.m4 | 2 + - module/os/linux/zfs/zpl_file.c | 4 + - scripts/zfs-tests.sh | 16 ++- - tests/runfiles/linux.run | 4 + - tests/zfs-tests/cmd/.gitignore | 1 + - tests/zfs-tests/cmd/Makefile.am | 1 + - tests/zfs-tests/cmd/setlease.c | 126 ++++++++++++++++++ - tests/zfs-tests/include/commands.cfg | 5 +- - tests/zfs-tests/tests/Makefile.am | 3 + - .../tests/functional/lease/cleanup.ksh | 26 ++++ - .../tests/functional/lease/lease_setlease.ksh | 44 ++++++ - .../tests/functional/lease/setup.ksh | 27 ++++ - 13 files changed, 275 insertions(+), 7 deletions(-) - create mode 100644 config/kernel-filelock.m4 - create mode 100644 tests/zfs-tests/cmd/setlease.c - create mode 100755 tests/zfs-tests/tests/functional/lease/cleanup.ksh - create mode 100755 tests/zfs-tests/tests/functional/lease/lease_setlease.ksh - create mode 100755 tests/zfs-tests/tests/functional/lease/setup.ksh - -diff --git a/config/kernel-filelock.m4 b/config/kernel-filelock.m4 -new file mode 100644 -index 0000000000000000000000000000000000000000..5e8d7c78469227eb769a91a3a8add4d55c1ba58c ---- /dev/null -+++ b/config/kernel-filelock.m4 -@@ -0,0 +1,23 @@ -+dnl # SPDX-License-Identifier: CDDL-1.0 -+dnl # -+dnl # 6.3 API change -+dnl # locking support functions (eg generic_setlease) were moved out of -+dnl # linux/fs.h to linux/filelock.h -+dnl # -+AC_DEFUN([ZFS_AC_KERNEL_SRC_FILELOCK_HEADER], [ -+ ZFS_LINUX_TEST_SRC([filelock_header], [ -+ #include -+ #include -+ ], []) -+]) -+ -+AC_DEFUN([ZFS_AC_KERNEL_FILELOCK_HEADER], [ -+ AC_MSG_CHECKING([for standalone filelock header]) -+ ZFS_LINUX_TEST_RESULT([filelock_header], [ -+ AC_MSG_RESULT(yes) -+ AC_DEFINE(HAVE_FILELOCK_HEADER, 1, [linux/filelock.h exists]) -+ ], [ -+ AC_MSG_RESULT(no) -+ ]) -+]) -+ -diff --git a/config/kernel.m4 b/config/kernel.m4 -index eb2e827d5cbf92537993d6d79340431e7b6a3b35..df168506691dec7b9479da12e9ac9e08694853c4 100644 ---- a/config/kernel.m4 -+++ b/config/kernel.m4 -@@ -140,6 +140,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [ - ZFS_AC_KERNEL_SRC_NAMESPACE - ZFS_AC_KERNEL_SRC_INODE_GENERIC_DROP - ZFS_AC_KERNEL_SRC_KASAN_ENABLED -+ ZFS_AC_KERNEL_SRC_FILELOCK_HEADER - case "$host_cpu" in - powerpc*) - ZFS_AC_KERNEL_SRC_CPU_HAS_FEATURE -@@ -264,6 +265,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [ - ZFS_AC_KERNEL_NAMESPACE - ZFS_AC_KERNEL_INODE_GENERIC_DROP - ZFS_AC_KERNEL_KASAN_ENABLED -+ ZFS_AC_KERNEL_FILELOCK_HEADER - case "$host_cpu" in - powerpc*) - ZFS_AC_KERNEL_CPU_HAS_FEATURE -diff --git a/module/os/linux/zfs/zpl_file.c b/module/os/linux/zfs/zpl_file.c -index f7691c02d1634164c751df9eab36a641fc53a86e..30f3e3855355332aa10402791429cb4dc326f077 100644 ---- a/module/os/linux/zfs/zpl_file.c -+++ b/module/os/linux/zfs/zpl_file.c -@@ -43,6 +43,9 @@ - #ifdef HAVE_VFS_FILEMAP_DIRTY_FOLIO - #include - #endif -+#ifdef HAVE_FILELOCK_HEADER -+#include -+#endif - - /* - * When using fallocate(2) to preallocate space, inflate the requested -@@ -1242,6 +1245,7 @@ const struct file_operations zpl_file_operations = { - .mmap = zpl_mmap, - .fsync = zpl_fsync, - .fallocate = zpl_fallocate, -+ .setlease = generic_setlease, - .copy_file_range = zpl_copy_file_range, - #ifdef HAVE_VFS_CLONE_FILE_RANGE - .clone_file_range = zpl_clone_file_range, -diff --git a/scripts/zfs-tests.sh b/scripts/zfs-tests.sh -index 09a15bafc27e87a036d547832d80549ffc7da5a6..697c3f304d8150b157935b08e161e7aec531fa54 100755 ---- a/scripts/zfs-tests.sh -+++ b/scripts/zfs-tests.sh -@@ -294,6 +294,16 @@ constrain_path() { - SYSTEM_DIRS="/usr/local/bin /usr/local/sbin" - SYSTEM_DIRS="$SYSTEM_DIRS /usr/bin /usr/sbin /bin /sbin $LIBEXEC_DIR" - -+ SYSTEM_FILES="$SYSTEM_FILES_COMMON" -+ ZFSTEST_FILES="$ZFSTEST_FILES_COMMON" -+ if [ "$UNAME" = "FreeBSD" ] ; then -+ SYSTEM_FILES="$SYSTEM_FILES $SYSTEM_FILES_FREEBSD" -+ ZFSTEST_FILES="$ZFSTEST_FILES $ZFSTEST_FILES_FREEBSD" -+ else -+ SYSTEM_FILES="$SYSTEM_FILES $SYSTEM_FILES_LINUX" -+ ZFSTEST_FILES="$ZFSTEST_FILES $ZFSTEST_FILES_LINUX" -+ fi -+ - if [ "$INTREE" = "yes" ]; then - # Constrained path set to $(top_builddir)/tests/zfs-tests/bin - STF_PATH="$BIN_DIR" -@@ -326,12 +336,6 @@ constrain_path() { - fi - - # Standard system utilities -- SYSTEM_FILES="$SYSTEM_FILES_COMMON" -- if [ "$UNAME" = "FreeBSD" ] ; then -- SYSTEM_FILES="$SYSTEM_FILES $SYSTEM_FILES_FREEBSD" -- else -- SYSTEM_FILES="$SYSTEM_FILES $SYSTEM_FILES_LINUX" -- fi - create_links "$SYSTEM_DIRS" "$SYSTEM_FILES" - - # Exceptions -diff --git a/tests/runfiles/linux.run b/tests/runfiles/linux.run -index a65633dd8cfb276ff68894f4bcd3ecffcc1bc862..2717bf53d0b1ad1fbb5447a0d8ee20d98efff54b 100644 ---- a/tests/runfiles/linux.run -+++ b/tests/runfiles/linux.run -@@ -141,6 +141,10 @@ pre = - post = - tags = ['functional', 'largest_pool'] - -+[tests/functional/lease:Linux] -+tests = ['lease_setlease'] -+tags = ['functional', 'lease'] -+ - [tests/functional/longname:Linux] - tests = ['longname_001_pos', 'longname_002_pos', 'longname_003_pos'] - tags = ['functional', 'longname'] -diff --git a/tests/zfs-tests/cmd/.gitignore b/tests/zfs-tests/cmd/.gitignore -index 62f1684acfb4bfafe8e511e2d69f1af13b73ced1..335e4ceba28200b137abce25038a8989263c7663 100644 ---- a/tests/zfs-tests/cmd/.gitignore -+++ b/tests/zfs-tests/cmd/.gitignore -@@ -58,3 +58,4 @@ - /sha2_test - /idmap_util - /statx -+/setlease -diff --git a/tests/zfs-tests/cmd/Makefile.am b/tests/zfs-tests/cmd/Makefile.am -index 85c3cf3c35a8cdfb6ba7f95ab48d942cdc85e0d9..f07e7fda14fd2c63b500dc14b08922373ea1a189 100644 ---- a/tests/zfs-tests/cmd/Makefile.am -+++ b/tests/zfs-tests/cmd/Makefile.am -@@ -132,6 +132,7 @@ scripts_zfs_tests_bin_PROGRAMS += %D%/statx - scripts_zfs_tests_bin_PROGRAMS += %D%/xattrtest - scripts_zfs_tests_bin_PROGRAMS += %D%/zed_fd_spill-zedlet - scripts_zfs_tests_bin_PROGRAMS += %D%/idmap_util -+scripts_zfs_tests_bin_PROGRAMS += %D%/setlease - - %C%_idmap_util_LDADD = libspl.la - -diff --git a/tests/zfs-tests/cmd/setlease.c b/tests/zfs-tests/cmd/setlease.c -new file mode 100644 -index 0000000000000000000000000000000000000000..12bcbd91beb53750a616aa1604a5d7bd9450af6c ---- /dev/null -+++ b/tests/zfs-tests/cmd/setlease.c -@@ -0,0 +1,126 @@ -+// SPDX-License-Identifier: CDDL-1.0 -+/* -+ * CDDL HEADER START -+ * -+ * The contents of this file are subject to the terms of the -+ * Common Development and Distribution License (the "License"). -+ * You may not use this file except in compliance with the License. -+ * -+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -+ * or https://opensource.org/licenses/CDDL-1.0. -+ * See the License for the specific language governing permissions -+ * and limitations under the License. -+ * -+ * When distributing Covered Code, include this CDDL HEADER in each -+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE. -+ * If applicable, add the following below this CDDL HEADER, with the -+ * fields enclosed by brackets "[]" replaced with your own identifying -+ * information: Portions Copyright [yyyy] [name of copyright owner] -+ * -+ * CDDL HEADER END -+ */ -+ -+/* -+ * Copyright (c) 2026, TrueNAS. -+ */ -+ -+/* -+ * This is a sanity check test for the F_SETLEASE and F_GETLEASE fcntl() calls. -+ * We use the generic kernel implementation, but we want to be alerted if it -+ * ever breaks. -+ * -+ * This is not a comprehensive test. It would be nice if it could be! -+ */ -+ -+#ifndef _GNU_SOURCE -+#define _GNU_SOURCE -+#endif -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static int -+get_lease(int fd) { -+ int r = fcntl(fd, F_GETLEASE); -+ if (r < 0) { -+ perror("fcntl(GETLEASE)"); -+ exit(2); -+ } -+ return (r); -+} -+ -+static int -+set_lease(int fd, int lease) { -+ return (fcntl(fd, F_SETLEASE, lease) < 0 ? errno : 0); -+} -+ -+static const char *lease_str[] = { -+ [F_RDLCK] = "RDLCK", -+ [F_WRLCK] = "WRLCK", -+ [F_UNLCK] = "UNLCK", -+}; -+ -+static void -+assert_lease(int fd, int expect) { -+ int got = get_lease(fd); -+ if (got != expect) { -+ fprintf(stderr, "ASSERT_LEASE: expected %s [%d], got %s [%d]\n", -+ lease_str[expect], expect, lease_str[got], got); -+ abort(); -+ } -+ printf("ok: lease is %s\n", lease_str[got]); -+} -+ -+static void -+assert_set_lease(int fd, int lease) { -+ int err = set_lease(fd, lease); -+ if (err != 0) { -+ fprintf(stderr, "ASSERT_SET_LEASE: tried %s [%d], error: %s\n", -+ lease_str[lease], lease, strerror(err)); -+ abort(); -+ } -+ printf("ok: set lease to %s\n", lease_str[lease]); -+} -+ -+int -+main(int argc, char **argv) -+{ -+ if (argc != 2) { -+ fprintf(stderr, "usage: %s \n", argv[0]); -+ exit(1); -+ } -+ -+ /* create and open file, read+write */ -+ int fd = open(argv[1], O_CREAT|O_RDONLY, S_IRWXU|S_IRWXG|S_IRWXO); -+ if (fd < 0) { -+ perror("open"); -+ exit(2); -+ } -+ printf("ok: opened file RDONLY\n"); -+ -+ /* fd starts with no lease */ -+ assert_lease(fd, F_UNLCK); -+ -+ /* fd is readonly, so can take read lease */ -+ assert_set_lease(fd, F_RDLCK); -+ /* confirm read lease */ -+ assert_lease(fd, F_RDLCK); -+ -+ /* no other openers, so can take write lease */ -+ assert_set_lease(fd, F_WRLCK); -+ /* confirm write lease */ -+ assert_lease(fd, F_WRLCK); -+ -+ /* release lease */ -+ assert_set_lease(fd, F_UNLCK); -+ /* confirm lease released */ -+ assert_lease(fd, F_UNLCK); -+ -+ close(fd); -+ -+ return (0); -+} -diff --git a/tests/zfs-tests/include/commands.cfg b/tests/zfs-tests/include/commands.cfg -index 1c4d25e152a73d3ea17d59280b66b0df7ef65c37..4ba9aa7c8b676975cb147fc74124488097936823 100644 ---- a/tests/zfs-tests/include/commands.cfg -+++ b/tests/zfs-tests/include/commands.cfg -@@ -182,7 +182,7 @@ export ZFS_FILES='zdb - zfs_ids_to_path - zpool_influxdb' - --export ZFSTEST_FILES='badsend -+export ZFSTEST_FILES_COMMON='badsend - btree_test - chg_usr_exec - clonefile -@@ -241,3 +241,6 @@ export ZFSTEST_FILES='badsend - zfs_diff-socket - dosmode_readonly_write - idmap_util' -+ -+export ZFSTEST_FILES_LINUX=' -+ setlease' -diff --git a/tests/zfs-tests/tests/Makefile.am b/tests/zfs-tests/tests/Makefile.am -index 99477a74326a5e47bffabdcd89c850f9a3ed3cf4..d14592ffa5d69e37b098213d2ccd97ae0a9d83d5 100644 ---- a/tests/zfs-tests/tests/Makefile.am -+++ b/tests/zfs-tests/tests/Makefile.am -@@ -1655,6 +1655,9 @@ nobase_dist_datadir_zfs_tests_tests_SCRIPTS += \ - functional/io/psync.ksh \ - functional/io/setup.ksh \ - functional/io/sync.ksh \ -+ functional/lease/cleanup.ksh \ -+ functional/lease/lease_setlease.ksh \ -+ functional/lease/setup.ksh \ - functional/l2arc/cleanup.ksh \ - functional/l2arc/l2arc_arcstats_pos.ksh \ - functional/l2arc/l2arc_l2miss_pos.ksh \ -diff --git a/tests/zfs-tests/tests/functional/lease/cleanup.ksh b/tests/zfs-tests/tests/functional/lease/cleanup.ksh -new file mode 100755 -index 0000000000000000000000000000000000000000..5e73dd34936e1c6ebc7c1c8a1a7d8274677a4191 ---- /dev/null -+++ b/tests/zfs-tests/tests/functional/lease/cleanup.ksh -@@ -0,0 +1,26 @@ -+#!/bin/ksh -p -+# SPDX-License-Identifier: CDDL-1.0 -+# -+# CDDL HEADER START -+# -+# The contents of this file are subject to the terms of the -+# Common Development and Distribution License (the "License"). -+# You may not use this file except in compliance with the License. -+# -+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -+# or https://opensource.org/licenses/CDDL-1.0. -+# See the License for the specific language governing permissions -+# and limitations under the License. -+# -+# When distributing Covered Code, include this CDDL HEADER in each -+# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -+# If applicable, add the following below this CDDL HEADER, with the -+# fields enclosed by brackets "[]" replaced with your own identifying -+# information: Portions Copyright [yyyy] [name of copyright owner] -+# -+# CDDL HEADER END -+# -+ -+. $STF_SUITE/include/libtest.shlib -+ -+default_cleanup -diff --git a/tests/zfs-tests/tests/functional/lease/lease_setlease.ksh b/tests/zfs-tests/tests/functional/lease/lease_setlease.ksh -new file mode 100755 -index 0000000000000000000000000000000000000000..8647d01995c32f58d3e37fafea0013b7795af0d7 ---- /dev/null -+++ b/tests/zfs-tests/tests/functional/lease/lease_setlease.ksh -@@ -0,0 +1,44 @@ -+#!/bin/ksh -p -+# SPDX-License-Identifier: CDDL-1.0 -+# -+# CDDL HEADER START -+# -+# The contents of this file are subject to the terms of the -+# Common Development and Distribution License (the "License"). -+# You may not use this file except in compliance with the License. -+# -+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -+# or https://opensource.org/licenses/CDDL-1.0. -+# See the License for the specific language governing permissions -+# and limitations under the License. -+# -+# When distributing Covered Code, include this CDDL HEADER in each -+# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -+# If applicable, add the following below this CDDL HEADER, with the -+# fields enclosed by brackets "[]" replaced with your own identifying -+# information: Portions Copyright [yyyy] [name of copyright owner] -+# -+# CDDL HEADER END -+# -+ -+# -+# Copyright (c) 2026, TrueNAS. -+# -+ -+. $STF_SUITE/include/libtest.shlib -+ -+verify_runnable "both" -+ -+leasefile=/$TESTPOOL/leasefile -+ -+function cleanup -+{ -+ rm -f $leasefile -+} -+ -+log_assert "F_SETLEASE is supported" -+log_onexit cleanup -+ -+log_must setlease $leasefile -+ -+log_pass "F_SETLEASE is supported" -diff --git a/tests/zfs-tests/tests/functional/lease/setup.ksh b/tests/zfs-tests/tests/functional/lease/setup.ksh -new file mode 100755 -index 0000000000000000000000000000000000000000..09da91b0f93f70f98a91107ca687549801a67074 ---- /dev/null -+++ b/tests/zfs-tests/tests/functional/lease/setup.ksh -@@ -0,0 +1,27 @@ -+#!/bin/ksh -p -+# SPDX-License-Identifier: CDDL-1.0 -+# -+# CDDL HEADER START -+# -+# The contents of this file are subject to the terms of the -+# Common Development and Distribution License (the "License"). -+# You may not use this file except in compliance with the License. -+# -+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -+# or https://opensource.org/licenses/CDDL-1.0. -+# See the License for the specific language governing permissions -+# and limitations under the License. -+# -+# When distributing Covered Code, include this CDDL HEADER in each -+# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -+# If applicable, add the following below this CDDL HEADER, with the -+# fields enclosed by brackets "[]" replaced with your own identifying -+# information: Portions Copyright [yyyy] [name of copyright owner] -+# -+# CDDL HEADER END -+# -+ -+. $STF_SUITE/include/libtest.shlib -+ -+DISK=${DISKS%% *} -+default_setup $DISK diff --git a/debian/patches/0011-Linux-7.0-blk_queue_nonrot-renamed-to-blk_queue_rot.patch b/debian/patches/0011-Linux-7.0-blk_queue_nonrot-renamed-to-blk_queue_rot.patch deleted file mode 100644 index 8c5c17946..000000000 --- a/debian/patches/0011-Linux-7.0-blk_queue_nonrot-renamed-to-blk_queue_rot.patch +++ /dev/null @@ -1,86 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Rob Norris -Date: Thu, 5 Feb 2026 19:39:23 +1100 -Subject: [PATCH] Linux 7.0: blk_queue_nonrot() renamed to blk_queue_rot() - -It does exactly the same thing, just inverts the return. Detect its -presence or absence and call the right one. - -Sponsored-by: TrueNAS -Reviewed-by: Tony Hutter -Reviewed-by: Brian Behlendorf -Signed-off-by: Rob Norris -Closes #18216 -(cherry picked from commit 204de946ebd1e540efe0067f3b880daf0795c1fb) -Signed-off-by: Thomas Lamprecht ---- - config/kernel-blk-queue.m4 | 26 ++++++++++++++++++++++++++ - module/os/linux/zfs/vdev_disk.c | 4 ++++ - 2 files changed, 30 insertions(+) - -diff --git a/config/kernel-blk-queue.m4 b/config/kernel-blk-queue.m4 -index cd2b143e89a0892af2e7a1cc40154cfcf1210d44..c6479b51da8c0faef6f54687149644d6cf321e9e 100644 ---- a/config/kernel-blk-queue.m4 -+++ b/config/kernel-blk-queue.m4 -@@ -225,6 +225,30 @@ AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_MAX_HW_SECTORS], [ - ]) - ]) - -+dnl # -+dnl # 7.0 API change -+dnl # blk_queue_rot() replaces blk_queue_nonrot() (inverted meaning) -+dnl # -+AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_ROT], [ -+ ZFS_LINUX_TEST_SRC([blk_queue_rot], [ -+ #include -+ ], [ -+ struct request_queue *q __attribute__ ((unused)) = NULL; -+ (void) blk_queue_rot(q); -+ ], []) -+]) -+ -+AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_ROT], [ -+ AC_MSG_CHECKING([whether blk_queue_rot() is available]) -+ ZFS_LINUX_TEST_RESULT([blk_queue_rot], [ -+ AC_MSG_RESULT(yes) -+ AC_DEFINE(HAVE_BLK_QUEUE_ROT, 1, -+ [blk_queue_rot() is available]) -+ ],[ -+ AC_MSG_RESULT(no) -+ ]) -+]) -+ - dnl # - dnl # 2.6.34 API change - dnl # blk_queue_max_segments() consolidates blk_queue_max_hw_segments() -@@ -278,6 +302,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE], [ - ZFS_AC_KERNEL_SRC_BLK_QUEUE_SECURE_ERASE - ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_HW_SECTORS - ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_SEGMENTS -+ ZFS_AC_KERNEL_SRC_BLK_QUEUE_ROT - ZFS_AC_KERNEL_SRC_BLK_MQ_RQ_HCTX - ]) - -@@ -290,5 +315,6 @@ AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE], [ - ZFS_AC_KERNEL_BLK_QUEUE_SECURE_ERASE - ZFS_AC_KERNEL_BLK_QUEUE_MAX_HW_SECTORS - ZFS_AC_KERNEL_BLK_QUEUE_MAX_SEGMENTS -+ ZFS_AC_KERNEL_BLK_QUEUE_ROT - ZFS_AC_KERNEL_BLK_MQ_RQ_HCTX - ]) -diff --git a/module/os/linux/zfs/vdev_disk.c b/module/os/linux/zfs/vdev_disk.c -index 1bd3500e9f6665b0b23878ca575e57161a5031a7..ab7457b04e2e3bd30167a61f28f6c1aa24bdf8a6 100644 ---- a/module/os/linux/zfs/vdev_disk.c -+++ b/module/os/linux/zfs/vdev_disk.c -@@ -445,7 +445,11 @@ vdev_disk_open(vdev_t *v, uint64_t *psize, uint64_t *max_psize, - v->vdev_has_securetrim = bdev_secure_discard_supported(bdev); - - /* Inform the ZIO pipeline that we are non-rotational */ -+#ifdef HAVE_BLK_QUEUE_ROT -+ v->vdev_nonrot = !blk_queue_rot(bdev_get_queue(bdev)); -+#else - v->vdev_nonrot = blk_queue_nonrot(bdev_get_queue(bdev)); -+#endif - - /* Physical volume size in bytes for the partition */ - *psize = bdev_capacity(bdev); diff --git a/debian/patches/0012-Linux-7.0-posix_acl_to_xattr-now-allocates-memory.patch b/debian/patches/0012-Linux-7.0-posix_acl_to_xattr-now-allocates-memory.patch deleted file mode 100644 index 924884801..000000000 --- a/debian/patches/0012-Linux-7.0-posix_acl_to_xattr-now-allocates-memory.patch +++ /dev/null @@ -1,115 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Rob Norris -Date: Tue, 27 Jan 2026 16:49:59 +1100 -Subject: [PATCH] Linux 7.0: posix_acl_to_xattr() now allocates memory - -Kernel devs noted that almost all callers to posix_acl_to_xattr() would -check the ACL value size and allocate a buffer before make the call. To -reduce the repetition, they've changed it to allocate this buffer -internally and return it. - -Unfortunately that's not true for us; most of our calls are from -xattr_handler->get() to convert a stored ACL to an xattr, and that call -provides a buffer. For now we have no other option, so this commit -detects the new version and wraps to copy the value back into the -provided buffer and then free it. - -Sponsored-by: TrueNAS -Reviewed-by: Tony Hutter -Reviewed-by: Brian Behlendorf -Signed-off-by: Rob Norris -Closes #18216 -(cherry picked from commit d34fd6cff3ac882a0f26cb6bdd5a5b1c189c0e82) -Signed-off-by: Thomas Lamprecht ---- - config/kernel-acl.m4 | 31 ++++++++++++++++++++ - include/os/linux/kernel/linux/xattr_compat.h | 17 +++++++++++ - 2 files changed, 48 insertions(+) - -diff --git a/config/kernel-acl.m4 b/config/kernel-acl.m4 -index 3dbd97948189c1af6487a3ce1d035b46fc0e993e..4393e3ab8b5e0175434f5dc61fdb224ae713774b 100644 ---- a/config/kernel-acl.m4 -+++ b/config/kernel-acl.m4 -@@ -21,6 +21,35 @@ AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T], [ - ]) - ]) - -+dnl # -+dnl # 7.0 API change -+dnl # posix_acl_to_xattr() now allocates and returns the value. -+dnl # -+AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_TO_XATTR_ALLOC], [ -+ ZFS_LINUX_TEST_SRC([posix_acl_to_xattr_alloc], [ -+ #include -+ #include -+ ], [ -+ struct user_namespace *ns = NULL; -+ struct posix_acl *acl = NULL; -+ size_t size = 0; -+ gfp_t gfp = 0; -+ void *xattr = NULL; -+ xattr = posix_acl_to_xattr(ns, acl, &size, gfp); -+ ]) -+]) -+ -+AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_TO_XATTR_ALLOC], [ -+ AC_MSG_CHECKING([whether posix_acl_to_xattr() allocates its result]); -+ ZFS_LINUX_TEST_RESULT([posix_acl_to_xattr_alloc], [ -+ AC_MSG_RESULT(yes) -+ AC_DEFINE(HAVE_POSIX_ACL_TO_XATTR_ALLOC, 1, -+ [posix_acl_to_xattr() allocates its result]) -+ ], [ -+ AC_MSG_RESULT(no) -+ ]) -+]) -+ - dnl # - dnl # 3.1 API change, - dnl # Check if inode_operations contains the function get_acl -@@ -173,12 +202,14 @@ AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_SET_ACL], [ - - AC_DEFUN([ZFS_AC_KERNEL_SRC_ACL], [ - ZFS_AC_KERNEL_SRC_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T -+ ZFS_AC_KERNEL_SRC_POSIX_ACL_TO_XATTR_ALLOC - ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_GET_ACL - ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_SET_ACL - ]) - - AC_DEFUN([ZFS_AC_KERNEL_ACL], [ - ZFS_AC_KERNEL_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T -+ ZFS_AC_KERNEL_POSIX_ACL_TO_XATTR_ALLOC - ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL - ZFS_AC_KERNEL_INODE_OPERATIONS_SET_ACL - ]) -diff --git a/include/os/linux/kernel/linux/xattr_compat.h b/include/os/linux/kernel/linux/xattr_compat.h -index f2f7e1ed017f6002ff2f1b59de25dc3dd6a04785..39645c19094f13b16e12f98ff7afa532b6105d4f 100644 ---- a/include/os/linux/kernel/linux/xattr_compat.h -+++ b/include/os/linux/kernel/linux/xattr_compat.h -@@ -130,10 +130,27 @@ zpl_acl_from_xattr(const void *value, int size) - return (posix_acl_from_xattr(kcred->user_ns, value, size)); - } - -+/* -+ * Linux 7.0 API change. posix_acl_to_xattr() changed from filling the -+ * caller-provided buffer to allocating a buffer with enough space and -+ * returning it. We wrap this up by copying the result into the provided -+ * buffer and freeing the allocated buffer. -+ */ - static inline int - zpl_acl_to_xattr(struct posix_acl *acl, void *value, int size) - { -+#ifdef HAVE_POSIX_ACL_TO_XATTR_ALLOC -+ size_t s = 0; -+ void *v = posix_acl_to_xattr(kcred->user_ns, acl, &s, -+ kmem_flags_convert(KM_SLEEP)); -+ if (v == NULL) -+ return (-ENOMEM); -+ memcpy(value, v, MIN(size, s)); -+ kfree(v); -+ return (0); -+#else - return (posix_acl_to_xattr(kcred->user_ns, acl, value, size)); -+#endif - } - - #endif /* _ZFS_XATTR_H */ diff --git a/debian/patches/0013-Linux-7.0-add-shims-for-the-fs_context-based-mount-A.patch b/debian/patches/0013-Linux-7.0-add-shims-for-the-fs_context-based-mount-A.patch deleted file mode 100644 index 73ccba85a..000000000 --- a/debian/patches/0013-Linux-7.0-add-shims-for-the-fs_context-based-mount-A.patch +++ /dev/null @@ -1,153 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Rob Norris -Date: Mon, 26 Jan 2026 11:21:25 +1100 -Subject: [PATCH] Linux 7.0: add shims for the fs_context-based mount API - -The traditional mount API has been removed, so detect when its not -available and instead use a small adapter to allow our existing mount -functions to keep working. - -Sponsored-by: TrueNAS -Reviewed-by: Tony Hutter -Reviewed-by: Brian Behlendorf -Signed-off-by: Rob Norris -Closes #18216 -(cherry picked from commit 0f608aa6ca323e503cba6843320b1dab3b004896) -Signed-off-by: Thomas Lamprecht ---- - config/kernel-fst-mount.m4 | 7 +++- - module/os/linux/zfs/zpl_super.c | 66 +++++++++++++++++++++++++++++++++ - 2 files changed, 72 insertions(+), 1 deletion(-) - -diff --git a/config/kernel-fst-mount.m4 b/config/kernel-fst-mount.m4 -index 576f5f0129c555b418668762cf183c165b3bf05a..798acf19b79d22adfc59a48a832af757fc4fb47f 100644 ---- a/config/kernel-fst-mount.m4 -+++ b/config/kernel-fst-mount.m4 -@@ -3,6 +3,10 @@ dnl # 2.6.38 API change - dnl # The .get_sb callback has been replaced by a .mount callback - dnl # in the file_system_type structure. - dnl # -+dnl # 7.0 API change -+dnl # The .mount callback has been removed, requiring all mount work -+dnl # to be done through the "new" mount API introduced in 5.2. -+dnl # - AC_DEFUN([ZFS_AC_KERNEL_SRC_FST_MOUNT], [ - ZFS_LINUX_TEST_SRC([file_system_type_mount], [ - #include -@@ -24,7 +28,8 @@ AC_DEFUN([ZFS_AC_KERNEL_FST_MOUNT], [ - AC_MSG_CHECKING([whether fst->mount() exists]) - ZFS_LINUX_TEST_RESULT([file_system_type_mount], [ - AC_MSG_RESULT(yes) -+ AC_DEFINE(HAVE_FST_MOUNT, 1, [fst->mount() exists]) - ],[ -- ZFS_LINUX_TEST_ERROR([fst->mount()]) -+ AC_MSG_RESULT(no) - ]) - ]) -diff --git a/module/os/linux/zfs/zpl_super.c b/module/os/linux/zfs/zpl_super.c -index 347b352506e54b0a5b5ff2b3d8fd3d549941183c..d509152b692133f5dd0339e750dba50160e37232 100644 ---- a/module/os/linux/zfs/zpl_super.c -+++ b/module/os/linux/zfs/zpl_super.c -@@ -24,6 +24,7 @@ - * Copyright (c) 2023, Datto Inc. All rights reserved. - * Copyright (c) 2025, Klara, Inc. - * Copyright (c) 2025, Rob Norris -+ * Copyright (c) 2026, TrueNAS. - */ - - -@@ -36,6 +37,10 @@ - #include - #include - -+#ifndef HAVE_FST_MOUNT -+#include -+#endif -+ - /* - * What to do when the last reference to an inode is released. If 0, the kernel - * will cache it on the superblock. If 1, the inode will be freed immediately. -@@ -504,6 +509,61 @@ zpl_prune_sb(uint64_t nr_to_scan, void *arg) - #endif - } - -+#ifndef HAVE_FST_MOUNT -+/* -+ * In kernel 7.0, the file_system_type->mount() and -+ * super_operations->remount_fs() callbacks have been removed, requiring all -+ * users to convert to the "new" fs_context-based mount API introduced in 5.2. -+ * -+ * This is the simplest compatibility shim possible to adapt the fs_context -+ * interface to the old-style calls. Although this interface exists in almost -+ * all versions of Linux currently supported by OpenZFS, we only use it when -+ * the kernel-provided shims are unavailable, to avoid bugs in these new shims -+ * affecting all OpenZFS deployments. -+ */ -+static int -+zpl_parse_monolithic(struct fs_context *fc, void *data) -+{ -+ /* -+ * We do options parsing in zfs_domount(); just stash the options blob -+ * in the fs_context so we can pass it down later. -+ */ -+ fc->fs_private = data; -+ return (0); -+} -+ -+static int -+zpl_get_tree(struct fs_context *fc) -+{ -+ struct dentry *root = -+ zpl_mount(fc->fs_type, fc->sb_flags, fc->source, fc->fs_private); -+ if (IS_ERR(root)) -+ return (PTR_ERR(root)); -+ -+ fc->root = root; -+ return (0); -+} -+ -+static int -+zpl_reconfigure(struct fs_context *fc) -+{ -+ return (zpl_remount_fs(fc->root->d_sb, &fc->sb_flags, fc->fs_private)); -+} -+ -+const struct fs_context_operations zpl_fs_context_operations = { -+ .parse_monolithic = zpl_parse_monolithic, -+ .get_tree = zpl_get_tree, -+ .reconfigure = zpl_reconfigure, -+}; -+ -+static int -+zpl_init_fs_context(struct fs_context *fc) -+{ -+ fc->ops = &zpl_fs_context_operations; -+ return (0); -+} -+#endif -+ - const struct super_operations zpl_super_operations = { - .alloc_inode = zpl_inode_alloc, - #ifdef HAVE_SOPS_FREE_INODE -@@ -517,7 +577,9 @@ const struct super_operations zpl_super_operations = { - .put_super = zpl_put_super, - .sync_fs = zpl_sync_fs, - .statfs = zpl_statfs, -+#ifdef HAVE_FST_MOUNT - .remount_fs = zpl_remount_fs, -+#endif - .show_devname = zpl_show_devname, - .show_options = zpl_show_options, - .show_stats = NULL, -@@ -560,7 +622,11 @@ struct file_system_type zpl_fs_type = { - #else - .fs_flags = FS_USERNS_MOUNT, - #endif -+#ifdef HAVE_FST_MOUNT - .mount = zpl_mount, -+#else -+ .init_fs_context = zpl_init_fs_context, -+#endif - .kill_sb = zpl_kill_sb, - }; - diff --git a/debian/patches/0014-Linux-7.0-also-set-setlease-handler-on-directories-1.patch b/debian/patches/0014-Linux-7.0-also-set-setlease-handler-on-directories-1.patch deleted file mode 100644 index 819c0726a..000000000 --- a/debian/patches/0014-Linux-7.0-also-set-setlease-handler-on-directories-1.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Rob Norris -Date: Wed, 18 Mar 2026 09:28:30 +1100 -Subject: [PATCH] Linux 7.0: also set setlease handler on directories (#18331) - -It turns out the kernel can also take directory leases, most notably in -the NFS server. Without a setlease handler on the directory file ops, -attempts to open a directory over NFS can fail with EINVAL. - -Adding a directory setlease handler was missed in 168023b603. This fixes -that, allowing directories to be properly accessed over NFS. - -Sponsored-by: TrueNAS -Reported-by: Satadru Pramanik - -Signed-off-by: Rob Norris -Reviewed-by: Alexander Motin -Reviewed-by: Brian Behlendorf -(cherry picked from commit d8c08a1cea6428fa37b3a6585150b10dedfd79b8) -Signed-off-by: Stoiko Ivanov ---- - module/os/linux/zfs/zpl_file.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/module/os/linux/zfs/zpl_file.c b/module/os/linux/zfs/zpl_file.c -index 30f3e3855355332aa10402791429cb4dc326f077..efcb400f196e3595fde85e5cf17be8bcf2d9520d 100644 ---- a/module/os/linux/zfs/zpl_file.c -+++ b/module/os/linux/zfs/zpl_file.c -@@ -1268,6 +1268,7 @@ const struct file_operations zpl_dir_file_operations = { - .read = generic_read_dir, - .iterate_shared = zpl_iterate, - .fsync = zpl_fsync, -+ .setlease = generic_setlease, - .unlocked_ioctl = zpl_ioctl, - #ifdef CONFIG_COMPAT - .compat_ioctl = zpl_compat_ioctl, diff --git a/debian/patches/0015-Linux-7.0-autoconf-Remove-copy-from-user-inatomic-AP.patch b/debian/patches/0015-Linux-7.0-autoconf-Remove-copy-from-user-inatomic-AP.patch deleted file mode 100644 index b0f610085..000000000 --- a/debian/patches/0015-Linux-7.0-autoconf-Remove-copy-from-user-inatomic-AP.patch +++ /dev/null @@ -1,79 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: John Cabaj -Date: Mon, 23 Mar 2026 11:19:41 -0500 -Subject: [PATCH] Linux 7.0: autoconf: Remove copy-from-user-inatomic API - checks (#18348) (#18354) - -This function was removed in c6442bd3b643: "Removing old code outside -of 4.18 kernsls", but fails at present on PowerPC builds due to the -recent inclusion of 6bc9c0a90522: "powerpc: fix KUAP warning in VMX -usercopy path" in the upstream kernel, which introduces a use of -cpu_feature_keys[], which is a GPL-only symbol. Removing the API -check as it doesn't appear necessary. - -Signed-off-by: John Cabaj -Reviewed-by: Tony Hutter -Reviewed-by: Alexander Motin -(cherry picked from commit 8518e3e809a4ca0d152c24efbd2409772295b056) -Signed-off-by: Stoiko Ivanov ---- - config/kernel-copy-from-user-inatomic.m4 | 29 ------------------------ - config/kernel.m4 | 2 -- - 2 files changed, 31 deletions(-) - delete mode 100644 config/kernel-copy-from-user-inatomic.m4 - -diff --git a/config/kernel-copy-from-user-inatomic.m4 b/config/kernel-copy-from-user-inatomic.m4 -deleted file mode 100644 -index fec354b2f38e32e959024bf1d8608c8a7aab5803..0000000000000000000000000000000000000000 ---- a/config/kernel-copy-from-user-inatomic.m4 -+++ /dev/null -@@ -1,29 +0,0 @@ --dnl # --dnl # On certain architectures `__copy_from_user_inatomic` --dnl # is a GPL exported variable and cannot be used by OpenZFS. --dnl # -- --dnl # --dnl # Checking if `__copy_from_user_inatomic` is available. --dnl # --AC_DEFUN([ZFS_AC_KERNEL_SRC___COPY_FROM_USER_INATOMIC], [ -- ZFS_LINUX_TEST_SRC([__copy_from_user_inatomic], [ -- #include -- ], [ -- int result __attribute__ ((unused)) = __copy_from_user_inatomic(NULL, NULL, 0); -- ], [], [ZFS_META_LICENSE]) --]) -- --AC_DEFUN([ZFS_AC_KERNEL___COPY_FROM_USER_INATOMIC], [ -- AC_MSG_CHECKING([whether __copy_from_user_inatomic is available]) -- ZFS_LINUX_TEST_RESULT([__copy_from_user_inatomic_license], [ -- AC_MSG_RESULT(yes) -- ], [ -- AC_MSG_RESULT(no) -- AC_MSG_ERROR([ -- *** The `__copy_from_user_inatomic()` Linux kernel function is -- *** incompatible with the CDDL license and will prevent the module -- *** linking stage from succeeding. OpenZFS cannot be compiled. -- ]) -- ]) --]) -diff --git a/config/kernel.m4 b/config/kernel.m4 -index df168506691dec7b9479da12e9ac9e08694853c4..258611467893a0a9666a8da3bdcd78999c765679 100644 ---- a/config/kernel.m4 -+++ b/config/kernel.m4 -@@ -118,7 +118,6 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [ - ZFS_AC_KERNEL_SRC_ADD_DISK - ZFS_AC_KERNEL_SRC_KTHREAD - ZFS_AC_KERNEL_SRC_ZERO_PAGE -- ZFS_AC_KERNEL_SRC___COPY_FROM_USER_INATOMIC - ZFS_AC_KERNEL_SRC_IDMAP_MNT_API - ZFS_AC_KERNEL_SRC_IDMAP_NO_USERNS - ZFS_AC_KERNEL_SRC_IATTR_VFSID -@@ -242,7 +241,6 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [ - ZFS_AC_KERNEL_ADD_DISK - ZFS_AC_KERNEL_KTHREAD - ZFS_AC_KERNEL_ZERO_PAGE -- ZFS_AC_KERNEL___COPY_FROM_USER_INATOMIC - ZFS_AC_KERNEL_IDMAP_MNT_API - ZFS_AC_KERNEL_IDMAP_NO_USERNS - ZFS_AC_KERNEL_IATTR_VFSID diff --git a/debian/patches/0016-Linux-7.0-ensure-LSMs-get-to-process-mount-options.patch b/debian/patches/0016-Linux-7.0-ensure-LSMs-get-to-process-mount-options.patch deleted file mode 100644 index 45eea3f03..000000000 --- a/debian/patches/0016-Linux-7.0-ensure-LSMs-get-to-process-mount-options.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Rob Norris -Date: Tue, 31 Mar 2026 10:44:31 +1100 -Subject: [PATCH] Linux 7.0: ensure LSMs get to process mount options - -Normally, kernel gives any LSM registering a `sb_eat_lsm_opts` hook a -first look at mount options coming in from a userspace mount request. -The LSM may process and/or remove any options. Whatever is left is -passed to the filesystem. - -This is how the dataset properties `context`, `fscontext`, `defcontext` -and `rootcontext` are used to configure ZFS mounts for SELinux. libzfs -will fetch those properties from the dataset, then add them to the mount -options. - -In 0f608aa6ca (#18216) we added our own mount shims to cover the loss of -the kernel-provided ones. It turns out that if a filesystem provides a -`.parse_monolithic callback`, it is expected to do _all_ mount option -parameter processing - the kernel will not get involved at all. Because -of that, LSMs are never given a chance to process mount options. The -`context` properties are never seen by SELinux, nor are any other -options targetting other LSMs. - -Fix this by calling `security_sb_eat_lsm_opts()` in -`zpl_parse_monolithic()`, before we stash the remaining options for -`zfs_domount()`. - -Sponsored-by: TrueNAS -Reviewed-by: Tony Hutter -Reviewed-by: Brian Behlendorf -Signed-off-by: Rob Norris -Closes #18376 -(cherry picked from commit 4155d1533e1ac22057c9d21d57b28f8d36e59359) -Signed-off-by: Stoiko Ivanov ---- - module/os/linux/zfs/zpl_super.c | 17 +++++++++++++++-- - 1 file changed, 15 insertions(+), 2 deletions(-) - -diff --git a/module/os/linux/zfs/zpl_super.c b/module/os/linux/zfs/zpl_super.c -index d509152b692133f5dd0339e750dba50160e37232..5baa4f637cdc2e3cd4f68032f28de686b95200a0 100644 ---- a/module/os/linux/zfs/zpl_super.c -+++ b/module/os/linux/zfs/zpl_super.c -@@ -524,9 +524,22 @@ zpl_prune_sb(uint64_t nr_to_scan, void *arg) - static int - zpl_parse_monolithic(struct fs_context *fc, void *data) - { -+ if (data == NULL) -+ return (0); -+ -+ /* -+ * Because we supply a .parse_monolithic callback, the kernel does -+ * no consideration of the options blob at all. Because of this, we -+ * have to give LSMs a first look at it. They will remove any options -+ * of interest to them (eg the SELinux *context= options). -+ */ -+ int err = security_sb_eat_lsm_opts((char *)data, &fc->security); -+ if (err) -+ return (err); -+ - /* -- * We do options parsing in zfs_domount(); just stash the options blob -- * in the fs_context so we can pass it down later. -+ * Whatever is left we stash on in the fs_context so we can pass it -+ * down to zfs_domount() or zfs_remount() later. - */ - fc->fs_private = data; - return (0); diff --git a/debian/patches/0017-Linux-7.0-compat-META.patch b/debian/patches/0017-Linux-7.0-compat-META.patch deleted file mode 100644 index ed1efa6f0..000000000 --- a/debian/patches/0017-Linux-7.0-compat-META.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Brian Behlendorf -Date: Thu, 16 Apr 2026 16:45:20 -0700 -Subject: [PATCH] Linux 7.0 compat: META - -Update the META file to reflect compatibility with the 7.0 -kernel. - -Reviewed-by: Tony Hutter -Signed-off-by: Brian Behlendorf -Closes #18435 -(cherry picked from commit d88d9c91dce065c59e2d21aea5a85ba525b6a2f5) -Signed-off-by: Stoiko Ivanov ---- - META | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/META b/META -index c6d7e3e94057c7b6870ebb3818ba0e04141efdd0..805ab052fa8dc1882eb4b6f362225997a03b34ee 100644 ---- a/META -+++ b/META -@@ -6,5 +6,5 @@ Release: 1 - Release-Tags: relext - License: CDDL - Author: OpenZFS --Linux-Maximum: 6.19 -+Linux-Maximum: 7.0 - Linux-Minimum: 4.18 diff --git a/debian/patches/0019-Fix-kernel-BUG-at-mm-usercopy.c.patch b/debian/patches/0019-Fix-kernel-BUG-at-mm-usercopy.c.patch deleted file mode 100644 index 2e074ee3e..000000000 --- a/debian/patches/0019-Fix-kernel-BUG-at-mm-usercopy.c.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Tony Hutter -Date: Thu, 23 Apr 2026 10:52:19 -0700 -Subject: [PATCH] Fix 'kernel BUG at mm/usercopy.c' - -Fix a bug where an cgroup-OOM-killed process can cause a panic: - -usercopy: Kernel memory exposure attempt detected from vmalloc (offset -1007584, size 217120)! -kernel BUG at mm/usercopy.c:102! - -This was caused by zfs_uiomove() not correctly returning EFAULT -for short copies. - -Reviewed-by: Brian Behlendorf -Signed-off-by: Tony Hutter -Closes #15918 -Closes #18408 -(cherry picked from commit fc6aa4369ef79bde105a359019575d9103541287) -Signed-off-by: Stoiko Ivanov ---- - module/os/linux/zfs/zfs_uio.c | 13 ++++++++++--- - 1 file changed, 10 insertions(+), 3 deletions(-) - -diff --git a/module/os/linux/zfs/zfs_uio.c b/module/os/linux/zfs/zfs_uio.c -index 8f9b161995f4e1d8cbbe457683879e0c343b2731..bfce9e6b52022f989f8108fdcfa4600278f0934d 100644 ---- a/module/os/linux/zfs/zfs_uio.c -+++ b/module/os/linux/zfs/zfs_uio.c -@@ -234,6 +234,8 @@ zfs_uiomove_iter(void *p, size_t n, zfs_uio_rw_t rw, zfs_uio_t *uio, - boolean_t revert) - { - size_t cnt = MIN(n, uio->uio_resid); -+ size_t oldcnt = cnt; -+ int error = 0; - - if (rw == UIO_READ) - cnt = copy_to_iter(p, cnt, uio->uio_iter); -@@ -249,16 +251,21 @@ zfs_uiomove_iter(void *p, size_t n, zfs_uio_rw_t rw, zfs_uio_t *uio, - return (EFAULT); - - /* -- * Revert advancing the uio_iter. This is set by zfs_uiocopy() -- * to avoid consuming the uio and its iov_iter structure. -+ * When revert is set this is a zfs_uiocopy() which should not -+ * consume the uio and its iov_iter structure. Otherwise, it's -+ * a zfs_uiomove() which is expected to update the uio. Partial -+ * copies are allowed for both copy and move but EFAULT should -+ * be returned for zfs_uiomove(). - */ - if (revert) - iov_iter_revert(uio->uio_iter, cnt); -+ else if (cnt != oldcnt) -+ error = EFAULT; - - uio->uio_resid -= cnt; - uio->uio_loffset += cnt; - -- return (0); -+ return (error); - } - - int diff --git a/debian/patches/series b/debian/patches/series index 8b9f97f80..0ef82e7bb 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -7,13 +7,4 @@ 0007-Add-systemd-unit-for-importing-specific-pools.patch 0008-zpool-status-tighten-bounds-for-noalloc-stat-availab.patch 0009-libzfs-scrub-only-include-start-and-end-nv-pairs-if-.patch -0010-Linux-7.0-explicitly-set-setlease-handler-to-kernel-.patch -0011-Linux-7.0-blk_queue_nonrot-renamed-to-blk_queue_rot.patch -0012-Linux-7.0-posix_acl_to_xattr-now-allocates-memory.patch -0013-Linux-7.0-add-shims-for-the-fs_context-based-mount-A.patch -0014-Linux-7.0-also-set-setlease-handler-on-directories-1.patch -0015-Linux-7.0-autoconf-Remove-copy-from-user-inatomic-AP.patch -0016-Linux-7.0-ensure-LSMs-get-to-process-mount-options.patch -0017-Linux-7.0-compat-META.patch -0018-Add-no-preserve-encryption-flag.patch -0019-Fix-kernel-BUG-at-mm-usercopy.c.patch +0010-Add-no-preserve-encryption-flag.patch diff --git a/upstream b/upstream index 1c702dda3..6330a45b0 160000 --- a/upstream +++ b/upstream @@ -1 +1 @@ -Subproject commit 1c702dda346a59e05cfd3029569bbb1d5d91c54b +Subproject commit 6330a45b06d20125de679aae5f63ba14082671ef -- 2.47.3