mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-04-12 22:51:46 +03:00
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:894edd084seemed 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
This commit is contained in:
parent
f109c7bb98
commit
7f65e04abd
@ -2868,8 +2868,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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user