Merge ~paelzer/ubuntu/+source/mdadm:lp-1811795-1811228-bionic into ubuntu/+source/mdadm:ubuntu/bionic-devel

Proposed by Christian Ehrhardt 
Status: Merged
Approved by: Christian Ehrhardt 
Approved revision: 9232f122d61aba72fe59330589a55a4bdc5c4bea
Merged at revision: 9232f122d61aba72fe59330589a55a4bdc5c4bea
Proposed branch: ~paelzer/ubuntu/+source/mdadm:lp-1811795-1811228-bionic
Merge into: ubuntu/+source/mdadm:ubuntu/bionic-devel
Diff against target: 227 lines (+199/-0)
4 files modified
debian/changelog (+9/-0)
debian/patches/lp-1811228-imsm-Block-volume-creation-with-empty-name.patch (+50/-0)
debian/patches/lp-1811795-remove-external-arrays-and-devices.patch (+138/-0)
debian/patches/series (+2/-0)
Reviewer Review Type Date Requested Status
Andreas Hasenack Approve
Canonical Server Pending
Canonical Server packageset reviewers Pending
Review via email: mp+365794@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

PPA is available at: https://launchpad.net/~paelzer/+archive/ubuntu/bug-1811228-1811795-mdadm-imsm

Testing needs special IMSM HW which I don't have, lets check how active the reporters are in helping with that.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Same as https://code.launchpad.net/~paelzer/ubuntu/+source/mdadm/+git/mdadm/+merge/365795

- range-diff confirms only context changes in d/changelog and d/p/series
- sru template ok
- changelog entries ok
- sru version ok
- reporter confirmed that the build in ppa fixed the issue

+1

