Skip to content

Commit 5eb3317

Browse files
damien-lemoalaxboe
authored andcommitted
block: Ignore REQ_NOWAIT for zone reset and zone finish operations
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: dd291d7 ("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> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Link: https://lore.kernel.org/r/20241209122357.47838-3-dlemoal@kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent cae0056 commit 5eb3317

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

block/blk-zoned.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,15 @@ static bool blk_zone_wplug_handle_reset_or_finish(struct bio *bio,
707707
return true;
708708
}
709709

710+
/*
711+
* No-wait reset or finish BIOs do not make much sense as the callers
712+
* issue these as blocking operations in most cases. To avoid issues
713+
* the BIO execution potentially failing with BLK_STS_AGAIN, warn about
714+
* REQ_NOWAIT being set and ignore that flag.
715+
*/
716+
if (WARN_ON_ONCE(bio->bi_opf & REQ_NOWAIT))
717+
bio->bi_opf &= ~REQ_NOWAIT;
718+
710719
/*
711720
* If we have a zone write plug, set its write pointer offset to 0
712721
* (reset case) or to the zone size (finish case). This will abort all

0 commit comments

Comments
 (0)