Mariusz Tkaczyk 9631abdbf4 md: Set MD_BROKEN for RAID1 and RAID10
There is no direct mechanism to determine raid failure outside
personality. It is done by checking rdev->flags after executing
md_error(). If "faulty" flag is not set then -EBUSY is returned to
userspace. -EBUSY means that array will be failed after drive removal.

Mdadm has special routine to handle the array failure and it is executed
if -EBUSY is returned by md.

There are at least two known reasons to not consider this mechanism
as correct:
1. drive can be removed even if array will be failed[1].
2. -EBUSY seems to be wrong status. Array is not busy, but removal
   process cannot proceed safe.

-EBUSY expectation cannot be removed without breaking compatibility
with userspace. In this patch first issue is resolved by adding support
for MD_BROKEN flag for RAID1 and RAID10. Support for RAID456 is added in
next commit.

The idea is to set the MD_BROKEN if we are sure that raid is in failed
state now. This is done in each error_handler(). In md_error() MD_BROKEN
flag is checked. If is set, then -EBUSY is returned to userspace.

As in previous commit, it causes that #mdadm --set-faulty is able to
fail array. Previously proposed workaround is valid if optional
functionality[1] is disabled.

[1] commit 9a567843f7ce("md: allow last device to be forcibly removed from
    RAID1/RAID10.")

Reviewd-by: Xiao Ni <xni@redhat.com>
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Signed-off-by: Song Liu <song@kernel.org>
2022-04-25 14:00:34 -07:00
..
2022-04-08 19:50:44 +02:00
2022-03-25 13:35:34 -07:00
2022-04-06 08:47:52 -06:00
2022-03-23 18:03:08 -07:00
2022-03-30 16:17:54 -07:00
2022-03-31 13:57:15 -07:00
2022-04-08 12:59:43 -07:00
2022-03-24 18:12:09 -07:00
2022-03-30 10:54:49 -07:00
2022-04-16 21:57:00 +02:00
2022-04-07 06:35:34 -10:00
2022-04-25 14:00:34 -07:00
2022-03-25 13:56:18 -07:00
2022-04-04 17:03:04 +02:00
2022-04-17 19:49:59 -06:00
2022-03-21 18:33:57 -07:00
2022-03-30 10:04:11 -07:00
2022-04-07 06:35:34 -10:00
2022-03-21 14:46:01 -07:00
2022-03-30 10:50:48 -07:00
2022-04-01 09:37:18 -07:00
2022-04-17 19:49:59 -06:00
2022-04-17 19:49:59 -06:00
2022-03-24 13:13:26 -07:00
2022-04-08 18:23:02 -10:00
2022-03-23 18:23:13 -07:00
2022-03-18 19:00:26 +01:00
2022-03-28 14:32:39 -07:00
2022-04-05 10:40:52 -07:00
2022-03-31 13:57:15 -07:00
2022-04-05 10:40:52 -07:00
2022-03-31 14:14:03 -07:00