Re: [PATCH] ublk: stop reporting zones on an empty response

From: shao.mingyin

Date: Mon Nov 09 2026 - 22:09:30 EST


On Mon, Nov 09, 2026 at 07:27:52PM -0600, Ming Lei wrote:
> The issue is real, I can reproduce it with one ublk server which
> completes UBLK_IO_OP_REPORT_ZONES without filling any zone: both
> BLKREPORTZONE and START_DEV(blk_revalidate_disk_zones()) loop forever,
> and the task can't be killed.

Thanks for reproducing it against a real server.

> But this terminates the whole report on any zero-length zone, not only
> on an empty response.

You're right, that is a regression I introduced. The zero-length entry
marks the end of this response, and the driver is supposed to ask for the
rest from the advanced sector. The UAPI says as much: "nr_zones" is an
upper bound, and reporting fewer zones is done by zeroing the last entry.
For BLKREPORTZONE the truncation is silent too: the ioctl still returns 0
and just reports 128 of the 256 requested zones, while START_DEV fails in
the last-zone/capacity check.

> How about stopping only if the response doesn't carry any zone? That is
> what sd_zbc and virtio_blk do too.

Taking that shape. v2 keeps the loop index outside the inner for and
stops the outer loop only when the response carried no zone at all, so a
short but non-empty response is still followed up as before. I'll keep
the Fixes: and stable tags and add your Suggested-by.

v2 will follow as a separate thread.

Thanks,
Shao Mingyin