diff options
author | Guoqing Jiang <jgq516@gmail.com> | 2019-07-24 11:09:19 +0200 |
---|---|---|
committer | Song Liu <songliubraving@fb.com> | 2019-08-07 19:25:02 +0200 |
commit | 9a567843f7ce0037bfd4d5fdc58a09d0a527b28b (patch) | |
tree | aa29a87219000763dc42b289f2141fec5bc053f6 /drivers/md/raid1.c | |
parent | md: Convert to use int_pow() (diff) | |
download | linux-9a567843f7ce0037bfd4d5fdc58a09d0a527b28b.tar.xz linux-9a567843f7ce0037bfd4d5fdc58a09d0a527b28b.zip |
md: allow last device to be forcibly removed from RAID1/RAID10.
When the 'last' device in a RAID1 or RAID10 reports an error,
we do not mark it as failed. This would serve little purpose
as there is no risk of losing data beyond that which is obviously
lost (as there is with RAID5), and there could be other sectors
on the device which are readable, and only readable from this device.
This in general this maximises access to data.
However the current implementation also stops an admin from removing
the last device by direct action. This is rarely useful, but in many
case is not harmful and can make automation easier by removing special
cases.
Also, if an attempt to write metadata fails the device must be marked
as faulty, else an infinite loop will result, attempting to update
the metadata on all non-faulty devices.
So add 'fail_last_dev' member to 'struct mddev', then we can bypasses
the 'last disk' checks for RAID1 and RAID10, and control the behavior
per array by change sysfs node.
Signed-off-by: NeilBrown <neilb@suse.de>
[add sysfs node for fail_last_dev by Guoqing]
Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
Signed-off-by: Song Liu <songliubraving@fb.com>
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r-- | drivers/md/raid1.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 7ffbd8112400..cd80f281b95d 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -1617,12 +1617,12 @@ static void raid1_error(struct mddev *mddev, struct md_rdev *rdev) /* * If it is not operational, then we have already marked it as dead - * else if it is the last working disks, ignore the error, let the - * next level up know. + * else if it is the last working disks with "fail_last_dev == false", + * ignore the error, let the next level up know. * else mark the drive as failed */ spin_lock_irqsave(&conf->device_lock, flags); - if (test_bit(In_sync, &rdev->flags) + if (test_bit(In_sync, &rdev->flags) && !mddev->fail_last_dev && (conf->raid_disks - mddev->degraded) == 1) { /* * Don't fail the drive, act as though we were just a |