From: John Garry <john.g.garry@oracle.com>
To: axboe@kernel.dk, hch@lst.de
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-raid@vger.kernel.org, martin.petersen@oracle.com,
John Garry <john.g.garry@oracle.com>
Subject: [PATCH RFC 6/6] md/raid10: Handle bio_split() errors
Date: Thu, 19 Sep 2024 09:23:02 +0000 [thread overview]
Message-ID: <20240919092302.3094725-7-john.g.garry@oracle.com> (raw)
In-Reply-To: <20240919092302.3094725-1-john.g.garry@oracle.com>
Add proper bio_split() error handling. For any read or write error, call
raid_end_bio_io() and return. For discard errors, just end the bio with
an error.
Signed-off-by: John Garry <john.g.garry@oracle.com>
---
drivers/md/raid10.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index f3bf1116794a..865f063acda6 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -1206,6 +1206,10 @@ static void raid10_read_request(struct mddev *mddev, struct bio *bio,
if (max_sectors < bio_sectors(bio)) {
struct bio *split = bio_split(bio, max_sectors,
gfp, &conf->bio_split);
+ if (IS_ERR(split)) {
+ raid_end_bio_io(r10_bio);
+ return;
+ }
bio_chain(split, bio);
allow_barrier(conf);
submit_bio_noacct(bio);
@@ -1482,6 +1486,10 @@ static void raid10_write_request(struct mddev *mddev, struct bio *bio,
if (r10_bio->sectors < bio_sectors(bio)) {
struct bio *split = bio_split(bio, r10_bio->sectors,
GFP_NOIO, &conf->bio_split);
+ if (IS_ERR(split)) {
+ raid_end_bio_io(r10_bio);
+ return;
+ }
bio_chain(split, bio);
allow_barrier(conf);
submit_bio_noacct(bio);
@@ -1644,6 +1652,11 @@ static int raid10_handle_discard(struct mddev *mddev, struct bio *bio)
if (remainder) {
split_size = stripe_size - remainder;
split = bio_split(bio, split_size, GFP_NOIO, &conf->bio_split);
+ if (IS_ERR(split)) {
+ bio->bi_status = errno_to_blk_status(PTR_ERR(split));
+ bio_endio(bio);
+ return 0;
+ }
bio_chain(split, bio);
allow_barrier(conf);
/* Resend the fist split part */
@@ -1654,6 +1667,11 @@ static int raid10_handle_discard(struct mddev *mddev, struct bio *bio)
if (remainder) {
split_size = bio_sectors(bio) - remainder;
split = bio_split(bio, split_size, GFP_NOIO, &conf->bio_split);
+ if (IS_ERR(split)) {
+ bio->bi_status = errno_to_blk_status(PTR_ERR(split));
+ bio_endio(bio);
+ return 0;
+ }
bio_chain(split, bio);
allow_barrier(conf);
/* Resend the second split part */
--
2.31.1
next prev parent reply other threads:[~2024-09-19 9:24 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-19 9:22 [PATCH RFC 0/6] bio_split() error handling rework John Garry
2024-09-19 9:22 ` [PATCH RFC 1/6] block: Rework bio_split() return value John Garry
2024-09-19 15:50 ` Johannes Thumshirn
2024-09-23 7:27 ` John Garry
2024-09-20 14:07 ` Christoph Hellwig
2024-09-19 9:22 ` [PATCH RFC 2/6] block: Error an attempt to split an atomic write in bio_split() John Garry
2024-09-19 9:22 ` [PATCH RFC 3/6] block: Handle bio_split() errors in bio_submit_split() John Garry
2024-09-20 14:09 ` Christoph Hellwig
2024-09-23 10:33 ` John Garry
2024-09-19 9:23 ` [PATCH RFC 4/6] md/raid0: Handle bio_split() errors John Garry
2024-09-20 14:10 ` Christoph Hellwig
2024-09-19 9:23 ` [PATCH RFC 5/6] md/raid1: " John Garry
2024-09-20 6:58 ` Yu Kuai
2024-09-20 10:04 ` John Garry
2024-09-23 6:15 ` Yu Kuai
2024-09-23 7:44 ` John Garry
2024-09-23 8:18 ` Yu Kuai
2024-09-23 9:21 ` John Garry
2024-09-23 9:38 ` Yu Kuai
2024-09-23 10:40 ` John Garry
2024-10-23 11:16 ` John Garry
2024-10-23 11:46 ` Geoff Back
2024-10-23 12:11 ` John Garry
2024-10-24 2:10 ` Yu Kuai
2024-10-24 8:57 ` John Garry
2024-10-24 9:12 ` Yu Kuai
2024-10-24 9:56 ` John Garry
2024-10-25 1:39 ` Yu Kuai
2024-10-23 11:21 ` John Garry
2024-10-24 3:08 ` Yu Kuai
2024-10-24 13:51 ` John Garry
2024-10-25 1:24 ` Yu Kuai
2024-09-19 9:23 ` John Garry [this message]
2024-09-23 5:53 ` [PATCH RFC 0/6] bio_split() error handling rework Hannes Reinecke
2024-09-23 7:19 ` John Garry
2024-09-23 9:43 ` Hannes Reinecke
2024-09-23 10:21 ` John Garry
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240919092302.3094725-7-john.g.garry@oracle.com \
--to=john.g.garry@oracle.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox