From: Damien Le Moal Date: Mon, 9 Dec 2024 12:23:55 +0000 (+0900) Subject: block: Ignore REQ_NOWAIT for zone reset and zone finish operations X-Git-Tag: v6.12.6~143 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0eae680d03fb15b8a8f461b9a80b250b7b869e03;p=thirdparty%2Fkernel%2Fstable.git block: Ignore REQ_NOWAIT for zone reset and zone finish operations 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@vger.kernel.org Signed-off-by: Damien Le Moal Reviewed-by: Christoph Hellwig Reviewed-by: Martin K. Petersen Link: https://lore.kernel.org/r/20241209122357.47838-3-dlemoal@kernel.org Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- diff --git a/block/blk-zoned.c b/block/blk-zoned.c index 185f37c72d6a7..6d21693f39b78 100644 --- a/block/blk-zoned.c +++ b/block/blk-zoned.c @@ -703,6 +703,15 @@ static bool blk_zone_wplug_handle_reset_or_finish(struct bio *bio, return true; } + /* + * 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