Message ID | 20240919092302.3094725-5-john.g.garry@oracle.com (mailing list archive) |
---|---|
State | Handled Elsewhere |
Headers | show |
Series | bio_split() error handling rework | expand |
Context | Check | Description |
---|---|---|
mdraidci/vmtest-md-6_12-PR | fail | merge-conflict |
On Thu, Sep 19, 2024 at 09:23:00AM +0000, John Garry wrote: > Add proper bio_split() error handling. For any error, set bi_status, end > the bio, and return. > > Signed-off-by: John Garry <john.g.garry@oracle.com> > --- > drivers/md/raid0.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c > index 32d587524778..d8ad69620c9d 100644 > --- a/drivers/md/raid0.c > +++ b/drivers/md/raid0.c > @@ -466,6 +466,11 @@ static void raid0_handle_discard(struct mddev *mddev, struct bio *bio) > struct bio *split = bio_split(bio, > zone->zone_end - bio->bi_iter.bi_sector, GFP_NOIO, > &mddev->bio_set); > + if (IS_ERR(split)) { Empty line after the variable declarations. Also jumping out of the loop to an error handling label might be beneficial here, but that's probably up to the maintainers. Same for the other hunk (and probably the other raid personalities).
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index 32d587524778..d8ad69620c9d 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c @@ -466,6 +466,11 @@ static void raid0_handle_discard(struct mddev *mddev, struct bio *bio) struct bio *split = bio_split(bio, zone->zone_end - bio->bi_iter.bi_sector, GFP_NOIO, &mddev->bio_set); + if (IS_ERR(split)) { + bio->bi_status = errno_to_blk_status(PTR_ERR(split)); + bio_endio(bio); + return; + } bio_chain(split, bio); submit_bio_noacct(bio); bio = split; @@ -608,6 +613,11 @@ static bool raid0_make_request(struct mddev *mddev, struct bio *bio) if (sectors < bio_sectors(bio)) { struct bio *split = bio_split(bio, sectors, GFP_NOIO, &mddev->bio_set); + if (IS_ERR(split)) { + bio->bi_status = errno_to_blk_status(PTR_ERR(split)); + bio_endio(bio); + return true; + } bio_chain(split, bio); raid0_map_submit_bio(mddev, bio); bio = split;
Add proper bio_split() error handling. For any error, set bi_status, end the bio, and return. Signed-off-by: John Garry <john.g.garry@oracle.com> --- drivers/md/raid0.c | 10 ++++++++++ 1 file changed, 10 insertions(+)