All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/12] block: fix the zone write granularity and the zone append limit
@ 2026-08-25 20:57 Niklas Cassel
  2026-08-25 20:57 ` [PATCH 01/12] block: widen BlockLimits.zone_size to uint64_t Niklas Cassel
                   ` (11 more replies)
  0 siblings, 12 replies; 25+ messages in thread
From: Niklas Cassel @ 2026-08-25 20:57 UTC (permalink / raw)
  To: Stefan Hajnoczi, Kevin Wolf, Hanna Reitz, Fam Zheng, John Snow,
	Denis V. Lunev, Michael S. Tsirkin
  Cc: Sam Li, Damien Le Moal, Niklas Cassel, qemu-block, qemu-devel

Hello Stefan,

This series fixes how QEMU reports and enforces the two constraints a zoned
device puts on a write to a sequential zone: the write granularity, and
the largest zone append it accepts. It also fixes two bugs in the zone
append emulation in file-posix.

Many of these patches are in preparation for Sam Li's zoned qcow2 series.
The first two patches in the series are taken directly from there, as they
are unrelated to qcow2.

Patches 3 to 6 concern the write granularity. file-posix read it from the
wrong queue attribute, and virtio-blk reported the logical block size while
the driver enforced the backend value, so on a 512e SMR disk a guest could
be told that a request was valid and get an I/O error for it. Writes to
sequential zones were not checked against the granularity at all, and zone
appends had only their offset checked, not their length. Patch 6 refuses at
realize a device whose write pointers the configured logical block size
cannot address.

Patches 7 to 10 concern the append size. Passing
BlockLimits.max_append_sectors straight through made an unset field mean
"zone append unsupported" rather than "no limit of its own", and Linux
refuses to attach a zoned device that reports zero. The sector invariant
moves to bdrv_co_zone_append(), file-posix drops its duplicate check, and
it stops reporting zone_append_max_bytes, which bounds REQ_OP_ZONE_APPEND,
an operation it never issues: it appends with an ordinary pwritev().

Patches 11 and 12 fix the write pointer that raw_co_prw() substitutes for
the offset of an append. An offset that is never bounded against the device
derives an out of range zone index and reads past the write pointer array,
which qemu-io can reach. An append to a full zone uses a pointer recorded
at the end of the zone, so the data is written into the next zone and
success is returned; a guest can reach that one, because nothing in
virtio-blk checks whether a zone is full.

Niklas Cassel (10):
  file-posix: fix zone write granularity assignment for zoned block
    devices
  virtio-blk: report the effective zone write granularity
  virtio-blk: check the write granularity of writes to sequential zones
  hw/block: reject a zoned device whose write pointers are unaddressable
  block: reject zone appends that are not a multiple of the sector size
  file-posix: remove the zone append write granularity check
  file-posix: base the zone append limit on the transfer limit
  virtio-blk: derive the maximum zone append size
  file-posix: reject a zone append past the device capacity
  file-posix: reject a zone append to a full or conventional zone

Sam Li (2):
  block: widen BlockLimits.zone_size to uint64_t
  virtio-blk: do not merge writes across a zone boundary

 block/block-backend.c             | 11 ++++
 block/file-posix.c                | 70 +++++++++++++++--------
 block/io.c                        | 10 ++++
 hw/block/block.c                  | 53 ++++++++++++++++++
 hw/block/virtio-blk.c             | 93 ++++++++++++++++++++++++++-----
 include/block/block_int-common.h  |  2 +-
 include/hw/block/block.h          |  9 +++
 include/system/block-backend-io.h |  1 +
 8 files changed, 211 insertions(+), 38 deletions(-)

-- 
2.55.0



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

end of thread, other threads:[~2026-08-28  6:20 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-25 20:57 [PATCH 00/12] block: fix the zone write granularity and the zone append limit Niklas Cassel
2026-08-25 20:57 ` [PATCH 01/12] block: widen BlockLimits.zone_size to uint64_t Niklas Cassel
2026-08-28  5:58   ` Damien Le Moal
2026-08-25 20:57 ` [PATCH 02/12] virtio-blk: do not merge writes across a zone boundary Niklas Cassel
2026-08-28  6:02   ` Damien Le Moal
2026-08-25 20:57 ` [PATCH 03/12] file-posix: fix zone write granularity assignment for zoned block devices Niklas Cassel
2026-08-25 20:57 ` [PATCH 04/12] virtio-blk: report the effective zone write granularity Niklas Cassel
2026-08-28  6:03   ` Damien Le Moal
2026-08-25 20:57 ` [PATCH 05/12] virtio-blk: check the write granularity of writes to sequential zones Niklas Cassel
2026-08-28  6:07   ` Damien Le Moal
2026-08-28  6:09     ` Damien Le Moal
2026-08-25 20:57 ` [PATCH 06/12] hw/block: reject a zoned device whose write pointers are unaddressable Niklas Cassel
2026-08-28  6:12   ` Damien Le Moal
2026-08-25 20:57 ` [PATCH 07/12] block: reject zone appends that are not a multiple of the sector size Niklas Cassel
2026-08-28  6:13   ` Damien Le Moal
2026-08-25 20:57 ` [PATCH 08/12] file-posix: remove the zone append write granularity check Niklas Cassel
2026-08-28  6:14   ` Damien Le Moal
2026-08-25 20:57 ` [PATCH 09/12] file-posix: base the zone append limit on the transfer limit Niklas Cassel
2026-08-28  6:17   ` Damien Le Moal
2026-08-25 20:57 ` [PATCH 10/12] virtio-blk: derive the maximum zone append size Niklas Cassel
2026-08-28  6:18   ` Damien Le Moal
2026-08-25 20:57 ` [PATCH 11/12] file-posix: reject a zone append past the device capacity Niklas Cassel
2026-08-28  6:18   ` Damien Le Moal
2026-08-25 20:57 ` [PATCH 12/12] file-posix: reject a zone append to a full or conventional zone Niklas Cassel
2026-08-28  6:19   ` Damien Le Moal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.