]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
block: don't return 1 for the fallback case in blkdev_get_zone_info
authorChristoph Hellwig <hch@lst.de>
Thu, 6 Nov 2025 14:53:32 +0000 (15:53 +0100)
committerJens Axboe <axboe@kernel.dk>
Fri, 7 Nov 2025 11:38:28 +0000 (04:38 -0700)
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()")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-zoned.c

index c5226bcaaa94007bd0441d3ad173367d674b43e2..8204214e3b898dafb81f6d0c5c4f1adf8b7cfcd4 100644 (file)
@@ -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;
 }
 
 /*