Commit b5129bda authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe
Browse files

block: only restrict bio allocation gfp mask asked to block



If the caller is asking for a non-blocking allocation, we should not
further restrict the gfp mask, which just increases the likelihood
of failures.

Fixes: b520c4ee ("block: split bio_alloc_bioset more clearly into a fast and slowpath")
Reported-by: default avatarShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarBart Van Assche <bvanassche@acm.org>
Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
Link: https://patch.msgid.link/20260415060813.807659-3-hch@lst.de


Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 19d32966
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -544,6 +544,7 @@ struct bio *bio_alloc_bioset(struct block_device *bdev, unsigned short nr_vecs,
	if (WARN_ON_ONCE(!mempool_initialized(&bs->bvec_pool) && nr_vecs > 0))
		return NULL;

	if (saved_gfp & __GFP_DIRECT_RECLAIM)
		gfp = try_alloc_gfp(gfp);
	if (bs->cache && nr_vecs <= BIO_INLINE_VECS) {
		/*