|
@@ -422,7 +422,24 @@ static void raid1_end_write_request(struct bio *bio)
|
|
|
set_bit(MD_RECOVERY_NEEDED, &
|
|
|
conf->mddev->recovery);
|
|
|
|
|
|
- set_bit(R1BIO_WriteError, &r1_bio->state);
|
|
|
+ if (test_bit(FailFast, &rdev->flags) &&
|
|
|
+ (bio->bi_opf & MD_FAILFAST) &&
|
|
|
+ /* We never try FailFast to WriteMostly devices */
|
|
|
+ !test_bit(WriteMostly, &rdev->flags)) {
|
|
|
+ md_error(r1_bio->mddev, rdev);
|
|
|
+ if (!test_bit(Faulty, &rdev->flags))
|
|
|
+ /* This is the only remaining device,
|
|
|
+ * We need to retry the write without
|
|
|
+ * FailFast
|
|
|
+ */
|
|
|
+ set_bit(R1BIO_WriteError, &r1_bio->state);
|
|
|
+ else {
|
|
|
+ /* Finished with this branch */
|
|
|
+ r1_bio->bios[mirror] = NULL;
|
|
|
+ to_put = bio;
|
|
|
+ }
|
|
|
+ } else
|
|
|
+ set_bit(R1BIO_WriteError, &r1_bio->state);
|
|
|
} else {
|
|
|
/*
|
|
|
* Set R1BIO_Uptodate in our master bio, so that we
|
|
@@ -1392,6 +1409,10 @@ read_again:
|
|
|
mbio->bi_bdev = conf->mirrors[i].rdev->bdev;
|
|
|
mbio->bi_end_io = raid1_end_write_request;
|
|
|
bio_set_op_attrs(mbio, op, do_flush_fua | do_sync);
|
|
|
+ if (test_bit(FailFast, &conf->mirrors[i].rdev->flags) &&
|
|
|
+ !test_bit(WriteMostly, &conf->mirrors[i].rdev->flags) &&
|
|
|
+ conf->raid_disks - mddev->degraded > 1)
|
|
|
+ mbio->bi_opf |= MD_FAILFAST;
|
|
|
mbio->bi_private = r1_bio;
|
|
|
|
|
|
atomic_inc(&r1_bio->remaining);
|
|
@@ -2060,6 +2081,9 @@ static void sync_request_write(struct mddev *mddev, struct r1bio *r1_bio)
|
|
|
continue;
|
|
|
|
|
|
bio_set_op_attrs(wbio, REQ_OP_WRITE, 0);
|
|
|
+ if (test_bit(FailFast, &conf->mirrors[i].rdev->flags))
|
|
|
+ wbio->bi_opf |= MD_FAILFAST;
|
|
|
+
|
|
|
wbio->bi_end_io = end_sync_write;
|
|
|
atomic_inc(&r1_bio->remaining);
|
|
|
md_sync_acct(conf->mirrors[i].rdev->bdev, bio_sectors(wbio));
|