linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] Improve checks in blk_revalidate_disk_zones()
@ 2023-06-30  8:39 Damien Le Moal
  2023-06-30  8:39 ` [PATCH v2 1/5] scsi: sd_zbc: Set zone limits before revalidating zones Damien Le Moal
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Damien Le Moal @ 2023-06-30  8:39 UTC (permalink / raw)
  To: linux-block, Jens Axboe, linux-nvme, Christoph Hellwig,
	Keith Busch, linux-scsi, Martin K . Petersen

blk_revalidate_disk_zones() implements checks of the zones of a zoned
block device, verifying that the zone size is a power of 2 number of
sectors, that all zones (except possibly the last one) have the same
size and that zones cover the entire addressing space of the device.

While these checks are appropriate to verify that well tested hardware
devices have an adequate zone configurations, they lack in certain areas
which may result in issues with potentially buggy emulated devices
implemented with user drivers such as ublk or tcmu. Specifically, this
function does not check if the device driver indicated support for the
mandatory zone append writes, that is, if the device
max_zone_append_sectors queue limit is set to a non-zero value.
Additionally, invalid zones such as a zero length zone with a start
sector equal to the device capacity will not be detected and result in
out of bounds use of the zone bitmaps prepared with the callback
function blk_revalidate_zone_cb().

This series address these issues by modifying the 4 block device drivers
that currently support zoned block devices to ensure that they all set a
zoned device zone size and max zone append sectors limit before
executing blk_revalidate_disk_zones(). With these changes in place, 
patch 5 improves blk_revalidate_disk_zones() to address the missing
checks, relying on the fact that the zone size and zone append limit are
normally set when this function is called.

Changes from v1:
 - Updated this cover letter and commit messages to include better
   explain for these patches
 - Reworked patch 5 to simplify the checks
  
Damien Le Moal (5):
  scsi: sd_zbc: Set zone limits before revalidating zones
  nvme: zns: Set zone limits before revalidating zones
  block: nullblk: Set zone limits before revalidating zones
  block: virtio_blk: Set zone limits before revalidating zones
  block: improve checks in blk_revalidate_disk_zones()

 block/blk-zoned.c              | 86 ++++++++++++++++++++--------------
 drivers/block/null_blk/zoned.c | 16 ++-----
 drivers/block/virtio_blk.c     | 34 ++++++--------
 drivers/nvme/host/zns.c        |  9 ++--
 drivers/scsi/sd_zbc.c          | 12 ++---
 5 files changed, 79 insertions(+), 78 deletions(-)

-- 
2.41.0


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

end of thread, other threads:[~2023-07-06 12:42 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-30  8:39 [PATCH v2 0/5] Improve checks in blk_revalidate_disk_zones() Damien Le Moal
2023-06-30  8:39 ` [PATCH v2 1/5] scsi: sd_zbc: Set zone limits before revalidating zones Damien Le Moal
2023-07-06 12:39   ` Christoph Hellwig
2023-06-30  8:39 ` [PATCH v2 2/5] nvme: zns: " Damien Le Moal
2023-07-06 12:40   ` Christoph Hellwig
2023-06-30  8:39 ` [PATCH v2 3/5] block: nullblk: " Damien Le Moal
2023-07-06 12:41   ` Christoph Hellwig
2023-06-30  8:39 ` [PATCH v2 4/5] block: virtio_blk: " Damien Le Moal
2023-07-02 22:29   ` Dmitry Fomichev
2023-07-06 12:41   ` Christoph Hellwig
2023-06-30  8:39 ` [PATCH v2 5/5] block: improve checks in blk_revalidate_disk_zones() Damien Le Moal
2023-07-06 12:42   ` Christoph Hellwig
2023-06-30 23:21 ` [PATCH v2 0/5] Improve " Bart Van Assche

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).