• Guoqing Jiang's avatar
    md: allow last device to be forcibly removed from RAID1/RAID10. · 9a567843
    Guoqing Jiang authored
    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: default avatarNeilBrown <neilb@suse.de>
    [add sysfs node for fail_last_dev by Guoqing]
    Signed-off-by: default avatarGuoqing Jiang <guoqing.jiang@cloud.ionos.com>
    Signed-off-by: default avatarSong Liu <songliubraving@fb.com>
    9a567843
md.c 250 KB