mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ublk: stop reporting zones on an empty response
@ 2026-11-09 14:51 shao.mingyin
  2026-11-10  1:27 ` Ming Lei
  0 siblings, 1 reply; 2+ messages in thread
From: shao.mingyin @ 2026-11-09 14:51 UTC (permalink / raw)
  To: tom.leiming, linux-block; +Cc: axboe, linux-kernel

From: Shao Mingyin <shao.mingyin@zte.com.cn>

ublk_report_zones() treats a zero-length zone as the end of a server
response, but only breaks out of the inner loop.  If the server returns
an empty report, done_zones and sector do not advance, so the driver
keeps issuing REPORT ZONES requests at the same sector indefinitely.

Finish the report when the zero-length marker is encountered and return
the number of zones already reported.  Use the existing exit path to
release the report buffer, including when the first response is empty.

Fixes: 29802d7ca33b ("ublk: enable zoned storage support")
Cc: stable@vger.kernel.org
Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
---
 drivers/block/ublk_drv.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
index 3d322fa1bc83..5c14daeaebbf 100644
--- a/drivers/block/ublk_drv.c
+++ b/drivers/block/ublk_drv.c
@@ -693,8 +693,10 @@ static int ublk_report_zones(struct gendisk *disk, sector_t sector,
 			struct blk_zone *zone = buffer + i;
 
 			/* A zero length zone means no more zones in this response */
-			if (!zone->len)
-				break;
+			if (!zone->len) {
+				ret = done_zones;
+				goto out;
+			}
 
 			ret = disk_report_zone(disk, zone, done_zones, args);
 			if (ret)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-10  1:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-09 14:51 [PATCH] ublk: stop reporting zones on an empty response shao.mingyin
2026-11-10  1:27 ` Ming Lei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®