Re: [PATCH RFC 5/6] md/raid1: Handle bio_split() errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





在 2024/10/23 19:21, John Garry 写道:
On 23/09/2024 07:15, Yu Kuai wrote:

Hi Kuai,

iff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 6c9d24203f39..c561e2d185e2 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1383,6 +1383,10 @@ static void raid1_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(r1_bio);
+            return;
+        }

This way, BLK_STS_IOERR will always be returned, perhaps what you want
is to return the error code from bio_split()?

I am not sure on the best way to pass the bio_split() error code to bio->bi_status.

I could just have this pattern:

bio->bi_status = errno_to_blk_status(err);
set_bit(R1BIO_Uptodate, &r1_bio->state);
raid_end_bio_io(r1_bio);

I can live with this. :)

Is there a neater way to do this?

Perhaps add a new filed 'status' in r1bio? And initialize it to
BLK_STS_IOERR;

Then replace:
set_bit(R1BIO_Uptodate, &r1_bio->state);
to:
r1_bio->status = BLK_STS_OK;

and change call_bio_endio:
bio->bi_status = r1_bio->status;

finially here:
r1_bio->status = errno_to_blk_status(err);
raid_end_bio_io(r1_bio);

Thanks,
Kuai


Thanks,
John


.






[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux