From: Ming Lei <tom.leiming@gmail.com>
To: linux-block@vger.kernel.org
Cc: Li RongQing <lirongqing@baidu.com>, Jens Axboe <axboe@kernel.dk>,
Caleb Sander Mateos <csander@purestorage.com>,
Josef Bacik <josef@toxicpanda.com>,
Ming Lei <tom.leiming@gmail.com>
Subject: [PATCH v3 12/12] ublk: use global index for reported zones
Date: Sun, 11 Oct 2026 01:35:55 -0500 [thread overview]
Message-ID: <20261011063555.1142277-13-tom.leiming@gmail.com> (raw)
In-Reply-To: <20261011063555.1142277-1-tom.leiming@gmail.com>
From: Li RongQing <lirongqing@baidu.com>
ublk_report_zones() may split a zone report into multiple requests when
the number of zones exceeds the temporary buffer capacity. The index
passed to disk_report_zone() must refer to the zone position in the
whole report, rather than the position within the current request.
Currently, the per-request loop index is used as the callback index,
causing each chunk after the first one to restart from zero. This can
make userspace callbacks receive duplicate zone indices and may result
in blk_revalidate_disk_zones() updating incorrect entries in its zone
state array.
Use the number of zones already reported as the base index for each
request so that zone indices remain continuous across all chunks.
Fixes: 29802d7ca33b ("ublk: enable zoned storage support")
Signed-off-by: Li RongQing <lirongqing@baidu.com>
Reviewed-by: Ming Lei <tom.leiming@gmail.com>
Tested-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
---
drivers/block/ublk_drv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
index 24a7f80e191c..1e84ccc68b9b 100644
--- a/drivers/block/ublk_drv.c
+++ b/drivers/block/ublk_drv.c
@@ -696,7 +696,7 @@ static int ublk_report_zones(struct gendisk *disk, sector_t sector,
if (!zone->len)
break;
- ret = disk_report_zone(disk, zone, i, args);
+ ret = disk_report_zone(disk, zone, done_zones, args);
if (ret)
goto out;
--
2.55.0
prev parent reply other threads:[~2026-10-11 6:36 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-11 6:35 [PATCH v3 00/12] ublk: don't dispatch to canceled io commands Ming Lei
2026-10-11 6:35 ` [PATCH v3 01/12] ublk: keep a canceled FETCH round canceling until the server is gone Ming Lei
2026-10-11 6:35 ` [PATCH v3 02/12] ublk: mark the io command cancelable before publishing it Ming Lei
2026-10-11 6:35 ` [PATCH v3 03/12] ublk: mark the batch fetch command cancelable before linking it Ming Lei
2026-10-11 6:35 ` [PATCH v3 04/12] ublk: reset the FETCH round in release also without a disk Ming Lei
2026-10-11 6:35 ` [PATCH v3 05/12] ublk: reset the FETCH round under ub->mutex Ming Lei
2026-10-11 6:35 ` [PATCH v3 06/12] ublk: allow a NULL io->cmd in the cancel callback Ming Lei
2026-10-11 6:35 ` [PATCH v3 07/12] ublk: let STOP_DEV cancel the server's commands before its release Ming Lei
2026-10-11 6:35 ` [PATCH v3 08/12] ublk: refuse to go live after an io command was canceled Ming Lei
2026-10-11 6:35 ` [PATCH v3 09/12] selftests: ublk: move the control command helpers into ctrl.c Ming Lei
2026-10-11 6:35 ` [PATCH v3 10/12] selftests: ublk: stop a batch thread when PREP_IO_CMDS fails Ming Lei
2026-10-11 6:35 ` [PATCH v3 11/12] selftests: ublk: add test for going live over canceled io commands Ming Lei
2026-10-11 6:35 ` Ming Lei [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261011063555.1142277-13-tom.leiming@gmail.com \
--to=tom.leiming@gmail.com \
--cc=axboe@kernel.dk \
--cc=csander@purestorage.com \
--cc=josef@toxicpanda.com \
--cc=linux-block@vger.kernel.org \
--cc=lirongqing@baidu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox