diff -Nru mdadm-4.1~rc1/debian/changelog mdadm-4.1~rc1/debian/changelog --- mdadm-4.1~rc1/debian/changelog 2019-04-10 11:14:17.000000000 -0300 +++ mdadm-4.1~rc1/debian/changelog 2020-01-14 16:10:59.000000000 -0300 @@ -1,3 +1,22 @@ +mdadm (4.1~rc1-3~ubuntu18.04.4) bionic; urgency=medium + + * Introduce "broken" state for RAID0/Linear in mdadm (LP: #1847924) + - d/p/lp1847924-Introduce-new-array-state-broken-for-raid0.patch + + * Disable patches from proposed version 4.1~rc1-3~ubuntu18.04.3 due to + issues with kernel + + -- Guilherme G. Piccoli Tue, 14 Jan 2020 16:10:59 -0300 + +mdadm (4.1~rc1-3~ubuntu18.04.3) bionic-proposed; urgency=medium + + * Add support for RAID0 layouts. Released kernels are being updated + to require an explicit layout version for multi-zone RAID0 arrays + to avoid potential corruption. This update allows users to program + such a layout version into the metadata of an array. LP: #1850540 + + -- dann frazier Wed, 04 Dec 2019 12:52:00 -0700 + mdadm (4.1~rc1-3~ubuntu18.04.2) bionic; urgency=medium * d/p/lp-1811228-imsm-Block-volume-creation-with-empty-name.patch: avoid diff -Nru mdadm-4.1~rc1/debian/patches/lp1847924-Introduce-new-array-state-broken-for-raid0.patch mdadm-4.1~rc1/debian/patches/lp1847924-Introduce-new-array-state-broken-for-raid0.patch --- mdadm-4.1~rc1/debian/patches/lp1847924-Introduce-new-array-state-broken-for-raid0.patch 1969-12-31 21:00:00.000000000 -0300 +++ mdadm-4.1~rc1/debian/patches/lp1847924-Introduce-new-array-state-broken-for-raid0.patch 2020-01-14 16:10:38.000000000 -0300 @@ -0,0 +1,160 @@ +Subject: Introduce new array state 'broken' for raid0/linear + +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. + +NOTICE *** the original version of this patch also changes the way the +array state is showed in the 'detail' command (for raid0/linear only), +taking the sysfs attribute 'array_state' into account. +But ** for SRU purposes ** this specific version keeps the old behavior +in Bionic / Eoan, adding just the 'broken' state, otherwise always +showing 'clean'. + +Author: Guilherme G. Piccoli +Origin: upstream, +git.kernel.org/pub/scm/utils/mdadm/mdadm.git/commit/?id=43ebc9105e9d +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1847924 +Bug-Debian: http://bugs.debian.org/943520 +Last-Update: 2020-01-14 + +diff --git a/Detail.c b/Detail.c +index 860241ce2017..9fe0170816ad 100644 +--- a/Detail.c ++++ b/Detail.c +@@ -81,6 +81,7 @@ int Detail(char *dev, struct context *c) + int external; + int inactive; + int is_container = 0; ++ char *arrayst; + + if (fd < 0) { + pr_err("cannot open %s: %s\n", +@@ -483,9 +484,25 @@ int Detail(char *dev, struct context *c) + else + st = ", degraded"; + ++ if (array.state & (1 << MD_SB_CLEAN)) { ++ if ((array.level == 0) || ++ (array.level == LEVEL_LINEAR)) { ++ arrayst = map_num(sysfs_array_states, ++ sra->array_state); ++ ++ /* This is to keep output compatibility ++ * in the SRU for B/E - we only change ++ * the state output in case it's "broken" ++ */ ++ if (strcmp(arrayst, "broken")) ++ arrayst = "clean"; ++ } else ++ arrayst = "clean"; ++ } else ++ arrayst = "active"; ++ + printf(" State : %s%s%s%s%s%s \n", +- (array.state & (1 << MD_SB_CLEAN)) ? +- "clean" : "active", st, ++ arrayst, st, + (!e || (e->percent < 0 && + e->percent != RESYNC_PENDING && + e->percent != RESYNC_DELAYED)) ? +diff --git a/Monitor.c b/Monitor.c +index 036103fb0f6b..b527165b803a 100644 +--- a/Monitor.c ++++ b/Monitor.c +@@ -1055,8 +1055,11 @@ int Wait(char *dev) + } + } + ++/* The state "broken" is used only for RAID0/LINEAR - it's the same as ++ * "clean", but used in case the array has one or more members missing. ++ */ + static char *clean_states[] = { +- "clear", "inactive", "readonly", "read-auto", "clean", NULL }; ++ "clear", "inactive", "readonly", "read-auto", "clean", "broken", NULL }; + + int WaitClean(char *dev, int verbose) + { +@@ -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) + break; + rv = sysfs_wait(state_fd, &delay); + if (rv < 0 && errno != EINTR) +diff --git a/maps.c b/maps.c +index 02a047422fb2..49b7f2c2d274 100644 +--- a/maps.c ++++ b/maps.c +@@ -150,6 +150,7 @@ mapping_t sysfs_array_states[] = { + { "read-auto", ARRAY_READ_AUTO }, + { "clean", ARRAY_CLEAN }, + { "write-pending", ARRAY_WRITE_PENDING }, ++ { "broken", ARRAY_BROKEN }, + { NULL, ARRAY_UNKNOWN_STATE } + }; + +diff --git a/mdadm.h b/mdadm.h +index 387e681aa4ed..f8621e715df2 100644 +--- a/mdadm.h ++++ b/mdadm.h +@@ -345,6 +345,7 @@ struct mdinfo { + ARRAY_ACTIVE, + ARRAY_WRITE_PENDING, + ARRAY_ACTIVE_IDLE, ++ ARRAY_BROKEN, + ARRAY_UNKNOWN_STATE, + } array_state; + struct md_bb bb; +diff --git a/mdmon.h b/mdmon.h +index 818367cbb14c..b3d72ac37b67 100644 +--- a/mdmon.h ++++ b/mdmon.h +@@ -21,7 +21,7 @@ + extern const char Name[]; + + enum array_state { clear, inactive, suspended, readonly, read_auto, +- clean, active, write_pending, active_idle, bad_word}; ++ clean, active, write_pending, active_idle, broken, bad_word}; + + enum sync_action { idle, reshape, resync, recover, check, repair, bad_action }; + +diff --git a/monitor.c b/monitor.c +index 81537ed37300..e0d3be679daf 100644 +--- a/monitor.c ++++ b/monitor.c +@@ -26,7 +26,7 @@ + + static char *array_states[] = { + "clear", "inactive", "suspended", "readonly", "read-auto", +- "clean", "active", "write-pending", "active-idle", NULL }; ++ "clean", "active", "write-pending", "active-idle", "broken", NULL }; + static char *sync_actions[] = { + "idle", "reshape", "resync", "recover", "check", "repair", NULL + }; +@@ -476,7 +476,7 @@ static int read_and_act(struct active_array *a, fd_set *fds) + a->next_state = clean; + ret |= ARRAY_DIRTY; + } +- if (a->curr_state == clean) { ++ if ((a->curr_state == clean) || (a->curr_state == broken)) { + a->container->ss->set_array_state(a, 1); + } + if (a->curr_state == active || diff -Nru mdadm-4.1~rc1/debian/patches/series mdadm-4.1~rc1/debian/patches/series --- mdadm-4.1~rc1/debian/patches/series 2019-04-10 11:14:17.000000000 -0300 +++ mdadm-4.1~rc1/debian/patches/series 2020-01-14 16:10:38.000000000 -0300 @@ -31,3 +31,4 @@ mdmonitor-service-simplify.diff lp-1811228-imsm-Block-volume-creation-with-empty-name.patch lp-1811795-remove-external-arrays-and-devices.patch +lp1847924-Introduce-new-array-state-broken-for-raid0.patch