bcachefs/drivers/md
Damien Le Moal b76b840fd9 dm: Fix dm-zoned-reclaim zone write pointer alignment
The zone reclaim processing of the dm-zoned device mapper uses
blkdev_issue_zeroout() to align the write pointer of a zone being used
for reclaiming another zone, to write the valid data blocks from the
zone being reclaimed at the same position relative to the zone start in
the reclaim target zone.

The first call to blkdev_issue_zeroout() will try to use hardware
offload using a REQ_OP_WRITE_ZEROES operation if the device reports a
non-zero max_write_zeroes_sectors queue limit. If this operation fails
because of the lack of hardware support, blkdev_issue_zeroout() falls
back to using a regular write operation with the zero-page as buffer.
Currently, such REQ_OP_WRITE_ZEROES failure is automatically handled by
the block layer zone write plugging code which will execute a report
zones operation to ensure that the write pointer of the target zone of
the failed operation has not changed and to "rewind" the zone write
pointer offset of the target zone as it was advanced when the write zero
operation was submitted. So the REQ_OP_WRITE_ZEROES failure does not
cause any issue and blkdev_issue_zeroout() works as expected.

However, since the automatic recovery of zone write pointers by the zone
write plugging code can potentially cause deadlocks with queue freeze
operations, a different recovery must be implemented in preparation for
the removal of zone write plugging report zones based recovery.

Do this by introducing the new function blk_zone_issue_zeroout(). This
function first calls blkdev_issue_zeroout() with the flag
BLKDEV_ZERO_NOFALLBACK to intercept failures on the first execution
which attempt to use the device hardware offload with the
REQ_OP_WRITE_ZEROES operation. If this attempt fails, a report zone
operation is issued to restore the zone write pointer offset of the
target zone to the correct position and blkdev_issue_zeroout() is called
again without the BLKDEV_ZERO_NOFALLBACK flag. The report zones
operation performing this recovery is implemented using the helper
function disk_zone_sync_wp_offset() which calls the gendisk report_zones
file operation with the callback disk_report_zones_cb(). This callback
updates the target write pointer offset of the target zone using the new
function disk_zone_wplug_sync_wp_offset().

dmz_reclaim_align_wp() is modified to change its call to
blkdev_issue_zeroout() to a call to blk_zone_issue_zeroout() without any
other change needed as the two functions are functionnally equivalent.

