block: Ignore REQ_NOWAIT for zone reset and zone finish operations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Damien Le Moal <dlemoal@xxxxxxxxxx>

commit 5eb3317aa5a2ffe4574ab1a12cf9bc9447ca26c0 upstream.

There are currently any issuer of REQ_OP_ZONE_RESET and
REQ_OP_ZONE_FINISH operations that set REQ_NOWAIT. However, as we cannot
handle this flag correctly due to the potential request allocation
failure that may happen in blk_mq_submit_bio() after blk_zone_plug_bio()
has handled the zone write plug write pointer updates for the targeted
zones, modify blk_zone_wplug_handle_reset_or_finish() to warn if this
flag is set and ignore it.

Fixes: dd291d77cc90 ("block: Introduce zone write plugging")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Damien Le Moal <dlemoal@xxxxxxxxxx>
Reviewed-by: Christoph Hellwig <hch@xxxxxx>
Reviewed-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx>
Link: https://lore.kernel.org/r/20241209122357.47838-3-dlemoal@xxxxxxxxxx
Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 block/blk-zoned.c |    9 +++++++++
 1 file changed, 9 insertions(+)

--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -704,6 +704,15 @@ static bool blk_zone_wplug_handle_reset_
 	}
 
 	/*
+	 * No-wait reset or finish BIOs do not make much sense as the callers
+	 * issue these as blocking operations in most cases. To avoid issues
+	 * the BIO execution potentially failing with BLK_STS_AGAIN, warn about
+	 * REQ_NOWAIT being set and ignore that flag.
+	 */
+	if (WARN_ON_ONCE(bio->bi_opf & REQ_NOWAIT))
+		bio->bi_opf &= ~REQ_NOWAIT;
+
+	/*
 	 * If we have a zone write plug, set its write pointer offset to 0
 	 * (reset case) or to the zone size (finish case). This will abort all
 	 * BIOs plugged for the target zone. It is fine as resetting or


Patches currently in stable-queue which might be from dlemoal@xxxxxxxxxx are

queue-6.12/block-switch-to-using-refcount_t-for-zone-write-plugs.patch
queue-6.12/block-ignore-req_nowait-for-zone-reset-and-zone-finish-operations.patch
queue-6.12/block-use-a-zone-write-plug-bio-work-for-req_nowait-bios.patch
queue-6.12/block-prevent-potential-deadlocks-in-zone-write-plug-error-recovery.patch
queue-6.12/dm-fix-dm-zoned-reclaim-zone-write-pointer-alignment.patch




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux