Re: [PATCH v2] ublk: use global index for reported zones

From: Ming Lei

Date: Fri Oct 02 2026 - 01:58:55 EST


On Tue, Sep 29, 2026 at 7:59 PM lirongqing <lirongqing@xxxxxxxxx> wrote:
>
> From: Li RongQing <lirongqing@xxxxxxxxx>
>
> 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@xxxxxxxxx>
> Reviewed-by: Ming Lei <tom.leiming@xxxxxxxxx>
> ---
> Diff with v1: pass done_zones directly


Tested-by: Ming Lei <tom.leiming@xxxxxxxxx>

Thanks,
Ming Lei