Skip to contentSkip to conversation

block: don't return 1 for the fallback case in blkdev_get_zone_info

PATCH Applied Christoph Hellwig 3 participants 4 messages Nov 6, 2025 – Nov 7, 2025

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

blkdev_do_report_zones returns the number of reported zones, but blkdev_get_zone_info returns 0 or an errno. Translate to the expected return value in blkdev_report_zone_fallback.

Fixes b037d41762fd ("block: introduce blkdev_get_zone_info()")
---
 block/blk-zoned.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
block/blk-zoned.c +7 -1
index c5226bcaaa94..8204214e3b89 100644
@@ -895,8 +895,14 @@ static int blkdev_report_zone_fallback(struct block_device *bdev,
 		.data = zone,
 		.report_active = true,
 	};
+	int error;
 
-	return blkdev_do_report_zones(bdev, sector, 1, &args);
+	error = blkdev_do_report_zones(bdev, sector, 1, &args);
+	if (error < 0)
+		return error;
+	if (error == 0)
+		return -EIO;
+	return 0;
 }
 
 /*
Signature · 1 line
2.47.3
maintainer Reviewed-by
#1 lore raw
Quoted 6 lines · Christoph Hellwig

blkdev_do_report_zones returns the number of reported zones, but blkdev_get_zone_info returns 0 or an errno. Translate to the expected return value in blkdev_report_zone_fallback.

Fixes b037d41762fd ("block: introduce blkdev_get_zone_info()")

Doh! Of course...

Note: Is this patch alone or part of a series ? (the subject has the odd 3/2...)

Signature · 2 lines
Damien Le Moal
Western Digital Research
#2 lore raw
Quoted 2 lines · Damien Le Moal

Note: Is this patch alone or part of a series ?
(the subject has the odd 3/2...)

Yeah, this was supposed to be a follow up to the report zones caching fixes, but I edited out the in-reply-to header accidentally.

maintainer Applied
#3 lore raw
In reply to Christoph Hellwig
Quoted 5 lines · Christoph Hellwig

blkdev_do_report_zones returns the number of reported zones, but blkdev_get_zone_info returns 0 or an errno. Translate to the expected return value in blkdev_report_zone_fallback.

Applied, thanks!

[3/3] block: don't return 1 for the fallback case in blkdev_get_zone_info

      commit: 86a9ce21f5b781c56eba23cbbd2264ab74778ab0

Best regards,

Signature · 1 line
Jens Axboe