Fixes: dd291d77cc ("block: Introduce zone write plugging")
Cc: stable@vger.kernel.org
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Acked-by: Mike Snitzer <snitzer@kernel.org>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Link: https://lore.kernel.org/r/20241209122357.47838-4-dlemoal@kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2024-12-10 09:15:33 -07:00
..
bcache bcache: revert replacing IS_ERR_OR_NULL with IS_ERR again 2024-12-03 15:06:27 -07:00
dm-vdo - Dm: remove unused functions and variables 2024-11-25 18:54:00 -08:00
persistent-data dm: Fix typo in error message 2024-11-20 11:38:04 +01:00
dm-audit.c
dm-audit.h
dm-bio-prison-v1.c dm cache: Remove unused functions in bio-prison-v1 2024-11-20 11:38:04 +01:00
dm-bio-prison-v1.h dm cache: Remove unused functions in bio-prison-v1 2024-11-20 11:38:04 +01:00
dm-bio-prison-v2.c
dm-bio-prison-v2.h
dm-bio-record.h
dm-bufio.c dm-bufio: use kmalloc to allocate power-of-two sized buffers 2024-11-20 11:44:23 +01:00
dm-builtin.c
dm-cache-background-tracker.c dm cache: Remove unused btracker_nr_writebacks_queued 2024-11-20 11:38:04 +01:00
dm-cache-background-tracker.h dm cache: Remove unused btracker_nr_writebacks_queued 2024-11-20 11:38:04 +01:00
dm-cache-block-types.h
dm-cache-metadata.c dm cache: Remove unused dm_cache_size 2024-11-20 11:38:04 +01:00
dm-cache-metadata.h dm cache: Remove unused dm_cache_size 2024-11-20 11:38:04 +01:00
dm-cache-policy-internal.h
dm-cache-policy-smq.c
dm-cache-policy.c
dm-cache-policy.h
dm-cache-target.c for-6.13/block-20241118 2024-11-18 16:50:08 -08:00
dm-clone-metadata.c dm: Make use of __assign_bit() API 2024-09-02 16:53:53 +02:00
dm-clone-metadata.h
dm-clone-target.c block: add a bdev_limits helper 2024-10-29 09:15:00 -06:00
dm-core.h
dm-crypt.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
dm-delay.c
dm-dust.c
dm-ebs-target.c dm: stop using blk_limits_io_{min,opt} 2024-07-10 13:10:06 +02:00
dm-era-target.c dm: Constify struct dm_block_validator 2024-07-19 12:08:15 +02:00
dm-exception-store.c
dm-exception-store.h
dm-flakey.c
dm-ima.c
dm-ima.h
dm-init.c dm init: Handle minors larger than 255 2024-07-02 20:53:41 +02:00
dm-integrity.c - Misc VDO fixes 2024-09-27 09:12:51 -07:00
dm-io-rewind.c
dm-io-tracker.h
dm-io.c
dm-ioctl.c dm ioctl: rate limit a couple of ioctl based error messages 2024-11-20 11:38:04 +01:00
dm-kcopyd.c
dm-linear.c
dm-log-userspace-base.c
dm-log-userspace-transfer.c
dm-log-userspace-transfer.h
dm-log-writes.c
dm-log.c
dm-mpath.c dm mpath: don't call dm_get_device in multipath_message 2024-07-10 13:10:06 +02:00
dm-mpath.h
dm-path-selector.c
dm-path-selector.h
dm-ps-historical-service-time.c
dm-ps-io-affinity.c
dm-ps-queue-length.c
dm-ps-round-robin.c
dm-ps-service-time.c
dm-raid1.c
dm-raid.c - Misc VDO fixes 2024-09-27 09:12:51 -07:00
dm-region-hash.c
dm-rq.c Revert "dm: requeue IO if mapping table not yet available" 2024-09-15 21:02:54 +02:00
dm-rq.h
dm-snap-persistent.c
dm-snap-transient.c
dm-snap.c
dm-stats.c
dm-stats.h
dm-stripe.c dm: stop using blk_limits_io_{min,opt} 2024-07-10 13:10:06 +02:00
dm-switch.c
dm-sysfs.c
dm-table.c dm: Remove unused dm_table_bio_based 2024-11-20 11:38:04 +01:00
dm-target.c
dm-thin-metadata.c dm: Constify struct dm_block_validator 2024-07-19 12:08:15 +02:00
dm-thin-metadata.h
dm-thin.c - Dm: remove unused functions and variables 2024-11-25 18:54:00 -08:00
dm-uevent.c
dm-uevent.h
dm-unstripe.c dm-unstriped: cast an operand to sector_t to prevent potential uint32_t overflow 2024-11-04 17:34:56 +01:00
dm-verity-fec.c dm-verity: make verity_hash() take dm_verity_io instead of ahash_request 2024-07-03 21:41:11 +02:00
dm-verity-fec.h dm-verity: always "map" the data blocks 2024-07-03 21:41:11 +02:00
dm-verity-loadpin.c
dm-verity-target.c dm-verity: remove the unused "data_start" variable 2024-11-20 11:44:44 +01:00
dm-verity-verify-sig.c dm verity: fallback to platform keyring also if key in trusted keyring is rejected 2024-09-26 17:27:08 +02:00
dm-verity-verify-sig.h
dm-verity.h dm-verity: remove the unused "data_start" variable 2024-11-20 11:44:44 +01:00
dm-writecache.c
dm-zero.c
dm-zone.c block: pre-calculate max_zone_append_sectors 2024-11-11 09:20:36 -07:00
dm-zoned-metadata.c dm: zoned: Remove unused functions 2024-11-20 11:38:04 +01:00
dm-zoned-reclaim.c dm: Fix dm-zoned-reclaim zone write pointer alignment 2024-12-10 09:15:33 -07:00
dm-zoned-target.c dm: stop using blk_limits_io_{min,opt} 2024-07-10 13:10:06 +02:00
dm-zoned.h dm: zoned: Remove unused functions 2024-11-20 11:38:04 +01:00
dm.c dm: add support for get_unique_id 2024-11-20 11:38:04 +01:00
dm.h dm: Remove unused dm_table_bio_based 2024-11-20 11:38:04 +01:00
Kconfig dm verity: add support for signature verification with platform keyring 2024-07-03 21:41:11 +02:00
Makefile
md-autodetect.c
md-bitmap.c md/md-bitmap: Add missing destroy_work_on_stack() 2024-11-05 21:06:51 -08:00
md-bitmap.h md/md-bitmap: make in memory structure internal 2024-08-27 12:43:16 -07:00
md-cluster.c md/md-bitmap: make in memory structure internal 2024-08-27 12:43:16 -07:00
md-cluster.h md-cluster: fix no recovery job when adding/re-adding a disk 2024-07-12 01:30:18 +00:00
md.c for-6.13/block-20241118 2024-11-18 16:50:08 -08:00
md.h md: add a new helper rdev_blocked() 2024-11-05 16:08:38 -08:00
raid0.c md/raid0: Atomic write support 2024-11-19 10:30:02 -07:00
raid0.h
raid1-10.c md/md-bitmap: merge md_bitmap_enabled() into bitmap_operations 2024-08-27 12:43:16 -07:00
raid1.c md/raid1: Atomic write support 2024-11-19 10:30:02 -07:00
raid1.h
raid5-cache.c md/raid5: use wait_on_bit() for R5_Overlap 2024-08-29 09:37:10 -07:00
raid5-log.h
raid5-ppl.c md/raid5-ppl: Use atomic64_inc_return() in ppl_new_iounit() 2024-11-05 16:08:38 -08:00
raid5.c md/raid5: Wait sync io to finish before changing group cnt 2024-11-07 15:34:52 -08:00
raid5.h md/raid5: Increase r5conf.cache_name size 2024-11-12 15:11:09 -08:00
raid10.c block-6.13-20242901 2024-11-30 15:47:29 -08:00
raid10.h