md/raid1: add error handling of read error from FailFast device
authorGioh Kim <gi-oh.kim@profitbricks.com>
Wed, 2 May 2018 11:08:11 +0000 (13:08 +0200)
committerShaohua Li <shli@fb.com>
Thu, 17 May 2018 16:55:59 +0000 (09:55 -0700)
Current handle_read_error() function calls fix_read_error()
only if md device is RW and rdev does not include FailFast flag.
It does not handle a read error from a RW device including
FailFast flag.

I am not sure it is intended. But I found that write IO error
sets rdev faulty. The md module should handle the read IO error and
write IO error equally. So I think read IO error should set rdev faulty.

Signed-off-by: Gioh Kim <gi-oh.kim@profitbricks.com>
Reviewed-by: Jack Wang <jinpu.wang@profitbricks.com>
Signed-off-by: Shaohua Li <shli@fb.com>
drivers/md/raid1.c

index 397b3d80c48b42f1727eeeb40fb8966e36267d4a..28ad97eeb6ab9949fc497ef551dda16f0e81a8dd 100644 (file)
@@ -2472,6 +2472,8 @@ static void handle_read_error(struct r1conf *conf, struct r1bio *r1_bio)
                fix_read_error(conf, r1_bio->read_disk,
                               r1_bio->sector, r1_bio->sectors);
                unfreeze_array(conf);
+       } else if (mddev->ro == 0 && test_bit(FailFast, &rdev->flags)) {
+               md_error(mddev, rdev);
        } else {
                r1_bio->bios[r1_bio->read_disk] = IO_BLOCKED;
        }