Skip to content

libzfs: scrub: only include start and end nv pairs if needed for scrub#18314

Merged
behlendorf merged 1 commit intoopenzfs:masterfrom
siv0:fix_scrubbing_with_older_kernel_and_newer_userspace
Mar 12, 2026
Merged

libzfs: scrub: only include start and end nv pairs if needed for scrub#18314
behlendorf merged 1 commit intoopenzfs:masterfrom
siv0:fix_scrubbing_with_older_kernel_and_newer_userspace

Conversation

@siv0
Copy link
Contributor

@siv0 siv0 commented Mar 12, 2026

Motivation and Context

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.

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/

Description

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: 894edd0 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.

[0]

ZFS_ERR_IOC_ARG_UNAVAIL,

[1]
* ZFS_ERR_IOC_ARG_UNAVAIL An unrecognized nvpair was encountered

Fixes: 894edd0 ("Add TXG timestamp database")

How Has This Been Tested?

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)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Quality assurance (non-breaking change which makes the code more robust against bugs)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

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: 894edd0
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: 894edd0 ("Add TXG timestamp database")
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
@behlendorf behlendorf added the Status: Code Review Needed Ready for review and testing label Mar 12, 2026
Copy link
Contributor

@behlendorf behlendorf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks for the compatibility fix.

@behlendorf behlendorf added Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels Mar 12, 2026
@behlendorf behlendorf merged commit 7f65e04 into openzfs:master Mar 12, 2026
40 of 42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Accepted Ready to integrate (reviewed, tested)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants