Skip to contentSkip to conversation

block: blk_set_stacking_limits() doesn't validate

PATCH In review Hannes Reinecke 3 participants 4 messages May 24, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: blk_set_stacking_limits() doesn't validate

blk_validate_zoned_limits() checks whether any of the zoned limits are set for non-zoned limits. As blk_set_stacking_limits() sets max_zone_append_sectors() it'll fail to validate.

---
 block/blk-settings.c | 1 -
 1 file changed, 1 deletion(-)
block/blk-settings.c +0 -1
index d2731843f2fc..524cf597b2e9 100644
@@ -50,7 +50,6 @@ void blk_set_stacking_limits(struct queue_limits *lim)
 	lim->max_sectors = UINT_MAX;
 	lim->max_dev_sectors = UINT_MAX;
 	lim->max_write_zeroes_sectors = UINT_MAX;
-	lim->max_zone_append_sectors = UINT_MAX;
 	lim->max_user_discard_sectors = UINT_MAX;
 }
 EXPORT_SYMBOL(blk_set_stacking_limits);
Signature · 1 line
2.35.3
#1 lore raw
Quoted 3 lines · Hannes Reinecke

blk_validate_zoned_limits() checks whether any of the zoned limits are set for non-zoned limits. As blk_set_stacking_limits() sets max_zone_append_sectors() it'll fail to validate.

Except that you now broke it for zone devices. Normally if we are not building a stacked zoned device there should at least be one underlying device that has a zero max_zone_append_limit, thus lowering the stacked device limit to 0. I guess you have a scenario where that is not the case, so please explain it so that we can fix it.

#2 lore raw
Quoted 11 lines · Christoph Hellwig
Quoted 3 lines · Hannes Reinecke

blk_validate_zoned_limits() checks whether any of the zoned limits are set for non-zoned limits. As blk_set_stacking_limits() sets max_zone_append_sectors() it'll fail to validate.

Except that you now broke it for zone devices. Normally if we are not building a stacked zoned device there should at least be one underlying device that has a zero max_zone_append_limit, thus lowering the stacked device limit to 0. I guess you have a scenario where that is not the case, so please explain it so that we can fix it.

I just found it weird that a simple 'memset' for the initial device configuration and then calling blk_set_stacking_limits() will lead to a failure in blk_validate_limits() ...

But I'll relent; this had been coming up during large block testing with NVMe, but was only tangentially related. So I'll retract it.

Cheers,

Hannes

#3 lore raw
Quoted 3 lines · Hannes Reinecke

I just found it weird that a simple 'memset' for the initial device configuration and then calling blk_set_stacking_limits() will lead to a failure in blk_validate_limits() ...

You don't need a memset before calling blk_set_stacking_limits as blk_set_stacking_limits already does the memset for you. But as implied by the name and documented in the kerneldoc comment, blk_set_stacking_limits is indeed intended to prepare for stacking in other limits and is not supposed to be directly applied.