Skip to content

Commit 74538fd

Browse files
johnpgarryaxboe
authored andcommitted
md/raid0: Handle bio_split() errors
Add proper bio_split() error handling. For any error, set bi_status, end the bio, and return. Reviewed-by: Yu Kuai <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Signed-off-by: John Garry <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 6eb0968 commit 74538fd

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

drivers/md/raid0.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,12 @@ static void raid0_handle_discard(struct mddev *mddev, struct bio *bio)
466466
struct bio *split = bio_split(bio,
467467
zone->zone_end - bio->bi_iter.bi_sector, GFP_NOIO,
468468
&mddev->bio_set);
469+
470+
if (IS_ERR(split)) {
471+
bio->bi_status = errno_to_blk_status(PTR_ERR(split));
472+
bio_endio(bio);
473+
return;
474+
}
469475
bio_chain(split, bio);
470476
submit_bio_noacct(bio);
471477
bio = split;
@@ -608,6 +614,12 @@ static bool raid0_make_request(struct mddev *mddev, struct bio *bio)
608614
if (sectors < bio_sectors(bio)) {
609615
struct bio *split = bio_split(bio, sectors, GFP_NOIO,
610616
&mddev->bio_set);
617+
618+
if (IS_ERR(split)) {
619+
bio->bi_status = errno_to_blk_status(PTR_ERR(split));
620+
bio_endio(bio);
621+
return true;
622+
}
611623
bio_chain(split, bio);
612624
raid0_map_submit_bio(mddev, bio);
613625
bio = split;

0 commit comments

Comments
 (0)