Skip to content

Commit 47dc096

Browse files
Christoph Hellwigaxboe
authored andcommitted
block: memory allocations in bounce_clone_bio must not fail
The caller can't cope with a failure from bounce_clone_bio, so use __GFP_NOFAIL for the passthrough case. bio_alloc_bioset already won't fail due to the use of mempools. And yes, we need to get rid of this bock layer bouncing code entirely sooner or later.. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent ebfe418 commit 47dc096

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

block/bounce.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,12 +242,11 @@ static struct bio *bounce_clone_bio(struct bio *bio_src)
242242
* __bio_clone_fast() anyways.
243243
*/
244244
if (bio_is_passthrough(bio_src))
245-
bio = bio_kmalloc(GFP_NOIO, bio_segments(bio_src));
245+
bio = bio_kmalloc(GFP_NOIO | __GFP_NOFAIL,
246+
bio_segments(bio_src));
246247
else
247248
bio = bio_alloc_bioset(GFP_NOIO, bio_segments(bio_src),
248249
&bounce_bio_set);
249-
if (!bio)
250-
return NULL;
251250
bio->bi_bdev = bio_src->bi_bdev;
252251
if (bio_flagged(bio_src, BIO_REMAPPED))
253252
bio_set_flag(bio, BIO_REMAPPED);

0 commit comments

Comments
 (0)