]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
md/raid10: add a new r10bio flag R10BIO_Returned
authorYu Kuai <yukuai3@huawei.com>
Wed, 10 Sep 2025 06:30:49 +0000 (14:30 +0800)
committerJens Axboe <axboe@kernel.dk>
Wed, 10 Sep 2025 11:23:45 +0000 (05:23 -0600)
The new helper bio_submit_split_bioset() can failed the orginal bio on
split errors, prepare to handle this case in raid_end_bio_io().

The flag name is refer to the r1bio flag name.

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/md/raid10.c
drivers/md/raid10.h

index 3d7b24d6b4eb492152ed6ce1cf418d05e2ebdf88..cac5c6df75bbb0d09134f17ad12db10d94f82699 100644 (file)
@@ -322,10 +322,12 @@ static void raid_end_bio_io(struct r10bio *r10_bio)
        struct bio *bio = r10_bio->master_bio;
        struct r10conf *conf = r10_bio->mddev->private;
 
-       if (!test_bit(R10BIO_Uptodate, &r10_bio->state))
-               bio->bi_status = BLK_STS_IOERR;
+       if (!test_and_set_bit(R10BIO_Returned, &r10_bio->state)) {
+               if (!test_bit(R10BIO_Uptodate, &r10_bio->state))
+                       bio->bi_status = BLK_STS_IOERR;
+               bio_endio(bio);
+       }
 
-       bio_endio(bio);
        /*
         * Wake up any possible resync thread that waits for the device
         * to go idle.
index 3f16ad6904a9fb21c8719aa80c27a48fa0ebe021..da00a55f7a55e9eaff2c7053b88778513ff20d1f 100644 (file)
@@ -165,6 +165,8 @@ enum r10bio_state {
  * so that raid10d knows what to do with them.
  */
        R10BIO_ReadError,
+/* For bio_split errors, record that bi_end_io was called. */
+       R10BIO_Returned,
 /* If a write for this request means we can clear some
  * known-bad-block records, we set this flag.
  */