From: Zhang Yi <yi.zhang@huawei.com>
Changes since v1:
- Improve commit messages in patch 1 by adding a simple reproduction
case as Paul suggested and explaining the implementation differences
between RAID 0 and RAID 1/10/5, no code changes.
v1: https://lore.kernel.org/linux-block/20250825083320.797165-1-yi.zhang@huaweicloud.com/
This series fixes the initialization of max_hw_wzeroes_unmap_sectors in
queue_limits for all md raid and drbd drivers, preventing
blk_validate_limits() failures on underlying devices that support the
unmap write zeroes command.
Best regards,
Yi.
Zhang Yi (2):
md: init queue_limits->max_hw_wzeroes_unmap_sectors parameter
drbd: init queue_limits->max_hw_wzeroes_unmap_sectors parameter
drivers/block/drbd/drbd_nl.c | 1 +
drivers/md/md-linear.c | 1 +
drivers/md/raid0.c | 1 +
drivers/md/raid1.c | 1 +
drivers/md/raid10.c | 1 +
drivers/md/raid5.c | 1 +
6 files changed, 6 insertions(+)
--
2.46.1
From: Zhang Yi <yi.zhang@huawei.com>
The parameter max_hw_wzeroes_unmap_sectors in queue_limits should be
equal to max_write_zeroes_sectors if it is set to a non-zero value.
However, when the backend bdev is specified, this parameter is
initialized to UINT_MAX during the call to blk_set_stacking_limits(),
while only max_write_zeroes_sectors is adjusted. Therefore, this
discrepancy triggers a value check failure in blk_validate_limits().
Since the drvd driver doesn't yet support unmap write zeroes, so fix
this failure by explicitly setting max_hw_wzeroes_unmap_sectors to
zero.
Fixes: 0c40d7cb5ef3 ("block: introduce max_{hw|user}_wzeroes_unmap_sectors to queue limits")
Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Yu Kuai <redacted>
---
drivers/block/drbd/drbd_nl.c | 1 +
1 file changed, 1 insertion(+)
From: Zhang Yi <yi.zhang@huawei.com>
The parameter max_hw_wzeroes_unmap_sectors in queue_limits should be
equal to max_write_zeroes_sectors if it is set to a non-zero value.
However, the stacked md drivers call md_init_stacking_limits() to
initialize this parameter to UINT_MAX but only adjust
max_write_zeroes_sectors when setting limits. Therefore, this
discrepancy triggers a value check failure in blk_validate_limits().
$ modprobe scsi_debug num_parts=2 dev_size_mb=8 lbprz=1 lbpws=1
$ mdadm --create /dev/md0 --level=0 --raid-device=2 /dev/sda1 /dev/sda2
mdadm: Defaulting to version 1.2 metadata
mdadm: RUN_ARRAY failed: Invalid argument
Fix this failure by explicitly setting max_hw_wzeroes_unmap_sectors to
max_write_zeroes_sectors. Since the linear and raid0 drivers support
write zeroes, so they can support unmap write zeroes operation if all of
the backend devices support it. However, the raid1/10/5 drivers don't
support write zeroes, so we have to set it to zero.
Fixes: 0c40d7cb5ef3 ("block: introduce max_{hw|user}_wzeroes_unmap_sectors to queue limits")
Reported-by: John Garry <john.g.garry@oracle.com>
Closes: https://lore.kernel.org/linux-block/803a2183-a0bb-4b7a-92f1-afc5097630d2@oracle.com/
Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
Tested-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Li Nan <redacted>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Yu Kuai <redacted>
---
drivers/md/md-linear.c | 1 +
drivers/md/raid0.c | 1 +
drivers/md/raid1.c | 1 +
drivers/md/raid10.c | 1 +
drivers/md/raid5.c | 1 +
5 files changed, 5 insertions(+)
From: Hannes Reinecke <hare@suse.de> Date: 2025-09-10 11:41:15
On 9/10/25 13:11, Zhang Yi wrote:
From: Zhang Yi <yi.zhang@huawei.com>
The parameter max_hw_wzeroes_unmap_sectors in queue_limits should be
equal to max_write_zeroes_sectors if it is set to a non-zero value.
However, the stacked md drivers call md_init_stacking_limits() to
initialize this parameter to UINT_MAX but only adjust
max_write_zeroes_sectors when setting limits. Therefore, this
discrepancy triggers a value check failure in blk_validate_limits().
$ modprobe scsi_debug num_parts=2 dev_size_mb=8 lbprz=1 lbpws=1
$ mdadm --create /dev/md0 --level=0 --raid-device=2 /dev/sda1 /dev/sda2
mdadm: Defaulting to version 1.2 metadata
mdadm: RUN_ARRAY failed: Invalid argument
Fix this failure by explicitly setting max_hw_wzeroes_unmap_sectors to
max_write_zeroes_sectors. Since the linear and raid0 drivers support
write zeroes, so they can support unmap write zeroes operation if all of
the backend devices support it. However, the raid1/10/5 drivers don't
support write zeroes, so we have to set it to zero.
Fixes: 0c40d7cb5ef3 ("block: introduce max_{hw|user}_wzeroes_unmap_sectors to queue limits")
Reported-by: John Garry <john.g.garry@oracle.com>
Closes: https://lore.kernel.org/linux-block/803a2183-a0bb-4b7a-92f1-afc5097630d2@oracle.com/
Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
Tested-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Li Nan <redacted>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Yu Kuai <redacted>
---
drivers/md/md-linear.c | 1 +
drivers/md/raid0.c | 1 +
drivers/md/raid1.c | 1 +
drivers/md/raid10.c | 1 +
drivers/md/raid5.c | 1 +
5 files changed, 5 insertions(+)
Notice the failure, too. Thanks for fixing it.
Reviewed-by: Hannes Reinecke <hare@suse.de>
Cheers,
Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare@suse.de +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich
From: Hannes Reinecke <hare@suse.de> Date: 2025-09-10 11:41:40
On 9/10/25 13:11, Zhang Yi wrote:
quoted hunk
From: Zhang Yi <yi.zhang@huawei.com>
The parameter max_hw_wzeroes_unmap_sectors in queue_limits should be
equal to max_write_zeroes_sectors if it is set to a non-zero value.
However, when the backend bdev is specified, this parameter is
initialized to UINT_MAX during the call to blk_set_stacking_limits(),
while only max_write_zeroes_sectors is adjusted. Therefore, this
discrepancy triggers a value check failure in blk_validate_limits().
Since the drvd driver doesn't yet support unmap write zeroes, so fix
this failure by explicitly setting max_hw_wzeroes_unmap_sectors to
zero.
Fixes: 0c40d7cb5ef3 ("block: introduce max_{hw|user}_wzeroes_unmap_sectors to queue limits")
Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Yu Kuai <redacted>
---
drivers/block/drbd/drbd_nl.c | 1 +
1 file changed, 1 insertion(+)
Hi, Jens!
Can you take this patch set through the linux-block tree?
Thanks,
Yi.
On 9/10/2025 7:11 PM, Zhang Yi wrote:
From: Zhang Yi <yi.zhang@huawei.com>
Changes since v1:
- Improve commit messages in patch 1 by adding a simple reproduction
case as Paul suggested and explaining the implementation differences
between RAID 0 and RAID 1/10/5, no code changes.
v1: https://lore.kernel.org/linux-block/20250825083320.797165-1-yi.zhang@huaweicloud.com/
This series fixes the initialization of max_hw_wzeroes_unmap_sectors in
queue_limits for all md raid and drbd drivers, preventing
blk_validate_limits() failures on underlying devices that support the
unmap write zeroes command.
Best regards,
Yi.
Zhang Yi (2):
md: init queue_limits->max_hw_wzeroes_unmap_sectors parameter
drbd: init queue_limits->max_hw_wzeroes_unmap_sectors parameter
drivers/block/drbd/drbd_nl.c | 1 +
drivers/md/md-linear.c | 1 +
drivers/md/raid0.c | 1 +
drivers/md/raid1.c | 1 +
drivers/md/raid10.c | 1 +
drivers/md/raid5.c | 1 +
6 files changed, 6 insertions(+)
From: John Garry <john.g.garry@oracle.com> Date: 2025-09-15 10:44:08
On 12/09/2025 07:16, Zhang Yi wrote:
Hi, Jens!
Can you take this patch set through the linux-block tree?
md raid maintainers,
please try to get this picked up ASAP. As things stand, all these RAID
personalities will be broken for 6.17 on drives supporting/reporting
write zeroes.
Thanks
Thanks,
Yi.
On 9/10/2025 7:11 PM, Zhang Yi wrote:
quoted
From: Zhang Yi <yi.zhang@huawei.com>
Changes since v1:
- Improve commit messages in patch 1 by adding a simple reproduction
case as Paul suggested and explaining the implementation differences
between RAID 0 and RAID 1/10/5, no code changes.
v1: https://urldefense.com/v3/__https://lore.kernel.org/linux-block/20250825083320.797165-1-yi.zhang@huaweicloud.com/__;!!ACWV5N9M2RV99hQ!JAN4eq3ePrspeto0Hn7563lg3392Lh44jM1oTbgxbDoClxVOh5B73QhGD53f9tiLxuxfJCr51PyAP55COV2TTZAt$
This series fixes the initialization of max_hw_wzeroes_unmap_sectors in
queue_limits for all md raid and drbd drivers, preventing
blk_validate_limits() failures on underlying devices that support the
unmap write zeroes command.
Best regards,
Yi.
Zhang Yi (2):
md: init queue_limits->max_hw_wzeroes_unmap_sectors parameter
drbd: init queue_limits->max_hw_wzeroes_unmap_sectors parameter
drivers/block/drbd/drbd_nl.c | 1 +
drivers/md/md-linear.c | 1 +
drivers/md/raid0.c | 1 +
drivers/md/raid1.c | 1 +
drivers/md/raid10.c | 1 +
drivers/md/raid5.c | 1 +
6 files changed, 6 insertions(+)
Hi, Jens!
Can you take this patch set through the linux-block tree?
md raid maintainers,
please try to get this picked up ASAP. As things stand, all these RAID
personalities will be broken for 6.17 on drives supporting/reporting
write zeroes.
Not sure if Jens missed this, I'll pick patch 1 later today if Jens
doesn't apply.
Thanks,
Kuai
Thanks
quoted
Thanks,
Yi.
On 9/10/2025 7:11 PM, Zhang Yi wrote:
quoted
From: Zhang Yi <yi.zhang@huawei.com>
Changes since v1:
- Improve commit messages in patch 1 by adding a simple reproduction
case as Paul suggested and explaining the implementation differences
between RAID 0 and RAID 1/10/5, no code changes.
v1:
https://urldefense.com/v3/__https://lore.kernel.org/linux-block/20250825083320.797165-1-yi.zhang@huaweicloud.com/__;!!ACWV5N9M2RV99hQ!JAN4eq3ePrspeto0Hn7563lg3392Lh44jM1oTbgxbDoClxVOh5B73QhGD53f9tiLxuxfJCr51PyAP55COV2TTZAt$
This series fixes the initialization of max_hw_wzeroes_unmap_sectors in
queue_limits for all md raid and drbd drivers, preventing
blk_validate_limits() failures on underlying devices that support the
unmap write zeroes command.
Best regards,
Yi.
Zhang Yi (2):
md: init queue_limits->max_hw_wzeroes_unmap_sectors parameter
drbd: init queue_limits->max_hw_wzeroes_unmap_sectors parameter
drivers/block/drbd/drbd_nl.c | 1 +
drivers/md/md-linear.c | 1 +
drivers/md/raid0.c | 1 +
drivers/md/raid1.c | 1 +
drivers/md/raid10.c | 1 +
drivers/md/raid5.c | 1 +
6 files changed, 6 insertions(+)
From: Zhang Yi <yi.zhang@huawei.com>
The parameter max_hw_wzeroes_unmap_sectors in queue_limits should be
equal to max_write_zeroes_sectors if it is set to a non-zero value.
However, the stacked md drivers call md_init_stacking_limits() to
initialize this parameter to UINT_MAX but only adjust
max_write_zeroes_sectors when setting limits. Therefore, this
discrepancy triggers a value check failure in blk_validate_limits().
$ modprobe scsi_debug num_parts=2 dev_size_mb=8 lbprz=1 lbpws=1
$ mdadm --create /dev/md0 --level=0 --raid-device=2 /dev/sda1 /dev/sda2
mdadm: Defaulting to version 1.2 metadata
mdadm: RUN_ARRAY failed: Invalid argument
Fix this failure by explicitly setting max_hw_wzeroes_unmap_sectors to
max_write_zeroes_sectors. Since the linear and raid0 drivers support
write zeroes, so they can support unmap write zeroes operation if all of
the backend devices support it. However, the raid1/10/5 drivers don't
support write zeroes, so we have to set it to zero.
Fixes: 0c40d7cb5ef3 ("block: introduce max_{hw|user}_wzeroes_unmap_sectors to queue limits")
Reported-by: John Garry <john.g.garry@oracle.com>
Closes: https://lore.kernel.org/linux-block/803a2183-a0bb-4b7a-92f1-afc5097630d2@oracle.com/
Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
Tested-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Li Nan <redacted>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Yu Kuai <redacted>
---
drivers/md/md-linear.c | 1 +
drivers/md/raid0.c | 1 +
drivers/md/raid1.c | 1 +
drivers/md/raid10.c | 1 +
drivers/md/raid5.c | 1 +
5 files changed, 5 insertions(+)