Skip to content

Commit b5129bd

Browse files
Christoph Hellwigaxboe
authored andcommitted
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: b520c4e ("block: split bio_alloc_bioset more clearly into a fast and slowpath") Reported-by: Shin'ichiro Kawasaki <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 19d3296 commit b5129bd

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

block/bio.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,8 @@ struct bio *bio_alloc_bioset(struct block_device *bdev, unsigned short nr_vecs,
544544
if (WARN_ON_ONCE(!mempool_initialized(&bs->bvec_pool) && nr_vecs > 0))
545545
return NULL;
546546

547-
gfp = try_alloc_gfp(gfp);
547+
if (saved_gfp & __GFP_DIRECT_RECLAIM)
548+
gfp = try_alloc_gfp(gfp);
548549
if (bs->cache && nr_vecs <= BIO_INLINE_VECS) {
549550
/*
550551
* Set REQ_ALLOC_CACHE even if no cached bio is available to

0 commit comments

Comments
 (0)