review: Approve
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Thanks for the review - I tagged, pushed and uploaded it now.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/debian/changelog b/debian/changelog
index d89dece..242e854 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
1mdadm (4.1~rc1-3~ubuntu18.04.2) bionic; urgency=medium
2
3 * d/p/lp-1811228-imsm-Block-volume-creation-with-empty-name.patch: avoid
4 creating whitespaced or empty names (LP: #1811228)
5 * d/p/lp-1811795-remove-external-arrays-and-devices.patch: fix removal of
6 failing disks with external metadata (LP: #1811795)
7
8 -- Christian Ehrhardt <christian.ehrhardt@canonical.com> Wed, 10 Apr 2019 16:14:17 +0200
9
1mdadm (4.1~rc1-3~ubuntu18.04.1) bionic; urgency=medium10mdadm (4.1~rc1-3~ubuntu18.04.1) bionic; urgency=medium
211
3 * No-change backport to bionic to enable Intel VROC support LP: #177968512 * No-change backport to bionic to enable Intel VROC support LP: #1779685
diff --git a/debian/patches/lp-1811228-imsm-Block-volume-creation-with-empty-name.patch b/debian/patches/lp-1811228-imsm-Block-volume-creation-with-empty-name.patch
4new file mode 10064413new file mode 100644
index 0000000..00fffd2
--- /dev/null
+++ b/debian/patches/lp-1811228-imsm-Block-volume-creation-with-empty-name.patch
@@ -0,0 +1,50 @@
1From 9bd99a90e110bd39beaa539cb44a70ee3264a270 Mon Sep 17 00:00:00 2001
2From: Roman Sobanski <roman.sobanski@intel.com>
3Date: Fri, 10 Aug 2018 14:20:35 +0200
4Subject: [PATCH] imsm: Block volume creation with empty name
5
6There is a possibility to create a RAID with empty name. Block it. Also
7remove trailing and leading whitespaces from given name.
8
9Signed-off-by: Roman Sobanski <roman.sobanski@intel.com>
10Signed-off-by: Jes Sorensen <jsorensen@fb.com>
11
12Origin: upstream, https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/commit/?id=9bd99a90e110bd39beaa539cb44a70ee3264a270
13Bug-Ubuntu: https://bugs.launchpad.net/bugs/1811228
14Last-Update: 2019-04-10
15
16---
17 super-intel.c | 14 +++++++++++++-
18 1 file changed, 13 insertions(+), 1 deletion(-)
19
20diff --git a/super-intel.c b/super-intel.c
21index f011a31f..d3d256a4 100644
22--- a/super-intel.c
23+++ b/super-intel.c
24@@ -5285,10 +5285,22 @@ static int check_name(struct intel_super *super, char *name, int quiet)
25 {
26 struct imsm_super *mpb = super->anchor;
27 char *reason = NULL;
28+ char *start = name;
29+ size_t len = strlen(name);
30 int i;
31
32- if (strlen(name) > MAX_RAID_SERIAL_LEN)
33+ if (len > 0) {
34+ while (isspace(start[len - 1]))
35+ start[--len] = 0;
36+ while (*start && isspace(*start))
37+ ++start, --len;
38+ memmove(name, start, len + 1);
39+ }
40+
41+ if (len > MAX_RAID_SERIAL_LEN)
42 reason = "must be 16 characters or less";
43+ else if (len == 0)
44+ reason = "must be a non-empty string";
45
46 for (i = 0; i < mpb->num_raid_devs; i++) {
47 struct imsm_dev *dev = get_imsm_dev(super, i);
48--
492.17.1
50
diff --git a/debian/patches/lp-1811795-remove-external-arrays-and-devices.patch b/debian/patches/lp-1811795-remove-external-arrays-and-devices.patch
0new file mode 10064451new file mode 100644
index 0000000..f7f15ab
--- /dev/null
+++ b/debian/patches/lp-1811795-remove-external-arrays-and-devices.patch
@@ -0,0 +1,138 @@
1From cb8f5371352f6c16af5aab8a40861e13aa50fc2b Mon Sep 17 00:00:00 2001
2From: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com>
3Date: Fri, 3 Aug 2018 09:41:50 +0200
4Subject: [PATCH] Incremental: remove external arrays and devices correctly
5
6Kernel returns EBUSY when device fail invokes array fail.
7In external metadata if kernel returns it, mdadm doesn't stop member
8arrays but it will try to stop container directly. It fails because
9container still has working arrays, so udev remove is triggered.
10
11Try to set faulty state on device in member arrays first. If kernel
12returns EBUSY, stop this array. After that remove the device from
13container.
14
15In external metadata mdmon has to remove faulty devices from degraded
16arrays, just remove device from container.
17
18Raid5 array doesn't return EBUSY, it allows to remove every device.
19Mdadm shouldn't block it.
20
21Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com>
22Signed-off-by: Jes Sorensen <jsorensen@fb.com>
23
24Origin: upstream, https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/commit/?id=cb8f5371352f6c16af5aab8a40861e13aa50fc2b
25Bug-Ubuntu: https://bugs.launchpad.net/bugs/1811795
26Last-Update: 2019-04-10
27
28---
29 Incremental.c | 78 ++++++++++++++++++++++++++++++++++-----------------
30 1 file changed, 52 insertions(+), 26 deletions(-)
31
32diff --git a/Incremental.c b/Incremental.c
33index 0c5698ee..a4ff7d4b 100644
34--- a/Incremental.c
35+++ b/Incremental.c
36@@ -1683,6 +1683,44 @@ static void run_udisks(char *arg1, char *arg2)
37 ;
38 }
39
40+static int force_remove(char *devnm, int fd, struct mdinfo *mdi, int verbose)
41+{
42+ int rv;
43+ int devid = devnm2devid(devnm);
44+
45+ run_udisks("--unmount", map_dev(major(devid), minor(devid), 0));
46+ rv = Manage_stop(devnm, fd, verbose, 1);
47+ if (rv) {
48+ /* At least we can try to trigger a 'remove' */
49+ sysfs_uevent(mdi, "remove");
50+ if (verbose)
51+ pr_err("Fail to stop %s too.\n", devnm);
52+ }
53+ return rv;
54+}
55+
56+static void remove_from_member_array(struct mdstat_ent *memb,
57+ struct mddev_dev *devlist, int verbose)
58+{
59+ int rv;
60+ struct mdinfo mmdi;
61+ int subfd = open_dev(memb->devnm);
62+
63+ if (subfd >= 0) {
64+ rv = Manage_subdevs(memb->devnm, subfd, devlist, verbose,
65+ 0, NULL, 0);
66+ if (rv & 2) {
67+ if (sysfs_init(&mmdi, -1, memb->devnm))
68+ pr_err("unable to initialize sysfs for: %s\n",
69+ memb->devnm);
70+ else
71+ force_remove(memb->devnm, subfd, &mmdi,
72+ verbose);
73+ }
74+ close(subfd);
75+ }
76+}
77+
78 /*
79 * IncrementalRemove - Attempt to see if the passed in device belongs to any
80 * raid arrays, and if so first fail (if needed) and then remove the device.
81@@ -1754,40 +1792,28 @@ int IncrementalRemove(char *devname, char *id_path, int verbose)
82 strncmp(ent->metadata_version, "external:", 9) == 0) {
83 struct mdstat_ent *mdstat = mdstat_read(0, 0);
84 struct mdstat_ent *memb;
85- for (memb = mdstat ; memb ; memb = memb->next)
86- if (is_container_member(memb, ent->devnm)) {
87- int subfd = open_dev(memb->devnm);
88- if (subfd >= 0) {
89- rv |= Manage_subdevs(
90- memb->devnm, subfd,
91- &devlist, verbose, 0,
92- NULL, 0);
93- close(subfd);
94- }
95- }
96+ for (memb = mdstat ; memb ; memb = memb->next) {
97+ if (is_container_member(memb, ent->devnm))
98+ remove_from_member_array(memb,
99+ &devlist, verbose);
100+ }
101 free_mdstat(mdstat);
102- } else
103+ } else {
104 rv |= Manage_subdevs(ent->devnm, mdfd, &devlist,
105 verbose, 0, NULL, 0);
106- if (rv & 2) {
107+ if (rv & 2) {
108 /* Failed due to EBUSY, try to stop the array.
109 * Give udisks a chance to unmount it first.
110 */
111- int devid = devnm2devid(ent->devnm);
112- run_udisks("--unmount", map_dev(major(devid),minor(devid), 0));
113- rv = Manage_stop(ent->devnm, mdfd, verbose, 1);
114- if (rv)
115- /* At least we can try to trigger a 'remove' */
116- sysfs_uevent(&mdi, "remove");
117- if (verbose) {
118- if (rv)
119- pr_err("Fail to stop %s too.\n", ent->devnm);
120+ rv = force_remove(ent->devnm, mdfd, &mdi, verbose);
121+ goto end;
122 }
123- } else {
124- devlist.disposition = 'r';
125- rv = Manage_subdevs(ent->devnm, mdfd, &devlist,
126- verbose, 0, NULL, 0);
127 }
128+
129+ devlist.disposition = 'r';
130+ rv = Manage_subdevs(ent->devnm, mdfd, &devlist,
131+ verbose, 0, NULL, 0);
132+end:
133 close(mdfd);
134 free_mdstat(ent);
135 return rv;
136--
1372.17.1
138
diff --git a/debian/patches/series b/debian/patches/series
index 50bb798..b49bfa6 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -29,3 +29,5 @@ debian-no-Werror.diff
29sha1-includes.diff29sha1-includes.diff
30readlink-path.patch30readlink-path.patch
31mdmonitor-service-simplify.diff31mdmonitor-service-simplify.diff
32lp-1811228-imsm-Block-volume-creation-with-empty-name.patch
33lp-1811795-remove-external-arrays-and-devices.patch

Subscribers

People subscribed via source and target branches