Re: [PATCH v4 2/2] mdadm: Introduce new array state 'broken' for raid0/linear

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 9/3/19 3:49 PM, Guilherme G. Piccoli wrote:
Currently if a md raid0/linear array gets one or more members removed while
being mounted, kernel keeps showing state 'clean' in the 'array_state'
sysfs attribute. Despite udev signaling the member device is gone, 'mdadm'
cannot issue the STOP_ARRAY ioctl successfully, given the array is mounted.

Nothing else hints that something is wrong (except that the removed devices
don't show properly in the output of mdadm 'detail' command). There is no
other property to be checked, and if user is not performing reads/writes
to the array, even kernel log is quiet and doesn't give a clue about the
missing member.

This patch is the mdadm counterpart of kernel new array state 'broken'.
The 'broken' state mimics the state 'clean' in every aspect, being useful
only to distinguish if an array has some member missing. All necessary
paths in mdadm were changed to deal with 'broken' state, and in case the
tool runs in a kernel that is not updated, it'll work normally, i.e., it
doesn't require the 'broken' state in order to work.
Also, this patch changes the way the array state is showed in the 'detail'
command (for raid0/linear only) - now it takes the 'array_state' sysfs
attribute into account instead of only rely in the MD_SB_CLEAN flag.

Cc: Jes Sorensen <jes.sorensen@xxxxxxxxx>
Cc: NeilBrown <neilb@xxxxxxx>
Cc: Song Liu <songliubraving@xxxxxx>
Signed-off-by: Guilherme G. Piccoli <gpiccoli@xxxxxxxxxxxxx>
---

Applied thanks!

I fixed up one minor nit rather than having to do the merry-go-round by email one more time:

diff --git a/Monitor.c b/Monitor.c
index 036103f..cf0610b 100644
--- a/Monitor.c
+++ b/Monitor.c
[snip]

@@ -1116,7 +1119,8 @@ int WaitClean(char *dev, int verbose)
  			rv = read(state_fd, buf, sizeof(buf));
  			if (rv < 0)
  				break;
-			if (sysfs_match_word(buf, clean_states) <= 4)
+			if (sysfs_match_word(buf, clean_states)
+			    < (int)ARRAY_SIZE(clean_states)-1)

I moved the < up to the correct line where it belongs, and added spaces ") - 1)"

Cheers,
Jes



[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux