milos-linux/block
Damien Le Moal 836efd35c4 block: fix handling of dead zone write plugs
Shin'ichiro reported hard to reproduce unaligned write errors with zoned
block devices. Under normal operation conditions (e.g. running XFS on an
SMR disk), these errors are nearly impossible to trigger. But using a
"slow" kernel with many debug options enables and some specific use
cases (e.g. fio zbd test case 46), the errors can be reproduced fairly
easily.

The unaligned write errors come from mishandling a valid reference
counting pattern of zone write plugs. Such pattern triggers for instance
if a process A writes a zone (not necessarilly to the full state),
another process B immediately resets the zone and immediately following
the completion of the zone reset, starts issuing writes to the zone.
With such pattern, in some cases, the zone write plugs worker thread of
the device may still be holding a reference to the zone write plug of
the zone taken when process A was writing to the zone. The following
zone reset from process B marks the zone as dead but does not remove the
zone write plug from the device hash table as a reference to the plug
still exist. Once process B starts issuing new writes, the zone write
plug is seen as dead and the writes from process B are immediately
failed, despite this write pattern being perfectly legal.

Fix this by allowing restoring a dead zone write plug to a live state if
a write is issued to the zone when the zone is: marked as dead, empty
and the write sector corresponds to the first sector of the zone (that
is, the write is aligned to the zone write pointer). This is done with
the new helper function disk_check_zone_wplug_dead(), which restores a
dead zone write plug to a live state by clearing the BLK_ZONE_WPLUG_DEAD
flag and restoring the initial reference to the zone write plug taken
when the plug was added to the device hash table.

Reported-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Fixes: b7d4ffb510 ("block: fix zone write plug removal")
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Tested-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://patch.msgid.link/20260513111129.108809-1-dlemoal@kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-05-13 07:54:39 -06:00
..
partitions block: use sysfs_emit in sysfs show functions 2026-04-03 05:07:46 -06:00
badblocks.c
bdev.c bdev: Drop pointless invalidate_inode_buffers() call 2026-03-26 15:03:27 +01:00
bfq-cgroup.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
bfq-iosched.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
bfq-iosched.h block, bfq: update outdated comment 2026-01-01 08:57:37 -07:00
bfq-wf2q.c
bio-integrity-auto.c block: Add WQ_PERCPU to alloc_workqueue users 2026-04-17 14:38:22 -06:00
bio-integrity-fs.c block: add fs_bio_integrity helpers 2026-03-09 07:47:02 -06:00
bio-integrity.c block: bio-integrity: Fix null-ptr-deref in bio_integrity_map_user() 2026-05-12 09:24:16 -06:00
bio.c block: only restrict bio allocation gfp mask asked to block 2026-04-21 11:42:12 -06:00
blk-cgroup-fc-appid.c
blk-cgroup-rwstat.c
blk-cgroup-rwstat.h
blk-cgroup.c blk-cgroup: fix disk reference leak in blkcg_maybe_throttle_current() 2026-03-31 13:55:41 -06:00
blk-cgroup.h block: initialize bio issue time in blk_mq_submit_bio() 2025-09-10 05:23:45 -06:00
blk-core.c block: Add WQ_PERCPU to alloc_workqueue users 2026-04-17 14:38:22 -06:00
blk-crypto-fallback.c Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL uses 2026-02-22 08:26:33 -08:00
blk-crypto-internal.h blk-crypto: handle the fallback above the block layer 2026-01-11 12:55:41 -07:00
blk-crypto-profile.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
blk-crypto-sysfs.c blk-crypto: make blk_crypto_attr instances const 2026-03-17 19:29:16 -06:00
blk-crypto.c blk-crypto: handle the fallback above the block layer 2026-01-11 12:55:41 -07:00
blk-flush.c block: pass io_comp_batch to rq_end_io_fn callback 2026-01-20 10:12:54 -07:00
blk-ia-ranges.c block: ia-ranges: make blk_ia_range_sysfs_entry instances const 2026-03-17 19:29:16 -06:00
blk-integrity.c block: don't merge bios with different app_tags 2026-01-06 19:10:08 -07:00
blk-ioc.c copy_process: pass clone_flags as u64 across calltree 2025-09-01 15:31:34 +02:00
blk-iocost.c blk-iocost: fix busy_level reset when no IOs complete 2026-03-31 13:56:38 -06:00
blk-iolatency.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
blk-ioprio.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
blk-ioprio.h
blk-lib.c block: add a bio_submit_or_kill helper 2026-04-07 08:22:24 -06:00
blk-map.c block-7.0-20260305 2026-03-06 08:36:18 -08:00
blk-merge.c for-7.0/block-stable-pages-20260206 2026-02-09 18:14:52 -08:00
blk-mq-cpumap.c blk-mq: add number of queue calc helper 2025-07-01 10:24:19 -06:00
blk-mq-debugfs.c block: allow submitting all zone writes from a single context 2026-03-09 14:30:00 -06:00
blk-mq-debugfs.h blk-mq-debugfs: remove blk_mq_debugfs_unregister_rqos() 2026-02-02 07:05:19 -07:00
blk-mq-dma.c block: fix partial IOVA mapping cleanup in blk_rq_dma_map_iova 2026-02-12 04:23:31 -07:00
blk-mq-sched.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
blk-mq-sched.h blk-mq-sched: unify elevators checking for async requests 2026-02-03 07:45:36 -07:00
blk-mq-sysfs.c blk-mq: make blk_mq_hw_ctx_sysfs_entry instances const 2026-03-17 19:29:16 -06:00
blk-mq-tag.c blk-mq: use array manage hctx map instead of xarray 2025-11-28 09:09:19 -07:00
blk-mq.c block: recompute nr_integrity_segments in blk_insert_cloned_request 2026-05-12 09:23:43 -06:00
blk-mq.h blk-mq: use queue_hctx in blk_mq_map_queue_type 2025-12-01 07:18:31 -07:00
blk-pm.c
blk-pm.h
blk-rq-qos.c blk-mq-debugfs: remove blk_mq_debugfs_unregister_rqos() 2026-02-02 07:05:19 -07:00
blk-rq-qos.h blk-rq-qos: Remove unlikely() hints from QoS checks 2026-01-06 19:08:23 -07:00
blk-settings.c blk-integrity: support arbitrary buffer alignment 2026-03-14 07:44:30 -06:00
blk-stat.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
blk-stat.h blk-stat: convert struct blk_stat_callback to kernel-doc 2026-02-16 10:21:06 -07:00
blk-sysfs.c block: make queue_sysfs_entry instances const 2026-03-17 19:29:16 -06:00
blk-throttle.c block/blk-throttle: Add WQ_PERCPU to alloc_workqueue users 2026-04-17 14:38:22 -06:00
blk-throttle.h blk-throttle: fix access race during throttle policy activation 2025-09-08 08:24:44 -06:00
blk-timeout.c
blk-wbt.c blk-wbt: remove WARN_ON_ONCE from wbt_init_enable_default() 2026-04-06 12:54:03 -06:00
blk-wbt.h blk-wbt: factor out a helper wbt_set_lat() 2026-02-02 07:05:19 -07:00
blk-zoned.c block: fix handling of dead zone write plugs 2026-05-13 07:54:39 -06:00
blk.h block: relax pgmap check in bio_add_page for compatible zone device pages 2026-04-17 14:37:08 -06:00
bsg-lib.c bsg: add io_uring command support to generic layer 2026-03-19 11:38:24 -06:00
bsg.c bsg: add io_uring command support to generic layer 2026-03-19 11:38:24 -06:00
disk-events.c loop: fix partition scan race between udev and loop_reread_partitions() 2026-03-31 07:04:34 -06:00
early-lookup.c
elevator.c block: use trylock to avoid lockdep circular dependency in sysfs 2026-03-05 04:01:42 -07:00
elevator.h block: fix race between wbt_enable_default and IO submission 2025-12-12 12:51:11 -07:00
fops.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
genhd.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
holder.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
ioctl.c block: only read from sqe on initial invocation of blkdev_uring_cmd() 2026-05-05 01:37:12 -06:00
ioprio.c
Kconfig
Kconfig.iosched
kyber-iosched.c kyber: covert to use request_queue->async_depth 2026-02-03 07:45:36 -07:00
Makefile block: add fs_bio_integrity helpers 2026-03-09 07:47:02 -06:00
mq-deadline.c mq-deadline: covert to use request_queue->async_depth 2026-02-03 07:45:36 -07:00
opal_proto.h sed-opal: Add STACK_RESET command 2026-03-31 07:04:00 -06:00
sed-opal.c sed-opal: Add STACK_RESET command 2026-03-31 07:04:00 -06:00
t10-pi.c blk-integrity: support arbitrary buffer alignment 2026-03-14 07:44:30 -06:00