HomeFreeBSD

linux/zvol_os: fix zvol queue limits initialization

Description

linux/zvol_os: fix zvol queue limits initialization

zvol queue limits initialization depends on zv_volblocksize, but it is
initialized later, leading to several limits being initialized with
incorrect values, including max_discard_* limits. This also causes
blkdiscard command to consistently fail, as blk_ioctl_discard reads
bdev_max_discard_sectors() limits as 0, leading to failure. The fix is
straightforward: initialize zv->zv_volblocksize early, before setting
the queue limits. This PR should fix zvol/zvol_misc/zvol_misc_trim
failure on recent PRs, as the test case issues blkdiscard for a zvol.
Additionally, zvol_misc_trim was recently enabled in 6c7d41a,
which is why the issue wasn't identified earlier.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Ameer Hamza <ahamza@ixsystems.com>
Closes #16454

Details

Provenance
Ameer Hamza <ahamza@ixsystems.com>Authored on Aug 15 2024, 9:29 PM
GitHub <noreply@github.com>Committed on Aug 15 2024, 9:29 PM
Parents
rG5807de90a141: Fix null ptr deref when renaming a zvol with snaps and snapdev=visible (#16316)
Branches
Unknown
Tags
Unknown

Event Timeline

GitHub <noreply@github.com> committed rGbdf4d6be1de8: linux/zvol_os: fix zvol queue limits initialization (authored by Ameer Hamza <ahamza@ixsystems.com>).Aug 15 2024, 9:29 PM