From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 629B51FF13F for ; Thu, 12 Mar 2026 11:17:09 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 3CCA5E30D; Thu, 12 Mar 2026 11:17:04 +0100 (CET) From: Stoiko Ivanov To: pve-devel@lists.proxmox.com Subject: [PATCH zfsonlinux] fix scrub breaking with newer userspace utils and older kernel module Date: Thu, 12 Mar 2026 11:15:01 +0100 Message-ID: <20260312101651.301181-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: 1773310582624 X-SPAM-LEVEL: Spam detection results: 0 AWL -1.111 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 RCVD_IN_MSPIKE_H2 0.001 Average reputation (+2) RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.408 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.819 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.903 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: LD3FOURB23354NJW4DOHDCWZJL5TVWTZ X-Message-ID-Hash: LD3FOURB23354NJW4DOHDCWZJL5TVWTZ 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: currently when running an older kernel with ZFS 2.3 modules (e.g. by actively pinning it) running zfs scrub fails, due to some changes in 2.4, which are not backward compatible. This patch was submitted upstream at: https://github.com/openzfs/zfs/pull/18314 Signed-off-by: Stoiko Ivanov --- minimally tested by: * installing PVE 9.1 from iso, upgrading to the latest versions from pve-no-subscription, and pinning the old kernel (still with ZFS 2.3) * running `zpool scrub` (error occurs) * installing zfs userspace with this patch applied * running `zpool scrub` (scrub starts) ...y-include-start-and-end-nv-pairs-if-.patch | 60 +++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 61 insertions(+) create mode 100644 debian/patches/0009-libzfs-scrub-only-include-start-and-end-nv-pairs-if-.patch 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 new file mode 100644 index 000000000..0675045fb --- /dev/null +++ b/debian/patches/0009-libzfs-scrub-only-include-start-and-end-nv-pairs-if-.patch @@ -0,0 +1,60 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Stoiko Ivanov +Date: Wed, 11 Mar 2026 12:56:12 +0100 +Subject: [PATCH] libzfs: scrub: only include start and end nv pairs if needed + for scrub + +This patch addresses running `zpool scrub ` with ZFS 2.4 userspace +while the loaded kernel module is still 2.3, failing with: +``` +cannot scrub : the loaded zfs module does not support an option +for this operation. A reboot may be required to enable this option. +``` + +Checking for the source of the message via `strace` showed the scrub +ioctl failing and setting errno to ZFS_ERR_IOC_ARG_UNAVAIL[0]. With +that and the comments in `module/zfs/zfs_ioctl.c`[1] commit: 894edd084 +seemed like a likely cause for the backward incompatibility. + +The corresponding kernelspace code in `module/zfs/zfs_ioctl.c` defaults +to a setting of 0 if either parameter is not set, so not providing the +nvpairs in case both are 0 should not make a semantic difference. + +Tested by: +* loading zfs.ko in version 2.3.6 +* running `zpool scrub testpool` with zpool from master (error occurs) +* running `zpool scrub testpool` with this patch applied (scrub is + started) + +This should help users who are still stuck on an older kernel module, +while their distribution ships newer ZFS userspace. + +This was observed in the Proxmox community forum: +https://forum.proxmox.com/threads/.180467/ + +[0] https://github.com/openzfs/zfs/blob/d35951b18d6e12afeb0d5b0539ff2467ab4bfbcf/include/sys/fs/zfs.h#L1762 +[1] https://github.com/openzfs/zfs/blob/d35951b18d6e12afeb0d5b0539ff2467ab4bfbcf/module/zfs/zfs_ioctl.c#L7799 +Fixes: 894edd084 ("Add TXG timestamp database") +Signed-off-by: Stoiko Ivanov +--- + lib/libzfs/libzfs_pool.c | 7 +++++-- + 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 +--- 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, + nvlist_t *args = fnvlist_alloc(); + fnvlist_add_uint64(args, "scan_type", (uint64_t)func); + fnvlist_add_uint64(args, "scan_command", (uint64_t)cmd); +- fnvlist_add_uint64(args, "scan_date_start", (uint64_t)date_start); +- fnvlist_add_uint64(args, "scan_date_end", (uint64_t)date_end); ++ if (date_start != 0 || date_end != 0) { ++ fnvlist_add_uint64(args, "scan_date_start", ++ (uint64_t)date_start); ++ fnvlist_add_uint64(args, "scan_date_end", (uint64_t)date_end); ++ } + + err = lzc_scrub(ZFS_IOC_POOL_SCRUB, zhp->zpool_name, args, NULL); + fnvlist_free(args); diff --git a/debian/patches/series b/debian/patches/series index e6637ed22..bd2f52458 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -6,3 +6,4 @@ 0006-dont-symlink-zed-scripts.patch 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 -- 2.47.3