mirror_zfs/lib
siv0 7f65e04abd
libzfs: scrub: only include start and end nv pairs if needed for scrub
This patch addresses running `zpool scrub <pool>` with ZFS 2.4 userspace
while the loaded kernel module is still 2.3, failing with:
```
cannot scrub <pool>: 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] d35951b18d/include/sys/fs/zfs.h (L1762)
[1] d35951b18d/module/zfs/zfs_ioctl.c (L7799)
Fixes: 894edd084 ("Add TXG timestamp database")

Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Co-authored-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Closes #18314
2026-03-12 15:06:23 -07:00
..
libavl build: add SPDX license tags to build system files 2026-01-08 15:08:03 -08:00
libbtree Move range_tree, btree, highbit64 to common code 2026-02-22 11:43:51 -08:00
libefi build: add SPDX license tags to build system files 2026-01-08 15:08:03 -08:00
libicp build: add SPDX license tags to build system files 2026-01-08 15:08:03 -08:00
libnvpair build: add SPDX license tags to build system files 2026-01-08 15:08:03 -08:00
librange_tree Move range_tree, btree, highbit64 to common code 2026-02-22 11:43:51 -08:00
libspl libspl/mnttab: remove struct extmnttab 2026-03-10 13:07:07 -07:00
libzdb More consistent use of TREE_* macros in AVL comparators 2026-03-03 09:08:23 -08:00
libzfs libzfs: scrub: only include start and end nv pairs if needed for scrub 2026-03-12 15:06:23 -07:00
libzfs_core abi: updates for mnttab cleanup 2026-03-10 13:07:07 -07:00
libzfsbootenv build: add SPDX license tags to build system files 2026-01-08 15:08:03 -08:00
libzpool libzpool: lift zfs_file ops out to separate source file 2026-03-05 18:07:46 -08:00
libzstd Zstd: Integrate v1.5.7 into the ZFS build system 2026-01-20 13:41:06 -08:00
libzutil build: add SPDX license tags to build system files 2026-01-08 15:08:03 -08:00
Makefile.am Move range_tree, btree, highbit64 to common code 2026-02-22 11:43:51 -08:00