Accepting request 518296 from Base:System
- SLE15 continues to use mdadm-4.0, synchronize mdadm package from SLE12-SP3 to SLE15, re-order all patches. - Rename the following patches, they are deleted and re-add in next part of patches 0001-Generic-support-for-consistency-policy-and-PPL.patch 0002-Detail-show-consistency-policy.patch 0002-The-mdcheck-script-now-adds-messages-to-the-system.patch 0003-imsm-PPL-support.patch 0004-super1-PPL-support.patch 0005-Add-ppl-and-no-ppl-options-for-update.patch 0006-Grow-support-consistency-policy-change.patch 0007-udev-md-raid-assembly.rules-Skip-non-ready-devices.patch 0008-Retry-HOT_REMOVE_DISK-a-few-times.patch 0009-Introduce-sys_hot_remove_disk.patch 0010-Add-force-flag-to-hot_remove_disk.patch 0011-Detail-handle-non-existent-arrays-better.patch - Synchronize patches from mdadm of SLE12-SP3, the above renamed patches are re-add here, 0001-Makefile-Fix-date-to-be-output-in-ISO-format.patch 0002-imsm-fix-missing-error-message-during-migration.patch 0003-Fix-oddity-where-mdadm-did-not-recognise-a-relative-.patch 0004-mdadm-check-the-nodes-when-operate-clustered-array.patch 0005-examine-tidy-up-some-code.patch 0006-mdadm-add-man-page-for-symlinks.patch 0007-mdadm-add-checking-clustered-bitmap-in-assemble-mode.patch 0008-mdadm-Add-Wimplicit-fallthrough-0-in-Makefile.patch 0009-mdadm-Specify-enough-length-when-write-to-buffer.patch 0010-mdadm-it-doesn-t-make-sense-to-set-bitmap-twice.patch 0011-mdadm-Monitor-Fix-NULL-pointer-dereference-when-stat.patch 0012-Replace-snprintf-with-strncpy-at-some-places-to-avoi.patch (forwarded request 517978 from colyli) OBS-URL: https://build.opensuse.org/request/show/518296 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/mdadm?expand=0&rev=109
This commit is contained in:
commit
bfd470267f
30
0001-Makefile-Fix-date-to-be-output-in-ISO-format.patch
Normal file
30
0001-Makefile-Fix-date-to-be-output-in-ISO-format.patch
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
From 53835cf50023aaad6887b647a3aaab524bd9b39e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
|
Date: Tue, 10 Jan 2017 18:51:40 -0500
|
||||||
|
Subject: [PATCH] Makefile: Fix date to be output in ISO format
|
||||||
|
|
||||||
|
Updated the static version in the release, but forgot to fix the
|
||||||
|
Makefile generated version when extracting from git
|
||||||
|
|
||||||
|
Reported-by: NeilBrown <neilb@suse.com>
|
||||||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
|
---
|
||||||
|
Makefile | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/Makefile b/Makefile
|
||||||
|
index 5fd7f16..a6f464c 100644
|
||||||
|
--- a/Makefile
|
||||||
|
+++ b/Makefile
|
||||||
|
@@ -89,7 +89,7 @@ DIRFLAGS += -DFAILED_SLOTS_DIR=\"$(FAILED_SLOTS_DIR)\"
|
||||||
|
CFLAGS = $(CWFLAGS) $(CXFLAGS) -DSendmail=\""$(MAILCMD)"\" $(CONFFILEFLAGS) $(DIRFLAGS) $(COROSYNC) $(DLM)
|
||||||
|
|
||||||
|
VERSION = $(shell [ -d .git ] && git describe HEAD | sed 's/mdadm-//')
|
||||||
|
-VERS_DATE = $(shell [ -d .git ] && date --date="`git log -n1 --format=format:%cd --date=short`" '+%0dth %B %Y' | sed -e 's/1th/1st/' -e 's/2th/2nd/' -e 's/11st/11th/' -e 's/12nd/12th/')
|
||||||
|
+VERS_DATE = $(shell [ -d .git ] && date --iso-8601 --date="`git log -n1 --format=format:%cd --date=iso --date=short`")
|
||||||
|
DVERS = $(if $(VERSION),-DVERSION=\"$(VERSION)\",)
|
||||||
|
DDATE = $(if $(VERS_DATE),-DVERS_DATE="\"$(VERS_DATE)\"",)
|
||||||
|
CFLAGS += $(DVERS) $(DDATE)
|
||||||
|
--
|
||||||
|
2.10.2
|
||||||
|
|
34
0002-imsm-fix-missing-error-message-during-migration.patch
Normal file
34
0002-imsm-fix-missing-error-message-during-migration.patch
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
From 565cc99e341b3021ad26ff6da19a67d4e4abffde Mon Sep 17 00:00:00 2001
|
||||||
|
From: Pawel Baldysiak <pawel.baldysiak@intel.com>
|
||||||
|
Date: Tue, 24 Jan 2017 14:29:33 +0100
|
||||||
|
Subject: [PATCH] imsm: fix missing error message during migration
|
||||||
|
|
||||||
|
If user tries to migrate from raid0 to raid5 and there is no spare
|
||||||
|
drive to perform it - mdadm will exit with errorcode, but
|
||||||
|
no error message is printed.
|
||||||
|
|
||||||
|
Print error instead of debug message when this condition occurs,
|
||||||
|
so user is informed why requested migration is not started.
|
||||||
|
|
||||||
|
Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
|
||||||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
|
---
|
||||||
|
super-intel.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/super-intel.c b/super-intel.c
|
||||||
|
index 433bb6d..d5e9517 100644
|
||||||
|
--- a/super-intel.c
|
||||||
|
+++ b/super-intel.c
|
||||||
|
@@ -10718,7 +10718,7 @@ static int imsm_create_metadata_update_for_migration(
|
||||||
|
free(u);
|
||||||
|
sysfs_free(spares);
|
||||||
|
update_memory_size = 0;
|
||||||
|
- dprintf("error: cannot get spare device for requested migration");
|
||||||
|
+ pr_err("cannot get spare device for requested migration\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
sysfs_free(spares);
|
||||||
|
--
|
||||||
|
2.10.2
|
||||||
|
|
@ -0,0 +1,43 @@
|
|||||||
|
From bb6f40bf9c458a13b1a780006733c034105e6d36 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Wol <anthony@youngman.org.uk>
|
||||||
|
Date: Tue, 17 Jan 2017 17:47:05 +0000
|
||||||
|
Subject: [PATCH] Fix oddity where mdadm did not recognise a relative path
|
||||||
|
|
||||||
|
mdadm assumed that a pathname started with a "/", while an array
|
||||||
|
name didn't. This alters the logic so that if the first character
|
||||||
|
is not a "/" it tries to open an array, and if that fails it drops
|
||||||
|
through to the pathname code rather than terminating immediately
|
||||||
|
with an error.
|
||||||
|
|
||||||
|
Signed-off-by: Wol <anthony@youngman.org.uk>
|
||||||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
|
---
|
||||||
|
mdadm.c | 12 ++++++------
|
||||||
|
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/mdadm.c b/mdadm.c
|
||||||
|
index c3a265b..b5d89e4 100644
|
||||||
|
--- a/mdadm.c
|
||||||
|
+++ b/mdadm.c
|
||||||
|
@@ -1899,12 +1899,12 @@ static int misc_list(struct mddev_dev *devlist,
|
||||||
|
rv |= SetAction(dv->devname, c->action);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
- if (dv->devname[0] == '/')
|
||||||
|
- mdfd = open_mddev(dv->devname, 1);
|
||||||
|
- else {
|
||||||
|
- mdfd = open_dev(dv->devname);
|
||||||
|
- if (mdfd < 0)
|
||||||
|
- pr_err("Cannot open %s\n", dv->devname);
|
||||||
|
+ switch(dv->devname[0] == '/') {
|
||||||
|
+ case 0:
|
||||||
|
+ mdfd = open_dev(dv->devname);
|
||||||
|
+ if (mdfd >= 0) break;
|
||||||
|
+ case 1:
|
||||||
|
+ mdfd = open_mddev(dv->devname, 1);
|
||||||
|
}
|
||||||
|
if (mdfd>=0) {
|
||||||
|
switch(dv->disposition) {
|
||||||
|
--
|
||||||
|
2.10.2
|
||||||
|
|
@ -0,0 +1,54 @@
|
|||||||
|
From 9d67f6496c71efbc68b33aea663dbcc1597a0828 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Zhilong Liu <zlliu@suse.com>
|
||||||
|
Date: Wed, 1 Mar 2017 18:42:33 +0800
|
||||||
|
Subject: [PATCH] mdadm:check the nodes when operate clustered array
|
||||||
|
|
||||||
|
It doesn't make sense to write_bitmap with less than 2 nodes,
|
||||||
|
in order to avoid 'write_bitmap' received invalid nodes number,
|
||||||
|
it would be better to do checking nodes in getopt operations.
|
||||||
|
|
||||||
|
Signed-off-by: Zhilong Liu <zlliu@suse.com>
|
||||||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
|
---
|
||||||
|
mdadm.c | 4 ++--
|
||||||
|
super1.c | 9 +--------
|
||||||
|
2 files changed, 3 insertions(+), 10 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/mdadm.c b/mdadm.c
|
||||||
|
index 16fd49a..b5ac061 100644
|
||||||
|
--- a/mdadm.c
|
||||||
|
+++ b/mdadm.c
|
||||||
|
@@ -603,8 +603,8 @@ int main(int argc, char *argv[])
|
||||||
|
case O(GROW, Nodes):
|
||||||
|
case O(CREATE, Nodes):
|
||||||
|
c.nodes = parse_num(optarg);
|
||||||
|
- if (c.nodes <= 0) {
|
||||||
|
- pr_err("invalid number for the number of cluster nodes: %s\n",
|
||||||
|
+ if (c.nodes < 2) {
|
||||||
|
+ pr_err("clustered array needs two nodes at least: %s\n",
|
||||||
|
optarg);
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
diff --git a/super1.c b/super1.c
|
||||||
|
index 87a74cb..882cd61 100644
|
||||||
|
--- a/super1.c
|
||||||
|
+++ b/super1.c
|
||||||
|
@@ -2380,14 +2380,7 @@ static int write_bitmap1(struct supertype *st, int fd, enum bitmap_update update
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bms->version == BITMAP_MAJOR_CLUSTERED) {
|
||||||
|
- if (st->nodes == 1) {
|
||||||
|
- /* the parameter for nodes is not valid */
|
||||||
|
- pr_err("Warning: cluster-md at least needs two nodes\n");
|
||||||
|
- return -EINVAL;
|
||||||
|
- } else if (st->nodes == 0)
|
||||||
|
- /* --nodes is not specified */
|
||||||
|
- break;
|
||||||
|
- else if (__cpu_to_le32(st->nodes) < bms->nodes) {
|
||||||
|
+ if (__cpu_to_le32(st->nodes) < bms->nodes) {
|
||||||
|
/* Since the nodes num is not increased, no need to check the space
|
||||||
|
* is enough or not, just update bms->nodes */
|
||||||
|
bms->nodes = __cpu_to_le32(st->nodes);
|
||||||
|
--
|
||||||
|
2.10.2
|
||||||
|
|
146
0005-examine-tidy-up-some-code.patch
Normal file
146
0005-examine-tidy-up-some-code.patch
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
From 36352fc95778677f0319f677ea079c49f7bbe9d0 Mon Sep 17 00:00:00 2001
|
||||||
|
From: NeilBrown <neilb@suse.com>
|
||||||
|
Date: Fri, 3 Mar 2017 10:57:00 +1100
|
||||||
|
Subject: [PATCH] examine: tidy up some code.
|
||||||
|
|
||||||
|
Michael Shigorin reports that the 'lcc' compiler isn't able
|
||||||
|
to deduce that 'st' must be initialized in
|
||||||
|
|
||||||
|
if (c->SparcAdjust)
|
||||||
|
st->ss->update_super(st, NULL, "sparc2.2",
|
||||||
|
|
||||||
|
just because the only times it isn't initialised, 'err' is set non-zero.
|
||||||
|
|
||||||
|
This results in a 'possibly uninitialised' warning.
|
||||||
|
While there is no bug in the code, this does suggest that maybe
|
||||||
|
the code could be made more obviously correct.
|
||||||
|
|
||||||
|
So this patch:
|
||||||
|
1/ moves the "err" variable inside the for loop, so an error in
|
||||||
|
one device doesn't stop the other devices from being processed
|
||||||
|
2/ calls 'continue' early if the device cannot be opened, so that
|
||||||
|
a level of indent can be removed, and so that it is clear that
|
||||||
|
'st' is always initialised before being used
|
||||||
|
3/ frees 'st' if an error occured in load_super or load_container.
|
||||||
|
|
||||||
|
Reported-by: Michael Shigorin <mike@altlinux.org>
|
||||||
|
Signed-off-by: NeilBrown <neilb@suse.com>
|
||||||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
|
---
|
||||||
|
Examine.c | 75 +++++++++++++++++++++++++++++++++------------------------------
|
||||||
|
1 file changed, 39 insertions(+), 36 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/Examine.c b/Examine.c
|
||||||
|
index 953b8ee..7013480 100644
|
||||||
|
--- a/Examine.c
|
||||||
|
+++ b/Examine.c
|
||||||
|
@@ -53,7 +53,6 @@ int Examine(struct mddev_dev *devlist,
|
||||||
|
*/
|
||||||
|
int fd;
|
||||||
|
int rv = 0;
|
||||||
|
- int err = 0;
|
||||||
|
|
||||||
|
struct array {
|
||||||
|
struct supertype *st;
|
||||||
|
@@ -66,6 +65,8 @@ int Examine(struct mddev_dev *devlist,
|
||||||
|
for (; devlist ; devlist = devlist->next) {
|
||||||
|
struct supertype *st;
|
||||||
|
int have_container = 0;
|
||||||
|
+ int err = 0;
|
||||||
|
+ int container = 0;
|
||||||
|
|
||||||
|
fd = dev_open(devlist->devname, O_RDONLY);
|
||||||
|
if (fd < 0) {
|
||||||
|
@@ -74,44 +75,46 @@ int Examine(struct mddev_dev *devlist,
|
||||||
|
devlist->devname, strerror(errno));
|
||||||
|
rv = 1;
|
||||||
|
}
|
||||||
|
- err = 1;
|
||||||
|
+ continue;
|
||||||
|
}
|
||||||
|
- else {
|
||||||
|
- int container = 0;
|
||||||
|
- if (forcest)
|
||||||
|
- st = dup_super(forcest);
|
||||||
|
- else if (must_be_container(fd)) {
|
||||||
|
- /* might be a container */
|
||||||
|
- st = super_by_fd(fd, NULL);
|
||||||
|
- container = 1;
|
||||||
|
- } else
|
||||||
|
- st = guess_super(fd);
|
||||||
|
- if (st) {
|
||||||
|
- err = 1;
|
||||||
|
- st->ignore_hw_compat = 1;
|
||||||
|
- if (!container)
|
||||||
|
- err = st->ss->load_super(st, fd,
|
||||||
|
- (c->brief||c->scan) ? NULL
|
||||||
|
- :devlist->devname);
|
||||||
|
- if (err && st->ss->load_container) {
|
||||||
|
- err = st->ss->load_container(st, fd,
|
||||||
|
- (c->brief||c->scan) ? NULL
|
||||||
|
- :devlist->devname);
|
||||||
|
- if (!err)
|
||||||
|
- have_container = 1;
|
||||||
|
- }
|
||||||
|
- st->ignore_hw_compat = 0;
|
||||||
|
- } else {
|
||||||
|
- if (!c->brief) {
|
||||||
|
- pr_err("No md superblock detected on %s.\n", devlist->devname);
|
||||||
|
- rv = 1;
|
||||||
|
- }
|
||||||
|
- err = 1;
|
||||||
|
+
|
||||||
|
+ if (forcest)
|
||||||
|
+ st = dup_super(forcest);
|
||||||
|
+ else if (must_be_container(fd)) {
|
||||||
|
+ /* might be a container */
|
||||||
|
+ st = super_by_fd(fd, NULL);
|
||||||
|
+ container = 1;
|
||||||
|
+ } else
|
||||||
|
+ st = guess_super(fd);
|
||||||
|
+ if (st) {
|
||||||
|
+ err = 1;
|
||||||
|
+ st->ignore_hw_compat = 1;
|
||||||
|
+ if (!container)
|
||||||
|
+ err = st->ss->load_super(st, fd,
|
||||||
|
+ (c->brief||c->scan) ? NULL
|
||||||
|
+ :devlist->devname);
|
||||||
|
+ if (err && st->ss->load_container) {
|
||||||
|
+ err = st->ss->load_container(st, fd,
|
||||||
|
+ (c->brief||c->scan) ? NULL
|
||||||
|
+ :devlist->devname);
|
||||||
|
+ if (!err)
|
||||||
|
+ have_container = 1;
|
||||||
|
}
|
||||||
|
- close(fd);
|
||||||
|
+ st->ignore_hw_compat = 0;
|
||||||
|
+ } else {
|
||||||
|
+ if (!c->brief) {
|
||||||
|
+ pr_err("No md superblock detected on %s.\n", devlist->devname);
|
||||||
|
+ rv = 1;
|
||||||
|
+ }
|
||||||
|
+ err = 1;
|
||||||
|
}
|
||||||
|
- if (err)
|
||||||
|
+ close(fd);
|
||||||
|
+
|
||||||
|
+ if (err) {
|
||||||
|
+ if (st)
|
||||||
|
+ st->ss->free_super(st);
|
||||||
|
continue;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
if (c->SparcAdjust)
|
||||||
|
st->ss->update_super(st, NULL, "sparc2.2",
|
||||||
|
@@ -121,7 +124,7 @@ int Examine(struct mddev_dev *devlist,
|
||||||
|
if (c->brief && st->ss->brief_examine_super == NULL) {
|
||||||
|
if (!c->scan)
|
||||||
|
pr_err("No brief listing for %s on %s\n",
|
||||||
|
- st->ss->name, devlist->devname);
|
||||||
|
+ st->ss->name, devlist->devname);
|
||||||
|
} else if (c->brief) {
|
||||||
|
struct array *ap;
|
||||||
|
char *d;
|
||||||
|
--
|
||||||
|
2.10.2
|
||||||
|
|
49
0006-mdadm-add-man-page-for-symlinks.patch
Normal file
49
0006-mdadm-add-man-page-for-symlinks.patch
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
From d64c2283633cd4d7569690d1df8d1a10f3b6b040 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Zhilong Liu <zlliu@suse.com>
|
||||||
|
Date: Mon, 6 Mar 2017 10:39:57 +0800
|
||||||
|
Subject: [PATCH] mdadm:add man page for --symlinks
|
||||||
|
|
||||||
|
In build and create mode:
|
||||||
|
--symlinks
|
||||||
|
Auto creation of symlinks in /dev to /dev/md, option --symlinks
|
||||||
|
must be 'no' or 'yes' and work with --create and --build.
|
||||||
|
In assemble mode:
|
||||||
|
--symlinks
|
||||||
|
See this option under Create and Build options.
|
||||||
|
|
||||||
|
Signed-off-by: Zhilong Liu <zlliu@suse.com>
|
||||||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
|
---
|
||||||
|
mdadm.8.in | 9 +++++++++
|
||||||
|
1 file changed, 9 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/mdadm.8.in b/mdadm.8.in
|
||||||
|
index 1e4f91d..df1d460 100644
|
||||||
|
--- a/mdadm.8.in
|
||||||
|
+++ b/mdadm.8.in
|
||||||
|
@@ -1015,6 +1015,11 @@ simultaneously. If not specified, this defaults to 4.
|
||||||
|
Specify journal device for the RAID-4/5/6 array. The journal device
|
||||||
|
should be a SSD with reasonable lifetime.
|
||||||
|
|
||||||
|
+.TP
|
||||||
|
+.BR \-\-symlinks
|
||||||
|
+Auto creation of symlinks in /dev to /dev/md, option --symlinks must
|
||||||
|
+be 'no' or 'yes' and work with --create and --build.
|
||||||
|
+
|
||||||
|
|
||||||
|
.SH For assemble:
|
||||||
|
|
||||||
|
@@ -1291,6 +1296,10 @@ Reshape can be continued later using the
|
||||||
|
.B \-\-continue
|
||||||
|
option for the grow command.
|
||||||
|
|
||||||
|
+.TP
|
||||||
|
+.BR \-\-symlinks
|
||||||
|
+See this option under Create and Build options.
|
||||||
|
+
|
||||||
|
.SH For Manage mode:
|
||||||
|
|
||||||
|
.TP
|
||||||
|
--
|
||||||
|
2.10.2
|
||||||
|
|
@ -0,0 +1,35 @@
|
|||||||
|
From 72b616aff26e64079727ea908073027c08f99c07 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Zhilong Liu <zlliu@suse.com>
|
||||||
|
Date: Tue, 7 Mar 2017 11:13:03 +0800
|
||||||
|
Subject: [PATCH] mdadm:add checking clustered bitmap in assemble mode
|
||||||
|
|
||||||
|
mdadm:Both clustered and internal array don't need
|
||||||
|
to specify --bitmap when assembling array.
|
||||||
|
|
||||||
|
Signed-off-by: Zhilong Liu <zlliu@suse.com>
|
||||||
|
Acked-by: Coly Li <colyli@suse.de>
|
||||||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
|
---
|
||||||
|
mdadm.c | 6 ++++--
|
||||||
|
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/mdadm.c b/mdadm.c
|
||||||
|
index b5ac061..d6ad8dc 100644
|
||||||
|
--- a/mdadm.c
|
||||||
|
+++ b/mdadm.c
|
||||||
|
@@ -1095,8 +1095,10 @@ int main(int argc, char *argv[])
|
||||||
|
pr_err("bitmap file needed with -b in --assemble mode\n");
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
- if (strcmp(optarg, "internal") == 0) {
|
||||||
|
- pr_err("there is no need to specify --bitmap when assembling arrays with internal bitmaps\n");
|
||||||
|
+ if (strcmp(optarg, "internal") == 0 ||
|
||||||
|
+ strcmp(optarg, "clustered") == 0) {
|
||||||
|
+ pr_err("no need to specify --bitmap when assembling"
|
||||||
|
+ " arrays with internal or clustered bitmap\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
bitmap_fd = open(optarg, O_RDWR);
|
||||||
|
--
|
||||||
|
2.10.2
|
||||||
|
|
36
0008-mdadm-Add-Wimplicit-fallthrough-0-in-Makefile.patch
Normal file
36
0008-mdadm-Add-Wimplicit-fallthrough-0-in-Makefile.patch
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
From 8268821b434d1308d083454fb681d80176cf352b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Xiao Ni <xni@redhat.com>
|
||||||
|
Date: Fri, 17 Mar 2017 19:55:42 +0800
|
||||||
|
Subject: [PATCH] mdadm: Add Wimplicit-fallthrough=0 in Makefile
|
||||||
|
|
||||||
|
There are many errors like 'error: this statement may fall through'.
|
||||||
|
But the logic is right. So add the flag Wimplicit-fallthrough=0
|
||||||
|
to disable the error messages. The method I use is from
|
||||||
|
https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
|
||||||
|
#index-Wimplicit-fallthrough-375
|
||||||
|
|
||||||
|
Signed-off-by: Xiao Ni <xni@redhat.com>
|
||||||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
|
---
|
||||||
|
Makefile | 5 +++++
|
||||||
|
1 file changed, 5 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/Makefile b/Makefile
|
||||||
|
index a6f464c..d1a6ac4 100644
|
||||||
|
--- a/Makefile
|
||||||
|
+++ b/Makefile
|
||||||
|
@@ -48,6 +48,11 @@ ifdef WARN_UNUSED
|
||||||
|
CWFLAGS += -Wp,-D_FORTIFY_SOURCE=2 -O3
|
||||||
|
endif
|
||||||
|
|
||||||
|
+FALLTHROUGH := $(shell gcc -v --help 2>&1 | grep "implicit-fallthrough" | wc -l)
|
||||||
|
+ifneq "$(FALLTHROUGH)" "0"
|
||||||
|
+CWFLAGS += -Wimplicit-fallthrough=0
|
||||||
|
+endif
|
||||||
|
+
|
||||||
|
ifdef DEBIAN
|
||||||
|
CPPFLAGS += -DDEBIAN
|
||||||
|
endif
|
||||||
|
--
|
||||||
|
2.10.2
|
||||||
|
|
74
0009-mdadm-Specify-enough-length-when-write-to-buffer.patch
Normal file
74
0009-mdadm-Specify-enough-length-when-write-to-buffer.patch
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
From ff9239ee3177630d62c7a58408992af7a779763c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Xiao Ni <xni@redhat.com>
|
||||||
|
Date: Fri, 17 Mar 2017 19:55:43 +0800
|
||||||
|
Subject: [PATCH] mdadm: Specify enough length when write to buffer
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
In Detail.c the buffer path in function Detail is defined as path[200],
|
||||||
|
in fact the max lenth of content which needs to write to the buffer is
|
||||||
|
287. Because the length of dname of struct dirent is 255.
|
||||||
|
During building it reports error:
|
||||||
|
error: ‘%s’ directive writing up to 255 bytes into a region of size 189
|
||||||
|
[-Werror=format-overflow=]
|
||||||
|
|
||||||
|
In function examine_super0 there is a buffer nb with length 5.
|
||||||
|
But it need to show a int type argument. The lenght of max
|
||||||
|
number of int is 10. So the buffer length should be 11.
|
||||||
|
|
||||||
|
In human_size function the length of buf is 30. During building
|
||||||
|
there is a error:
|
||||||
|
output between 20 and 47 bytes into a destination of size 30.
|
||||||
|
Change the length to 47.
|
||||||
|
|
||||||
|
Signed-off-by: Xiao Ni <xni@redhat.com>
|
||||||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
|
---
|
||||||
|
Detail.c | 2 +-
|
||||||
|
super0.c | 2 +-
|
||||||
|
util.c | 2 +-
|
||||||
|
3 files changed, 3 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/Detail.c b/Detail.c
|
||||||
|
index 509b0d4..cb33794 100644
|
||||||
|
--- a/Detail.c
|
||||||
|
+++ b/Detail.c
|
||||||
|
@@ -575,7 +575,7 @@ This is pretty boring
|
||||||
|
printf(" Member Arrays :");
|
||||||
|
|
||||||
|
while (dir && (de = readdir(dir)) != NULL) {
|
||||||
|
- char path[200];
|
||||||
|
+ char path[287];
|
||||||
|
char vbuf[1024];
|
||||||
|
int nlen = strlen(sra->sys_name);
|
||||||
|
dev_t devid;
|
||||||
|
diff --git a/super0.c b/super0.c
|
||||||
|
index 938cfd9..f5b4507 100644
|
||||||
|
--- a/super0.c
|
||||||
|
+++ b/super0.c
|
||||||
|
@@ -231,7 +231,7 @@ static void examine_super0(struct supertype *st, char *homehost)
|
||||||
|
d++) {
|
||||||
|
mdp_disk_t *dp;
|
||||||
|
char *dv;
|
||||||
|
- char nb[5];
|
||||||
|
+ char nb[11];
|
||||||
|
int wonly, failfast;
|
||||||
|
if (d>=0) dp = &sb->disks[d];
|
||||||
|
else dp = &sb->this_disk;
|
||||||
|
diff --git a/util.c b/util.c
|
||||||
|
index f100972..32bd909 100644
|
||||||
|
--- a/util.c
|
||||||
|
+++ b/util.c
|
||||||
|
@@ -811,7 +811,7 @@ unsigned long calc_csum(void *super, int bytes)
|
||||||
|
#ifndef MDASSEMBLE
|
||||||
|
char *human_size(long long bytes)
|
||||||
|
{
|
||||||
|
- static char buf[30];
|
||||||
|
+ static char buf[47];
|
||||||
|
|
||||||
|
/* We convert bytes to either centi-M{ega,ibi}bytes or
|
||||||
|
* centi-G{igi,ibi}bytes, with appropriate rounding,
|
||||||
|
--
|
||||||
|
2.10.2
|
||||||
|
|
31
0010-mdadm-it-doesn-t-make-sense-to-set-bitmap-twice.patch
Normal file
31
0010-mdadm-it-doesn-t-make-sense-to-set-bitmap-twice.patch
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
From 27c48b375d8fb6b4835fd9b11593c75d247ea1c1 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Zhilong Liu <zlliu@suse.com>
|
||||||
|
Date: Mon, 20 Mar 2017 13:21:03 +0800
|
||||||
|
Subject: [PATCH] mdadm:it doesn't make sense to set --bitmap twice
|
||||||
|
|
||||||
|
mdadm.c: it doesn't make sense to set --bitmap twice.
|
||||||
|
|
||||||
|
Signed-off-by: Zhilong Liu <zlliu@suse.com>
|
||||||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
|
---
|
||||||
|
mdadm.c | 4 ++++
|
||||||
|
1 file changed, 4 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/mdadm.c b/mdadm.c
|
||||||
|
index d6ad8dc..08ddcab 100644
|
||||||
|
--- a/mdadm.c
|
||||||
|
+++ b/mdadm.c
|
||||||
|
@@ -1139,6 +1139,10 @@ int main(int argc, char *argv[])
|
||||||
|
case O(CREATE,Bitmap): /* here we create the bitmap */
|
||||||
|
case O(GROW,'b'):
|
||||||
|
case O(GROW,Bitmap):
|
||||||
|
+ if (s.bitmap_file) {
|
||||||
|
+ pr_err("bitmap cannot be set twice. Second value: %s.\n", optarg);
|
||||||
|
+ exit(2);
|
||||||
|
+ }
|
||||||
|
if (strcmp(optarg, "internal") == 0 ||
|
||||||
|
strcmp(optarg, "none") == 0 ||
|
||||||
|
strchr(optarg, '/') != NULL) {
|
||||||
|
--
|
||||||
|
2.10.2
|
||||||
|
|
@ -0,0 +1,47 @@
|
|||||||
|
From 75dd32a185871fead13cd3586e00980b35410ff0 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Zhilong Liu <zlliu@suse.com>
|
||||||
|
Date: Mon, 20 Mar 2017 13:21:41 +0800
|
||||||
|
Subject: [PATCH] mdadm/Monitor: Fix NULL pointer dereference when stat2devnm
|
||||||
|
return NULL
|
||||||
|
|
||||||
|
Wait(): stat2devnm() returns NULL for non block devices. Check the
|
||||||
|
pointer is valid derefencing it. This can happen when using --wait,
|
||||||
|
such as the 'f' and 'd' file type, causing a core dump.
|
||||||
|
such as: ./mdadm --wait /dev/md/
|
||||||
|
|
||||||
|
Reviewed-by: NeilBrown <neilb@suse.com>
|
||||||
|
Signed-off-by: Zhilong Liu <zlliu@suse.com>
|
||||||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
|
---
|
||||||
|
Monitor.c | 8 +++++++-
|
||||||
|
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/Monitor.c b/Monitor.c
|
||||||
|
index 802a9d9..bdd3e63 100644
|
||||||
|
--- a/Monitor.c
|
||||||
|
+++ b/Monitor.c
|
||||||
|
@@ -994,6 +994,7 @@ int Wait(char *dev)
|
||||||
|
{
|
||||||
|
struct stat stb;
|
||||||
|
char devnm[32];
|
||||||
|
+ char *tmp;
|
||||||
|
int rv = 1;
|
||||||
|
int frozen_remaining = 3;
|
||||||
|
|
||||||
|
@@ -1002,7 +1003,12 @@ int Wait(char *dev)
|
||||||
|
strerror(errno));
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
- strcpy(devnm, stat2devnm(&stb));
|
||||||
|
+ tmp = stat2devnm(&stb);
|
||||||
|
+ if (!tmp) {
|
||||||
|
+ pr_err("%s is not a block device.\n", dev);
|
||||||
|
+ return 2;
|
||||||
|
+ }
|
||||||
|
+ strcpy(devnm, tmp);
|
||||||
|
|
||||||
|
while(1) {
|
||||||
|
struct mdstat_ent *ms = mdstat_read(1, 0);
|
||||||
|
--
|
||||||
|
2.10.2
|
||||||
|
|
@ -0,0 +1,58 @@
|
|||||||
|
From 618f4e6d63c8c09d8d4002770e44617f3477f137 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Xiao Ni <xni@redhat.com>
|
||||||
|
Date: Sat, 18 Mar 2017 10:33:44 +0800
|
||||||
|
Subject: [PATCH] Replace snprintf with strncpy at some places to avoid
|
||||||
|
truncation
|
||||||
|
|
||||||
|
In gcc7 there are some building errors like:
|
||||||
|
directive output may be truncated writing up to 31 bytes into a region of size 24
|
||||||
|
snprintf(str, MPB_SIG_LEN, %s, mpb->sig);
|
||||||
|
|
||||||
|
It just need to copy one string to target. So use strncpy to replace it.
|
||||||
|
|
||||||
|
For this line code: snprintf(str, MPB_SIG_LEN, %s, mpb->sig);
|
||||||
|
Because mpb->sig has the content of version after magic, so
|
||||||
|
it's better to use strncpy to replace snprintf too.
|
||||||
|
|
||||||
|
Signed-off-by: Xiao Ni <xni@redhat.com>
|
||||||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
|
---
|
||||||
|
super-intel.c | 9 ++++++---
|
||||||
|
1 file changed, 6 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/super-intel.c b/super-intel.c
|
||||||
|
index d5e9517..343f20d 100644
|
||||||
|
--- a/super-intel.c
|
||||||
|
+++ b/super-intel.c
|
||||||
|
@@ -1811,7 +1811,8 @@ static void examine_super_imsm(struct supertype *st, char *homehost)
|
||||||
|
__u32 reserved = imsm_reserved_sectors(super, super->disks);
|
||||||
|
struct dl *dl;
|
||||||
|
|
||||||
|
- snprintf(str, MPB_SIG_LEN, "%s", mpb->sig);
|
||||||
|
+ strncpy(str, (char *)mpb->sig, MPB_SIG_LEN);
|
||||||
|
+ str[MPB_SIG_LEN-1] = '\0';
|
||||||
|
printf(" Magic : %s\n", str);
|
||||||
|
snprintf(str, strlen(MPB_VERSION_RAID0), "%s", get_imsm_version(mpb));
|
||||||
|
printf(" Version : %s\n", get_imsm_version(mpb));
|
||||||
|
@@ -7142,14 +7143,16 @@ static int update_subarray_imsm(struct supertype *st, char *subarray,
|
||||||
|
|
||||||
|
u->type = update_rename_array;
|
||||||
|
u->dev_idx = vol;
|
||||||
|
- snprintf((char *) u->name, MAX_RAID_SERIAL_LEN, "%s", name);
|
||||||
|
+ strncpy((char *) u->name, name, MAX_RAID_SERIAL_LEN);
|
||||||
|
+ u->name[MAX_RAID_SERIAL_LEN-1] = '\0';
|
||||||
|
append_metadata_update(st, u, sizeof(*u));
|
||||||
|
} else {
|
||||||
|
struct imsm_dev *dev;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
dev = get_imsm_dev(super, vol);
|
||||||
|
- snprintf((char *) dev->volume, MAX_RAID_SERIAL_LEN, "%s", name);
|
||||||
|
+ strncpy((char *) dev->volume, name, MAX_RAID_SERIAL_LEN);
|
||||||
|
+ dev->volume[MAX_RAID_SERIAL_LEN-1] = '\0';
|
||||||
|
for (i = 0; i < mpb->num_raid_devs; i++) {
|
||||||
|
dev = get_imsm_dev(super, i);
|
||||||
|
handle_missing(super, dev);
|
||||||
|
--
|
||||||
|
2.10.2
|
||||||
|
|
32
0013-mdadm-Forced-type-conversion-to-avoid-truncation.patch
Normal file
32
0013-mdadm-Forced-type-conversion-to-avoid-truncation.patch
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
From 5b97512954e9710fd45ab5778bf679205c35892d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Xiao Ni <xni@redhat.com>
|
||||||
|
Date: Sat, 18 Mar 2017 10:33:45 +0800
|
||||||
|
Subject: [PATCH] mdadm: Forced type conversion to avoid truncation
|
||||||
|
|
||||||
|
Gcc reports it needs 19 bytes to right to disk->serial. Because the
|
||||||
|
type of argument i is int. But the meaning of i is failed disk
|
||||||
|
number. So it doesn't need to use 19 bytes. Just add a type
|
||||||
|
conversion to avoid this building error
|
||||||
|
|
||||||
|
Signed-off-by: Xiao Ni <xni@redhat.com>
|
||||||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
|
---
|
||||||
|
super-intel.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/super-intel.c b/super-intel.c
|
||||||
|
index 343f20d..e1618f1 100644
|
||||||
|
--- a/super-intel.c
|
||||||
|
+++ b/super-intel.c
|
||||||
|
@@ -5228,7 +5228,7 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info,
|
||||||
|
disk->status = CONFIGURED_DISK | FAILED_DISK;
|
||||||
|
disk->scsi_id = __cpu_to_le32(~(__u32)0);
|
||||||
|
snprintf((char *) disk->serial, MAX_RAID_SERIAL_LEN,
|
||||||
|
- "missing:%d", i);
|
||||||
|
+ "missing:%d", (__u8)i);
|
||||||
|
}
|
||||||
|
find_missing(super);
|
||||||
|
} else {
|
||||||
|
--
|
||||||
|
2.10.2
|
||||||
|
|
@ -0,0 +1,47 @@
|
|||||||
|
From e23c2663da73f905aa5fa9800feda3d08a8026ee Mon Sep 17 00:00:00 2001
|
||||||
|
From: Gioh Kim <gi-oh.kim@profitbricks.com>
|
||||||
|
Date: Mon, 20 Mar 2017 10:51:56 +0100
|
||||||
|
Subject: [PATCH] super1: ignore failfast flag for setting device role
|
||||||
|
|
||||||
|
There is corner case for setting device role,
|
||||||
|
if new device has failfast flag.
|
||||||
|
The failfast flag should be ignored.
|
||||||
|
|
||||||
|
Signed-off-by: Gioh Kim <gi-oh.kim@profitbricks.com>
|
||||||
|
Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
|
||||||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
|
---
|
||||||
|
super1.c | 8 +++++---
|
||||||
|
1 file changed, 5 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/super1.c b/super1.c
|
||||||
|
index 882cd61..f3520ac 100644
|
||||||
|
--- a/super1.c
|
||||||
|
+++ b/super1.c
|
||||||
|
@@ -1491,6 +1491,7 @@ static int add_to_super1(struct supertype *st, mdu_disk_info_t *dk,
|
||||||
|
struct devinfo *di, **dip;
|
||||||
|
bitmap_super_t *bms = (bitmap_super_t*)(((char*)sb) + MAX_SB_SIZE);
|
||||||
|
int rv, lockid;
|
||||||
|
+ int dk_state;
|
||||||
|
|
||||||
|
if (bms->version == BITMAP_MAJOR_CLUSTERED && dlm_funs_ready()) {
|
||||||
|
rv = cluster_get_dlmlock(&lockid);
|
||||||
|
@@ -1501,11 +1502,12 @@ static int add_to_super1(struct supertype *st, mdu_disk_info_t *dk,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- if ((dk->state & 6) == 6) /* active, sync */
|
||||||
|
+ dk_state = dk->state & ~(1<<MD_DISK_FAILFAST);
|
||||||
|
+ if ((dk_state & 6) == 6) /* active, sync */
|
||||||
|
*rp = __cpu_to_le16(dk->raid_disk);
|
||||||
|
- else if (dk->state & (1<<MD_DISK_JOURNAL))
|
||||||
|
+ else if (dk_state & (1<<MD_DISK_JOURNAL))
|
||||||
|
*rp = MD_DISK_ROLE_JOURNAL;
|
||||||
|
- else if ((dk->state & ~2) == 0) /* active or idle -> spare */
|
||||||
|
+ else if ((dk_state & ~2) == 0) /* active or idle -> spare */
|
||||||
|
*rp = MD_DISK_ROLE_SPARE;
|
||||||
|
else
|
||||||
|
*rp = MD_DISK_ROLE_FAULTY;
|
||||||
|
--
|
||||||
|
2.10.2
|
||||||
|
|
38
0015-mdadm-bitmap-fixed-typos-in-comments-of-bitmap.h.patch
Normal file
38
0015-mdadm-bitmap-fixed-typos-in-comments-of-bitmap.h.patch
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
From 4c829c2252d2a6fb4871ec0cdad58b6c3a0218fd Mon Sep 17 00:00:00 2001
|
||||||
|
From: Zhilong Liu <zlliu@suse.com>
|
||||||
|
Date: Mon, 20 Mar 2017 18:46:39 +0800
|
||||||
|
Subject: [PATCH] mdadm/bitmap:fixed typos in comments of bitmap.h
|
||||||
|
|
||||||
|
bitmap.h: fixed trivial typos in comments
|
||||||
|
|
||||||
|
Signed-off-by: Zhilong Liu <zlliu@suse.com>
|
||||||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
|
---
|
||||||
|
bitmap.h | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/bitmap.h b/bitmap.h
|
||||||
|
index b8fb071..7b1f80f 100644
|
||||||
|
--- a/bitmap.h
|
||||||
|
+++ b/bitmap.h
|
||||||
|
@@ -46,7 +46,7 @@
|
||||||
|
*
|
||||||
|
* The counter counts pending write requests, plus the on-disk bit.
|
||||||
|
* When the counter is '1' and the resync bits are clear, the on-disk
|
||||||
|
- * bit can be cleared aswell, thus setting the counter to 0.
|
||||||
|
+ * bit can be cleared as well, thus setting the counter to 0.
|
||||||
|
* When we set a bit, or in the counter (to start a write), if the fields is
|
||||||
|
* 0, we first set the disk bit and set the counter to 1.
|
||||||
|
*
|
||||||
|
@@ -185,7 +185,7 @@ struct bitmap_page {
|
||||||
|
*/
|
||||||
|
char *map;
|
||||||
|
/*
|
||||||
|
- * in emergencies (when map cannot be alloced), hijack the map
|
||||||
|
+ * in emergencies (when map cannot be allocated), hijack the map
|
||||||
|
* pointer and use it as two counters itself
|
||||||
|
*/
|
||||||
|
unsigned int hijacked;
|
||||||
|
--
|
||||||
|
2.10.2
|
||||||
|
|
@ -1,7 +1,8 @@
|
|||||||
From 13298bf138e65f094a9368173c0cfba6c12ce875 Mon Sep 17 00:00:00 2001
|
From 3a77acd7170199adc690332ded37c41f067c720e Mon Sep 17 00:00:00 2001
|
||||||
From: Hannes Reinecke <hare@suse.de>
|
From: Hannes Reinecke <hare@suse.de>
|
||||||
Date: Wed, 2 Dec 2015 13:00:15 +0100
|
Date: Mon, 27 Mar 2017 11:15:44 +1100
|
||||||
Subject: [PATCH] udev-md-raid-assembly.rules: Skip non-ready devices
|
Subject: [PATCH] udev-md-raid-assembly.rules: Skip non-ready devices
|
||||||
|
References: bsc#956236
|
||||||
|
|
||||||
If a device isn't fully initialized (e.g if it should be
|
If a device isn't fully initialized (e.g if it should be
|
||||||
handled by multipathing) it should not be considered for
|
handled by multipathing) it should not be considered for
|
||||||
@ -14,10 +15,13 @@ the mdadm rules to ignore devices with SYSTEMD_READY==0.
|
|||||||
|
|
||||||
Signed-off-by: Hannes Reinecke <hare@suse.de>
|
Signed-off-by: Hannes Reinecke <hare@suse.de>
|
||||||
Signed-off-by: NeilBrown <neilb@suse.com>
|
Signed-off-by: NeilBrown <neilb@suse.com>
|
||||||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
---
|
---
|
||||||
udev-md-raid-assembly.rules | 3 +++
|
udev-md-raid-assembly.rules | 3 +++
|
||||||
1 file changed, 3 insertions(+)
|
1 file changed, 3 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/udev-md-raid-assembly.rules b/udev-md-raid-assembly.rules
|
||||||
|
index d0d440a..8ca232a 100644
|
||||||
--- a/udev-md-raid-assembly.rules
|
--- a/udev-md-raid-assembly.rules
|
||||||
+++ b/udev-md-raid-assembly.rules
|
+++ b/udev-md-raid-assembly.rules
|
||||||
@@ -7,6 +7,9 @@ ENV{ANACONDA}=="?*", GOTO="md_inc_end"
|
@@ -7,6 +7,9 @@ ENV{ANACONDA}=="?*", GOTO="md_inc_end"
|
||||||
@ -30,3 +34,6 @@ Signed-off-by: NeilBrown <neilb@suse.com>
|
|||||||
# handle potential components of arrays (the ones supported by md)
|
# handle potential components of arrays (the ones supported by md)
|
||||||
ENV{ID_FS_TYPE}=="linux_raid_member", GOTO="md_inc"
|
ENV{ID_FS_TYPE}=="linux_raid_member", GOTO="md_inc"
|
||||||
|
|
||||||
|
--
|
||||||
|
2.10.2
|
||||||
|
|
@ -1,7 +1,8 @@
|
|||||||
From 3494e6b41659393c7cb97c48b45d2b1a05c6faf0 Mon Sep 17 00:00:00 2001
|
From 2dd271fe7041c2f7036939cf6917c0578b92fefe Mon Sep 17 00:00:00 2001
|
||||||
From: NeilBrown <neilb@suse.com>
|
From: NeilBrown <neilb@suse.com>
|
||||||
Date: Mon, 27 Mar 2017 12:48:06 +1100
|
Date: Mon, 27 Mar 2017 12:50:16 +1100
|
||||||
Subject: [PATCH] Retry HOT_REMOVE_DISK a few times.
|
Subject: [PATCH] Retry HOT_REMOVE_DISK a few times.
|
||||||
|
References: bsc#808647
|
||||||
|
|
||||||
HOT_REMOVE_DISK can fail with EBUSY if there are outstanding
|
HOT_REMOVE_DISK can fail with EBUSY if there are outstanding
|
||||||
IO request that have not completed yet. It can sometimes
|
IO request that have not completed yet. It can sometimes
|
||||||
@ -14,16 +15,19 @@ So create hot_remove_disk() to central this code, and call it
|
|||||||
where-ever it makes sense to wait for a HOT_REMOVE_DISK to succeed.
|
where-ever it makes sense to wait for a HOT_REMOVE_DISK to succeed.
|
||||||
|
|
||||||
Signed-off-by: NeilBrown <neilb@suse.com>
|
Signed-off-by: NeilBrown <neilb@suse.com>
|
||||||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
---
|
---
|
||||||
Grow.c | 9 +--------
|
Grow.c | 9 +--------
|
||||||
Manage.c | 4 ++--
|
Manage.c | 4 ++--
|
||||||
mdadm.h | 1 +
|
mdadm.h | 1 +
|
||||||
util.c | 18 ++++++++++++++++++
|
util.c | 18 ++++++++++++++++++
|
||||||
4 files changed, 22 insertions(+), 10 deletions(-)
|
4 files changed, 22 insertions(+), 10 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/Grow.c b/Grow.c
|
||||||
|
index 455c5f9..218a706 100755
|
||||||
--- a/Grow.c
|
--- a/Grow.c
|
||||||
+++ b/Grow.c
|
+++ b/Grow.c
|
||||||
@@ -2921,7 +2921,6 @@ static int impose_level(int fd, int leve
|
@@ -2736,7 +2736,6 @@ static int impose_level(int fd, int level, char *devname, int verbose)
|
||||||
for (d = 0, found = 0;
|
for (d = 0, found = 0;
|
||||||
d < MAX_DISKS && found < array.nr_disks;
|
d < MAX_DISKS && found < array.nr_disks;
|
||||||
d++) {
|
d++) {
|
||||||
@ -31,7 +35,7 @@ Signed-off-by: NeilBrown <neilb@suse.com>
|
|||||||
mdu_disk_info_t disk;
|
mdu_disk_info_t disk;
|
||||||
disk.number = d;
|
disk.number = d;
|
||||||
if (ioctl(fd, GET_DISK_INFO, &disk) < 0)
|
if (ioctl(fd, GET_DISK_INFO, &disk) < 0)
|
||||||
@@ -2935,13 +2934,7 @@ static int impose_level(int fd, int leve
|
@@ -2750,13 +2749,7 @@ static int impose_level(int fd, int level, char *devname, int verbose)
|
||||||
continue;
|
continue;
|
||||||
ioctl(fd, SET_DISK_FAULTY,
|
ioctl(fd, SET_DISK_FAULTY,
|
||||||
makedev(disk.major, disk.minor));
|
makedev(disk.major, disk.minor));
|
||||||
@ -46,9 +50,11 @@ Signed-off-by: NeilBrown <neilb@suse.com>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
c = map_num(pers, level);
|
c = map_num(pers, level);
|
||||||
|
diff --git a/Manage.c b/Manage.c
|
||||||
|
index 5c3d2b9..9139f96 100644
|
||||||
--- a/Manage.c
|
--- a/Manage.c
|
||||||
+++ b/Manage.c
|
+++ b/Manage.c
|
||||||
@@ -1183,7 +1183,7 @@ int Manage_remove(struct supertype *tst,
|
@@ -1183,7 +1183,7 @@ int Manage_remove(struct supertype *tst, int fd, struct mddev_dev *dv,
|
||||||
else
|
else
|
||||||
err = 0;
|
err = 0;
|
||||||
} else {
|
} else {
|
||||||
@ -57,7 +63,7 @@ Signed-off-by: NeilBrown <neilb@suse.com>
|
|||||||
if (err && errno == ENODEV) {
|
if (err && errno == ENODEV) {
|
||||||
/* Old kernels rejected this if no personality
|
/* Old kernels rejected this if no personality
|
||||||
* is registered */
|
* is registered */
|
||||||
@@ -1607,7 +1607,7 @@ int Manage_subdevs(char *devname, int fd
|
@@ -1607,7 +1607,7 @@ int Manage_subdevs(char *devname, int fd,
|
||||||
|
|
||||||
if (dv->disposition == 'F')
|
if (dv->disposition == 'F')
|
||||||
/* Need to remove first */
|
/* Need to remove first */
|
||||||
@ -66,9 +72,11 @@ Signed-off-by: NeilBrown <neilb@suse.com>
|
|||||||
/* Make sure it isn't in use (in 2.6 or later) */
|
/* Make sure it isn't in use (in 2.6 or later) */
|
||||||
tfd = dev_open(dv->devname, O_RDONLY|O_EXCL);
|
tfd = dev_open(dv->devname, O_RDONLY|O_EXCL);
|
||||||
if (tfd >= 0) {
|
if (tfd >= 0) {
|
||||||
|
diff --git a/mdadm.h b/mdadm.h
|
||||||
|
index 91fd9eb..5bcfb86 100644
|
||||||
--- a/mdadm.h
|
--- a/mdadm.h
|
||||||
+++ b/mdadm.h
|
+++ b/mdadm.h
|
||||||
@@ -1500,6 +1500,7 @@ extern int add_disk(int mdfd, struct sup
|
@@ -1476,6 +1476,7 @@ extern int add_disk(int mdfd, struct supertype *st,
|
||||||
struct mdinfo *sra, struct mdinfo *info);
|
struct mdinfo *sra, struct mdinfo *info);
|
||||||
extern int remove_disk(int mdfd, struct supertype *st,
|
extern int remove_disk(int mdfd, struct supertype *st,
|
||||||
struct mdinfo *sra, struct mdinfo *info);
|
struct mdinfo *sra, struct mdinfo *info);
|
||||||
@ -76,9 +84,11 @@ Signed-off-by: NeilBrown <neilb@suse.com>
|
|||||||
extern int set_array_info(int mdfd, struct supertype *st, struct mdinfo *info);
|
extern int set_array_info(int mdfd, struct supertype *st, struct mdinfo *info);
|
||||||
unsigned long long min_recovery_start(struct mdinfo *array);
|
unsigned long long min_recovery_start(struct mdinfo *array);
|
||||||
|
|
||||||
|
diff --git a/util.c b/util.c
|
||||||
|
index 32bd909..d09a7e2 100644
|
||||||
--- a/util.c
|
--- a/util.c
|
||||||
+++ b/util.c
|
+++ b/util.c
|
||||||
@@ -1795,6 +1795,24 @@ int remove_disk(int mdfd, struct superty
|
@@ -1795,6 +1795,24 @@ int remove_disk(int mdfd, struct supertype *st,
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,3 +113,6 @@ Signed-off-by: NeilBrown <neilb@suse.com>
|
|||||||
int set_array_info(int mdfd, struct supertype *st, struct mdinfo *info)
|
int set_array_info(int mdfd, struct supertype *st, struct mdinfo *info)
|
||||||
{
|
{
|
||||||
/* Initialise kernel's knowledge of array.
|
/* Initialise kernel's knowledge of array.
|
||||||
|
--
|
||||||
|
2.10.2
|
||||||
|
|
@ -0,0 +1,33 @@
|
|||||||
|
From 1b4944f3a1e135871437cc33c26539028e6da5d6 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Zhilong Liu <zlliu@suse.com>
|
||||||
|
Date: Tue, 28 Mar 2017 21:52:27 +0800
|
||||||
|
Subject: [PATCH] mdadm/Build:check the level parameter when build new array
|
||||||
|
|
||||||
|
check if user forgets to specify the --level
|
||||||
|
when build a new array. such as:
|
||||||
|
./mdadm -B /dev/md0 -n2 /dev/loop[0-1]
|
||||||
|
|
||||||
|
Signed-off-by: Zhilong Liu <zlliu@suse.com>
|
||||||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
|
---
|
||||||
|
Build.c | 4 ++++
|
||||||
|
1 file changed, 4 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/Build.c b/Build.c
|
||||||
|
index 74a440e..a5fcc06 100644
|
||||||
|
--- a/Build.c
|
||||||
|
+++ b/Build.c
|
||||||
|
@@ -56,6 +56,10 @@ int Build(char *mddev, struct mddev_dev *devlist,
|
||||||
|
int uuid[4] = {0,0,0,0};
|
||||||
|
struct map_ent *map = NULL;
|
||||||
|
|
||||||
|
+ if (s->level == UnSet) {
|
||||||
|
+ pr_err("a RAID level is needed to Build an array.\n");
|
||||||
|
+ return 1;
|
||||||
|
+ }
|
||||||
|
/* scan all devices, make sure they really are block devices */
|
||||||
|
for (dv = devlist; dv; dv=dv->next) {
|
||||||
|
subdevs++;
|
||||||
|
--
|
||||||
|
2.10.2
|
||||||
|
|
@ -1,7 +1,8 @@
|
|||||||
From 201c9389dd0560544a46d21d1300f174d94a7e60 Mon Sep 17 00:00:00 2001
|
From fdd015696c2e2a6b234a92af564aea44b62e6a0d Mon Sep 17 00:00:00 2001
|
||||||
From: NeilBrown <neilb@suse.com>
|
From: NeilBrown <neilb@suse.com>
|
||||||
Date: Mon, 27 Mar 2017 13:59:41 +1100
|
Date: Mon, 27 Mar 2017 14:36:56 +1100
|
||||||
Subject: [PATCH] Introduce sys_hot_remove_disk()
|
Subject: [PATCH] Introduce sys_hot_remove_disk()
|
||||||
|
References: bsc#974154
|
||||||
|
|
||||||
The new hot_remove_disk() will retry HOT_REMOVE_DISK
|
The new hot_remove_disk() will retry HOT_REMOVE_DISK
|
||||||
several times in the face of EBUSY.
|
several times in the face of EBUSY.
|
||||||
@ -10,15 +11,18 @@ However we sometimes remove a device by writing "remove" to the
|
|||||||
So introduce sys_hot_remove_disk() to repeat this action a few times.
|
So introduce sys_hot_remove_disk() to repeat this action a few times.
|
||||||
|
|
||||||
Signed-off-by: NeilBrown <neilb@suse.com>
|
Signed-off-by: NeilBrown <neilb@suse.com>
|
||||||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
---
|
---
|
||||||
Manage.c | 6 +-----
|
Manage.c | 6 +-----
|
||||||
mdadm.h | 1 +
|
mdadm.h | 1 +
|
||||||
util.c | 12 ++++++++++++
|
util.c | 12 ++++++++++++
|
||||||
3 files changed, 14 insertions(+), 5 deletions(-)
|
3 files changed, 14 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/Manage.c b/Manage.c
|
||||||
|
index 9139f96..edf5798 100644
|
||||||
--- a/Manage.c
|
--- a/Manage.c
|
||||||
+++ b/Manage.c
|
+++ b/Manage.c
|
||||||
@@ -1177,11 +1177,7 @@ int Manage_remove(struct supertype *tst,
|
@@ -1177,11 +1177,7 @@ int Manage_remove(struct supertype *tst, int fd, struct mddev_dev *dv,
|
||||||
/* device has been removed and we don't know
|
/* device has been removed and we don't know
|
||||||
* the major:minor number
|
* the major:minor number
|
||||||
*/
|
*/
|
||||||
@ -31,9 +35,11 @@ Signed-off-by: NeilBrown <neilb@suse.com>
|
|||||||
} else {
|
} else {
|
||||||
err = hot_remove_disk(fd, rdev);
|
err = hot_remove_disk(fd, rdev);
|
||||||
if (err && errno == ENODEV) {
|
if (err && errno == ENODEV) {
|
||||||
|
diff --git a/mdadm.h b/mdadm.h
|
||||||
|
index 5bcfb86..b855d24 100644
|
||||||
--- a/mdadm.h
|
--- a/mdadm.h
|
||||||
+++ b/mdadm.h
|
+++ b/mdadm.h
|
||||||
@@ -1501,6 +1501,7 @@ extern int add_disk(int mdfd, struct sup
|
@@ -1477,6 +1477,7 @@ extern int add_disk(int mdfd, struct supertype *st,
|
||||||
extern int remove_disk(int mdfd, struct supertype *st,
|
extern int remove_disk(int mdfd, struct supertype *st,
|
||||||
struct mdinfo *sra, struct mdinfo *info);
|
struct mdinfo *sra, struct mdinfo *info);
|
||||||
extern int hot_remove_disk(int mdfd, unsigned long dev);
|
extern int hot_remove_disk(int mdfd, unsigned long dev);
|
||||||
@ -41,9 +47,11 @@ Signed-off-by: NeilBrown <neilb@suse.com>
|
|||||||
extern int set_array_info(int mdfd, struct supertype *st, struct mdinfo *info);
|
extern int set_array_info(int mdfd, struct supertype *st, struct mdinfo *info);
|
||||||
unsigned long long min_recovery_start(struct mdinfo *array);
|
unsigned long long min_recovery_start(struct mdinfo *array);
|
||||||
|
|
||||||
|
diff --git a/util.c b/util.c
|
||||||
|
index d09a7e2..b718531 100644
|
||||||
--- a/util.c
|
--- a/util.c
|
||||||
+++ b/util.c
|
+++ b/util.c
|
||||||
@@ -1813,6 +1813,18 @@ int hot_remove_disk(int mdfd, unsigned l
|
@@ -1813,6 +1813,18 @@ int hot_remove_disk(int mdfd, unsigned long dev)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,3 +70,6 @@ Signed-off-by: NeilBrown <neilb@suse.com>
|
|||||||
int set_array_info(int mdfd, struct supertype *st, struct mdinfo *info)
|
int set_array_info(int mdfd, struct supertype *st, struct mdinfo *info)
|
||||||
{
|
{
|
||||||
/* Initialise kernel's knowledge of array.
|
/* Initialise kernel's knowledge of array.
|
||||||
|
--
|
||||||
|
2.10.2
|
||||||
|
|
@ -1,7 +1,8 @@
|
|||||||
From be098ff0d8ef141b309a85265dfed3035da26a18 Mon Sep 17 00:00:00 2001
|
From 1ab9ed2afb7ca50c4f922a0b85c4e6631becde02 Mon Sep 17 00:00:00 2001
|
||||||
From: NeilBrown <neilb@suse.com>
|
From: NeilBrown <neilb@suse.com>
|
||||||
Date: Mon, 27 Mar 2017 14:07:37 +1100
|
Date: Mon, 27 Mar 2017 14:36:56 +1100
|
||||||
Subject: [PATCH] Add 'force' flag to *hot_remove_disk().
|
Subject: [PATCH] Add 'force' flag to *hot_remove_disk().
|
||||||
|
References: bsc#808647
|
||||||
|
|
||||||
In rare circumstances, the short period that *hot_remove_disk()
|
In rare circumstances, the short period that *hot_remove_disk()
|
||||||
waits isn't long enough to IO to complete. This particularly happens
|
waits isn't long enough to IO to complete. This particularly happens
|
||||||
@ -17,16 +18,19 @@ Note that this patch fixes a comment which claim the previous
|
|||||||
wait time was half a second, where it was really 50msec.
|
wait time was half a second, where it was really 50msec.
|
||||||
|
|
||||||
Signed-off-by: NeilBrown <neilb@suse.com>
|
Signed-off-by: NeilBrown <neilb@suse.com>
|
||||||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
---
|
---
|
||||||
Grow.c | 2 +-
|
Grow.c | 2 +-
|
||||||
Manage.c | 10 +++++-----
|
Manage.c | 10 +++++-----
|
||||||
mdadm.h | 4 ++--
|
mdadm.h | 4 ++--
|
||||||
util.c | 10 +++++-----
|
util.c | 10 +++++-----
|
||||||
4 files changed, 13 insertions(+), 13 deletions(-)
|
4 files changed, 13 insertions(+), 13 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/Grow.c b/Grow.c
|
||||||
|
index 218a706..e22661c 100755
|
||||||
--- a/Grow.c
|
--- a/Grow.c
|
||||||
+++ b/Grow.c
|
+++ b/Grow.c
|
||||||
@@ -2934,7 +2934,7 @@ static int impose_level(int fd, int leve
|
@@ -2749,7 +2749,7 @@ static int impose_level(int fd, int level, char *devname, int verbose)
|
||||||
continue;
|
continue;
|
||||||
ioctl(fd, SET_DISK_FAULTY,
|
ioctl(fd, SET_DISK_FAULTY,
|
||||||
makedev(disk.major, disk.minor));
|
makedev(disk.major, disk.minor));
|
||||||
@ -35,9 +39,11 @@ Signed-off-by: NeilBrown <neilb@suse.com>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
c = map_num(pers, level);
|
c = map_num(pers, level);
|
||||||
|
diff --git a/Manage.c b/Manage.c
|
||||||
|
index edf5798..55218d9 100644
|
||||||
--- a/Manage.c
|
--- a/Manage.c
|
||||||
+++ b/Manage.c
|
+++ b/Manage.c
|
||||||
@@ -1110,7 +1110,7 @@ int Manage_add(int fd, int tfd, struct m
|
@@ -1110,7 +1110,7 @@ int Manage_add(int fd, int tfd, struct mddev_dev *dv,
|
||||||
}
|
}
|
||||||
|
|
||||||
int Manage_remove(struct supertype *tst, int fd, struct mddev_dev *dv,
|
int Manage_remove(struct supertype *tst, int fd, struct mddev_dev *dv,
|
||||||
@ -46,7 +52,7 @@ Signed-off-by: NeilBrown <neilb@suse.com>
|
|||||||
{
|
{
|
||||||
int lfd = -1;
|
int lfd = -1;
|
||||||
int err;
|
int err;
|
||||||
@@ -1177,9 +1177,9 @@ int Manage_remove(struct supertype *tst,
|
@@ -1177,9 +1177,9 @@ int Manage_remove(struct supertype *tst, int fd, struct mddev_dev *dv,
|
||||||
/* device has been removed and we don't know
|
/* device has been removed and we don't know
|
||||||
* the major:minor number
|
* the major:minor number
|
||||||
*/
|
*/
|
||||||
@ -58,7 +64,7 @@ Signed-off-by: NeilBrown <neilb@suse.com>
|
|||||||
if (err && errno == ENODEV) {
|
if (err && errno == ENODEV) {
|
||||||
/* Old kernels rejected this if no personality
|
/* Old kernels rejected this if no personality
|
||||||
* is registered */
|
* is registered */
|
||||||
@@ -1603,7 +1603,7 @@ int Manage_subdevs(char *devname, int fd
|
@@ -1603,7 +1603,7 @@ int Manage_subdevs(char *devname, int fd,
|
||||||
|
|
||||||
if (dv->disposition == 'F')
|
if (dv->disposition == 'F')
|
||||||
/* Need to remove first */
|
/* Need to remove first */
|
||||||
@ -67,7 +73,7 @@ Signed-off-by: NeilBrown <neilb@suse.com>
|
|||||||
/* Make sure it isn't in use (in 2.6 or later) */
|
/* Make sure it isn't in use (in 2.6 or later) */
|
||||||
tfd = dev_open(dv->devname, O_RDONLY|O_EXCL);
|
tfd = dev_open(dv->devname, O_RDONLY|O_EXCL);
|
||||||
if (tfd >= 0) {
|
if (tfd >= 0) {
|
||||||
@@ -1645,7 +1645,7 @@ int Manage_subdevs(char *devname, int fd
|
@@ -1645,7 +1645,7 @@ int Manage_subdevs(char *devname, int fd,
|
||||||
rv = -1;
|
rv = -1;
|
||||||
} else
|
} else
|
||||||
rv = Manage_remove(tst, fd, dv, sysfd,
|
rv = Manage_remove(tst, fd, dv, sysfd,
|
||||||
@ -76,9 +82,11 @@ Signed-off-by: NeilBrown <neilb@suse.com>
|
|||||||
devname);
|
devname);
|
||||||
if (sysfd >= 0)
|
if (sysfd >= 0)
|
||||||
close(sysfd);
|
close(sysfd);
|
||||||
|
diff --git a/mdadm.h b/mdadm.h
|
||||||
|
index b855d24..cebc0c0 100644
|
||||||
--- a/mdadm.h
|
--- a/mdadm.h
|
||||||
+++ b/mdadm.h
|
+++ b/mdadm.h
|
||||||
@@ -1500,8 +1500,8 @@ extern int add_disk(int mdfd, struct sup
|
@@ -1476,8 +1476,8 @@ extern int add_disk(int mdfd, struct supertype *st,
|
||||||
struct mdinfo *sra, struct mdinfo *info);
|
struct mdinfo *sra, struct mdinfo *info);
|
||||||
extern int remove_disk(int mdfd, struct supertype *st,
|
extern int remove_disk(int mdfd, struct supertype *st,
|
||||||
struct mdinfo *sra, struct mdinfo *info);
|
struct mdinfo *sra, struct mdinfo *info);
|
||||||
@ -89,9 +97,11 @@ Signed-off-by: NeilBrown <neilb@suse.com>
|
|||||||
extern int set_array_info(int mdfd, struct supertype *st, struct mdinfo *info);
|
extern int set_array_info(int mdfd, struct supertype *st, struct mdinfo *info);
|
||||||
unsigned long long min_recovery_start(struct mdinfo *array);
|
unsigned long long min_recovery_start(struct mdinfo *array);
|
||||||
|
|
||||||
|
diff --git a/util.c b/util.c
|
||||||
|
index b718531..683c869 100644
|
||||||
--- a/util.c
|
--- a/util.c
|
||||||
+++ b/util.c
|
+++ b/util.c
|
||||||
@@ -1795,15 +1795,15 @@ int remove_disk(int mdfd, struct superty
|
@@ -1795,15 +1795,15 @@ int remove_disk(int mdfd, struct supertype *st,
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,7 +120,7 @@ Signed-off-by: NeilBrown <neilb@suse.com>
|
|||||||
*/
|
*/
|
||||||
while ((ret = ioctl(mdfd, HOT_REMOVE_DISK, dev)) == -1 &&
|
while ((ret = ioctl(mdfd, HOT_REMOVE_DISK, dev)) == -1 &&
|
||||||
errno == EBUSY &&
|
errno == EBUSY &&
|
||||||
@@ -1813,9 +1813,9 @@ int hot_remove_disk(int mdfd, unsigned l
|
@@ -1813,9 +1813,9 @@ int hot_remove_disk(int mdfd, unsigned long dev)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,3 +132,6 @@ Signed-off-by: NeilBrown <neilb@suse.com>
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
while ((ret = write(statefd, "remove", 6)) == -1 &&
|
while ((ret = write(statefd, "remove", 6)) == -1 &&
|
||||||
|
--
|
||||||
|
2.10.2
|
||||||
|
|
@ -1,7 +1,8 @@
|
|||||||
From f58545b578e839df2f1682fd68f36079d4c39134 Mon Sep 17 00:00:00 2001
|
From b4decd517d90098bc2d17d3eddfe858d8b903920 Mon Sep 17 00:00:00 2001
|
||||||
From: NeilBrown <neilb@suse.com>
|
From: NeilBrown <neilb@suse.com>
|
||||||
Date: Mon, 27 Mar 2017 14:21:11 +1100
|
Date: Mon, 27 Mar 2017 14:36:56 +1100
|
||||||
Subject: [PATCH] Detail: handle non-existent arrays better.
|
Subject: [PATCH] Detail: handle non-existent arrays better.
|
||||||
|
References: bsc#966773
|
||||||
|
|
||||||
If you call "mdadm --detail" with a device file for an array which
|
If you call "mdadm --detail" with a device file for an array which
|
||||||
doesn't exist, such as by
|
doesn't exist, such as by
|
||||||
@ -15,12 +16,13 @@ So catch this possibility and print a more useful message, and
|
|||||||
return a non-zero status.
|
return a non-zero status.
|
||||||
|
|
||||||
Signed-off-by: NeilBrown <neilb@suse.com>
|
Signed-off-by: NeilBrown <neilb@suse.com>
|
||||||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
---
|
---
|
||||||
Detail.c | 8 ++++++++
|
Detail.c | 8 ++++++++
|
||||||
1 file changed, 8 insertions(+)
|
1 file changed, 8 insertions(+)
|
||||||
|
|
||||||
diff --git a/Detail.c b/Detail.c
|
diff --git a/Detail.c b/Detail.c
|
||||||
index 509b0d418768..d9d1b7092167 100644
|
index cb33794..3d92855 100644
|
||||||
--- a/Detail.c
|
--- a/Detail.c
|
||||||
+++ b/Detail.c
|
+++ b/Detail.c
|
||||||
@@ -110,6 +110,14 @@ int Detail(char *dev, struct context *c)
|
@@ -110,6 +110,14 @@ int Detail(char *dev, struct context *c)
|
||||||
@ -39,5 +41,5 @@ index 509b0d418768..d9d1b7092167 100644
|
|||||||
inactive = 1;
|
inactive = 1;
|
||||||
} else {
|
} else {
|
||||||
--
|
--
|
||||||
2.12.0
|
2.10.2
|
||||||
|
|
@ -1,7 +1,8 @@
|
|||||||
From d179ac821d77ded7a63a0b734e290a42eeeee4b2 Mon Sep 17 00:00:00 2001
|
From 5308f11727b889965efe5ac0e854d197c2b51f6d Mon Sep 17 00:00:00 2001
|
||||||
From: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
From: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
||||||
Date: Thu, 16 Mar 2017 22:09:43 +0100
|
Date: Wed, 29 Mar 2017 11:54:15 +0200
|
||||||
Subject: [PATCH] Generic support for --consistency-policy and PPL
|
Subject: [PATCH] Generic support for --consistency-policy and PPL
|
||||||
|
References: FATE#321941
|
||||||
|
|
||||||
Add a new parameter to mdadm: --consistency-policy=. It determines how
|
Add a new parameter to mdadm: --consistency-policy=. It determines how
|
||||||
the array maintains consistency in case of unexpected shutdown. This
|
the array maintains consistency in case of unexpected shutdown. This
|
||||||
@ -12,26 +13,29 @@ functionalities are treated as different policies, which are implicitly
|
|||||||
selected when using --write-journal or --bitmap options.
|
selected when using --write-journal or --bitmap options.
|
||||||
|
|
||||||
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
||||||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
---
|
---
|
||||||
Create.c | 18 ++++++++++++++----
|
Create.c | 18 ++++++++++++++----
|
||||||
Kill.c | 2 +-
|
Kill.c | 2 +-
|
||||||
ReadMe.c | 7 ++++---
|
ReadMe.c | 51 +++++++++++++++++++++++++++------------------------
|
||||||
maps.c | 10 ++++++++++
|
maps.c | 10 ++++++++++
|
||||||
mdadm.8.in | 40 +++++++++++++++++++++++++++++++++++++---
|
mdadm.8.in | 40 +++++++++++++++++++++++++++++++++++++---
|
||||||
mdadm.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
|
mdadm.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
|
||||||
mdadm.h | 21 ++++++++++++++++++---
|
mdadm.h | 21 ++++++++++++++++++---
|
||||||
super-ddf.c | 6 +++---
|
super-ddf.c | 6 +++---
|
||||||
super-gpt.c | 2 +-
|
super-gpt.c | 2 +-
|
||||||
super-intel.c | 16 ++++++++--------
|
super-intel.c | 16 ++++++++--------
|
||||||
super-mbr.c | 2 +-
|
super-mbr.c | 2 +-
|
||||||
super0.c | 8 ++++----
|
super0.c | 8 ++++----
|
||||||
super1.c | 6 +++---
|
super1.c | 6 +++---
|
||||||
sysfs.c | 11 +++++++++++
|
sysfs.c | 11 +++++++++++
|
||||||
14 files changed, 167 insertions(+), 37 deletions(-)
|
14 files changed, 190 insertions(+), 58 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/Create.c b/Create.c
|
||||||
|
index 2721884..4080bf6 100644
|
||||||
--- a/Create.c
|
--- a/Create.c
|
||||||
+++ b/Create.c
|
+++ b/Create.c
|
||||||
@@ -259,7 +259,8 @@ int Create(struct supertype *st, char *m
|
@@ -259,7 +259,8 @@ int Create(struct supertype *st, char *mddev,
|
||||||
if (st && ! st->ss->validate_geometry(st, s->level, s->layout, s->raiddisks,
|
if (st && ! st->ss->validate_geometry(st, s->level, s->layout, s->raiddisks,
|
||||||
&s->chunk, s->size*2,
|
&s->chunk, s->size*2,
|
||||||
data_offset, NULL,
|
data_offset, NULL,
|
||||||
@ -41,7 +45,7 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (s->chunk && s->chunk != UnSet) {
|
if (s->chunk && s->chunk != UnSet) {
|
||||||
@@ -358,7 +359,8 @@ int Create(struct supertype *st, char *m
|
@@ -358,7 +359,8 @@ int Create(struct supertype *st, char *mddev,
|
||||||
st, s->level, s->layout, s->raiddisks,
|
st, s->level, s->layout, s->raiddisks,
|
||||||
&s->chunk, s->size*2,
|
&s->chunk, s->size*2,
|
||||||
dv->data_offset, dname,
|
dv->data_offset, dname,
|
||||||
@ -51,7 +55,7 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
case -1: /* Not valid, message printed, and not
|
case -1: /* Not valid, message printed, and not
|
||||||
* worth checking any further */
|
* worth checking any further */
|
||||||
exit(2);
|
exit(2);
|
||||||
@@ -395,6 +397,7 @@ int Create(struct supertype *st, char *m
|
@@ -395,6 +397,7 @@ int Create(struct supertype *st, char *mddev,
|
||||||
&s->chunk, s->size*2,
|
&s->chunk, s->size*2,
|
||||||
dv->data_offset,
|
dv->data_offset,
|
||||||
dname, &freesize,
|
dname, &freesize,
|
||||||
@ -59,7 +63,7 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
c->verbose >= 0)) {
|
c->verbose >= 0)) {
|
||||||
|
|
||||||
pr_err("%s is not suitable for this array.\n",
|
pr_err("%s is not suitable for this array.\n",
|
||||||
@@ -501,7 +504,8 @@ int Create(struct supertype *st, char *m
|
@@ -501,7 +504,8 @@ int Create(struct supertype *st, char *mddev,
|
||||||
s->raiddisks,
|
s->raiddisks,
|
||||||
&s->chunk, minsize*2,
|
&s->chunk, minsize*2,
|
||||||
data_offset,
|
data_offset,
|
||||||
@ -69,7 +73,7 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
pr_err("devices too large for RAID level %d\n", s->level);
|
pr_err("devices too large for RAID level %d\n", s->level);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -528,6 +532,12 @@ int Create(struct supertype *st, char *m
|
@@ -528,6 +532,12 @@ int Create(struct supertype *st, char *mddev,
|
||||||
if (s->bitmap_file && strcmp(s->bitmap_file, "none") == 0)
|
if (s->bitmap_file && strcmp(s->bitmap_file, "none") == 0)
|
||||||
s->bitmap_file = NULL;
|
s->bitmap_file = NULL;
|
||||||
|
|
||||||
@ -82,7 +86,7 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
if (!have_container && s->level > 0 && ((maxsize-s->size)*100 > maxsize)) {
|
if (!have_container && s->level > 0 && ((maxsize-s->size)*100 > maxsize)) {
|
||||||
if (c->runstop != 1 || c->verbose >= 0)
|
if (c->runstop != 1 || c->verbose >= 0)
|
||||||
pr_err("largest drive (%s) exceeds size (%lluK) by more than 1%%\n",
|
pr_err("largest drive (%s) exceeds size (%lluK) by more than 1%%\n",
|
||||||
@@ -720,7 +730,7 @@ int Create(struct supertype *st, char *m
|
@@ -720,7 +730,7 @@ int Create(struct supertype *st, char *mddev,
|
||||||
name += 2;
|
name += 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -91,9 +95,11 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
data_offset))
|
data_offset))
|
||||||
goto abort_locked;
|
goto abort_locked;
|
||||||
|
|
||||||
|
diff --git a/Kill.c b/Kill.c
|
||||||
|
index f2fdb85..ff52561 100644
|
||||||
--- a/Kill.c
|
--- a/Kill.c
|
||||||
+++ b/Kill.c
|
+++ b/Kill.c
|
||||||
@@ -63,7 +63,7 @@ int Kill(char *dev, struct supertype *st
|
@@ -63,7 +63,7 @@ int Kill(char *dev, struct supertype *st, int force, int verbose, int noexcl)
|
||||||
rv = st->ss->load_super(st, fd, dev);
|
rv = st->ss->load_super(st, fd, dev);
|
||||||
if (rv == 0 || (force && rv >= 2)) {
|
if (rv == 0 || (force && rv >= 2)) {
|
||||||
st->ss->free_super(st);
|
st->ss->free_super(st);
|
||||||
@ -102,9 +108,11 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
INVALID_SECTORS);
|
INVALID_SECTORS);
|
||||||
if (st->ss->store_super(st, fd)) {
|
if (st->ss->store_super(st, fd)) {
|
||||||
if (verbose >= 0)
|
if (verbose >= 0)
|
||||||
|
diff --git a/ReadMe.c b/ReadMe.c
|
||||||
|
index 50d3807..fc04c2c 100644
|
||||||
--- a/ReadMe.c
|
--- a/ReadMe.c
|
||||||
+++ b/ReadMe.c
|
+++ b/ReadMe.c
|
||||||
@@ -78,11 +78,11 @@ char Version[] = "mdadm - v" VERSION " -
|
@@ -78,11 +78,11 @@ char Version[] = "mdadm - v" VERSION " - " VERS_DATE "\n";
|
||||||
* found, it is started.
|
* found, it is started.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -123,10 +131,63 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
{"nodes",1, 0, Nodes}, /* also for --assemble */
|
{"nodes",1, 0, Nodes}, /* also for --assemble */
|
||||||
{"home-cluster",1, 0, ClusterName},
|
{"home-cluster",1, 0, ClusterName},
|
||||||
{"write-journal",1, 0, WriteJournal},
|
{"write-journal",1, 0, WriteJournal},
|
||||||
+ {"consistency-policy",1, 0, 'k'},
|
+ {"consistency-policy", 1, 0, 'k'},
|
||||||
|
|
||||||
/* For assemble */
|
/* For assemble */
|
||||||
{"uuid", 1, 0, 'u'},
|
{"uuid", 1, 0, 'u'},
|
||||||
|
@@ -362,27 +363,29 @@ char Help_create[] =
|
||||||
|
" other levels.\n"
|
||||||
|
"\n"
|
||||||
|
" Options that are valid with --create (-C) are:\n"
|
||||||
|
-" --bitmap= : Create a bitmap for the array with the given filename\n"
|
||||||
|
-" : or an internal bitmap is 'internal' is given\n"
|
||||||
|
-" --chunk= -c : chunk size in kibibytes\n"
|
||||||
|
-" --rounding= : rounding factor for linear array (==chunk size)\n"
|
||||||
|
-" --level= -l : raid level: 0,1,4,5,6,10,linear,multipath and synonyms\n"
|
||||||
|
-" --parity= -p : raid5/6 parity algorithm: {left,right}-{,a}symmetric\n"
|
||||||
|
-" --layout= : same as --parity, for RAID10: [fno]NN \n"
|
||||||
|
-" --raid-devices= -n : number of active devices in array\n"
|
||||||
|
-" --spare-devices= -x: number of spare (eXtra) devices in initial array\n"
|
||||||
|
-" --size= -z : Size (in K) of each drive in RAID1/4/5/6/10 - optional\n"
|
||||||
|
-" --data-offset= : Space to leave between start of device and start\n"
|
||||||
|
-" : of array data.\n"
|
||||||
|
-" --force -f : Honour devices as listed on command line. Don't\n"
|
||||||
|
-" : insert a missing drive for RAID5.\n"
|
||||||
|
-" --run -R : insist of running the array even if not all\n"
|
||||||
|
-" : devices are present or some look odd.\n"
|
||||||
|
-" --readonly -o : start the array readonly - not supported yet.\n"
|
||||||
|
-" --name= -N : Textual name for array - max 32 characters\n"
|
||||||
|
-" --bitmap-chunk= : bitmap chunksize in Kilobytes.\n"
|
||||||
|
-" --delay= -d : bitmap update delay in seconds.\n"
|
||||||
|
-" --write-journal= : Specify journal device for RAID-4/5/6 array\n"
|
||||||
|
+" --bitmap= -b : Create a bitmap for the array with the given filename\n"
|
||||||
|
+" : or an internal bitmap if 'internal' is given\n"
|
||||||
|
+" --chunk= -c : chunk size in kibibytes\n"
|
||||||
|
+" --rounding= : rounding factor for linear array (==chunk size)\n"
|
||||||
|
+" --level= -l : raid level: 0,1,4,5,6,10,linear,multipath and synonyms\n"
|
||||||
|
+" --parity= -p : raid5/6 parity algorithm: {left,right}-{,a}symmetric\n"
|
||||||
|
+" --layout= : same as --parity, for RAID10: [fno]NN \n"
|
||||||
|
+" --raid-devices= -n : number of active devices in array\n"
|
||||||
|
+" --spare-devices= -x : number of spare (eXtra) devices in initial array\n"
|
||||||
|
+" --size= -z : Size (in K) of each drive in RAID1/4/5/6/10 - optional\n"
|
||||||
|
+" --data-offset= : Space to leave between start of device and start\n"
|
||||||
|
+" : of array data.\n"
|
||||||
|
+" --force -f : Honour devices as listed on command line. Don't\n"
|
||||||
|
+" : insert a missing drive for RAID5.\n"
|
||||||
|
+" --run -R : insist of running the array even if not all\n"
|
||||||
|
+" : devices are present or some look odd.\n"
|
||||||
|
+" --readonly -o : start the array readonly - not supported yet.\n"
|
||||||
|
+" --name= -N : Textual name for array - max 32 characters\n"
|
||||||
|
+" --bitmap-chunk= : bitmap chunksize in Kilobytes.\n"
|
||||||
|
+" --delay= -d : bitmap update delay in seconds.\n"
|
||||||
|
+" --write-journal= : Specify journal device for RAID-4/5/6 array\n"
|
||||||
|
+" --consistency-policy= : Specify the policy that determines how the array\n"
|
||||||
|
+" -k : maintains consistency in case of unexpected shutdown.\n"
|
||||||
|
"\n"
|
||||||
|
;
|
||||||
|
|
||||||
|
diff --git a/maps.c b/maps.c
|
||||||
|
index 64f1df2..d9ee7de 100644
|
||||||
--- a/maps.c
|
--- a/maps.c
|
||||||
+++ b/maps.c
|
+++ b/maps.c
|
||||||
@@ -129,6 +129,16 @@ mapping_t faultylayout[] = {
|
@@ -129,6 +129,16 @@ mapping_t faultylayout[] = {
|
||||||
@ -146,9 +207,11 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
char *map_num(mapping_t *map, int num)
|
char *map_num(mapping_t *map, int num)
|
||||||
{
|
{
|
||||||
while (map->name) {
|
while (map->name) {
|
||||||
|
diff --git a/mdadm.8.in b/mdadm.8.in
|
||||||
|
index df1d460..cad5db5 100644
|
||||||
--- a/mdadm.8.in
|
--- a/mdadm.8.in
|
||||||
+++ b/mdadm.8.in
|
+++ b/mdadm.8.in
|
||||||
@@ -724,7 +724,9 @@ When creating an array on devices which
|
@@ -724,7 +724,9 @@ When creating an array on devices which are 100G or larger,
|
||||||
.I mdadm
|
.I mdadm
|
||||||
automatically adds an internal bitmap as it will usually be
|
automatically adds an internal bitmap as it will usually be
|
||||||
beneficial. This can be suppressed with
|
beneficial. This can be suppressed with
|
||||||
@ -159,9 +222,9 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
|
|
||||||
.TP
|
.TP
|
||||||
.BR \-\-bitmap\-chunk=
|
.BR \-\-bitmap\-chunk=
|
||||||
@@ -1015,6 +1017,36 @@ simultaneously. If not specified, this d
|
@@ -1020,6 +1022,36 @@ should be a SSD with reasonable lifetime.
|
||||||
Specify journal device for the RAID-4/5/6 array. The journal device
|
Auto creation of symlinks in /dev to /dev/md, option --symlinks must
|
||||||
should be a SSD with reasonable lifetime.
|
be 'no' or 'yes' and work with --create and --build.
|
||||||
|
|
||||||
+.TP
|
+.TP
|
||||||
+.BR \-k ", " \-\-consistency\-policy=
|
+.BR \-k ", " \-\-consistency\-policy=
|
||||||
@ -196,7 +259,7 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
|
|
||||||
.SH For assemble:
|
.SH For assemble:
|
||||||
|
|
||||||
@@ -2144,8 +2176,10 @@ in the array exceed 100G is size, an int
|
@@ -2153,8 +2185,10 @@ in the array exceed 100G is size, an internal write-intent bitmap
|
||||||
will automatically be added unless some other option is explicitly
|
will automatically be added unless some other option is explicitly
|
||||||
requested with the
|
requested with the
|
||||||
.B \-\-bitmap
|
.B \-\-bitmap
|
||||||
@ -209,6 +272,8 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
.BR "\-\-grow \-\-bitmap=internal" .
|
.BR "\-\-grow \-\-bitmap=internal" .
|
||||||
|
|
||||||
If the metadata type supports it (currently only 1.x metadata), space
|
If the metadata type supports it (currently only 1.x metadata), space
|
||||||
|
diff --git a/mdadm.c b/mdadm.c
|
||||||
|
index 08ddcab..d4e8286 100644
|
||||||
--- a/mdadm.c
|
--- a/mdadm.c
|
||||||
+++ b/mdadm.c
|
+++ b/mdadm.c
|
||||||
@@ -78,6 +78,7 @@ int main(int argc, char *argv[])
|
@@ -78,6 +78,7 @@ int main(int argc, char *argv[])
|
||||||
@ -219,7 +284,7 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
};
|
};
|
||||||
|
|
||||||
char sys_hostname[256];
|
char sys_hostname[256];
|
||||||
@@ -1209,6 +1210,16 @@ int main(int argc, char *argv[])
|
@@ -1215,6 +1216,16 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
s.journaldisks = 1;
|
s.journaldisks = 1;
|
||||||
continue;
|
continue;
|
||||||
@ -236,7 +301,7 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
}
|
}
|
||||||
/* We have now processed all the valid options. Anything else is
|
/* We have now processed all the valid options. Anything else is
|
||||||
* an error
|
* an error
|
||||||
@@ -1236,9 +1247,47 @@ int main(int argc, char *argv[])
|
@@ -1242,9 +1253,47 @@ int main(int argc, char *argv[])
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -287,6 +352,8 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!mode && devs_found) {
|
if (!mode && devs_found) {
|
||||||
|
diff --git a/mdadm.h b/mdadm.h
|
||||||
|
index cebc0c0..b52d4d3 100644
|
||||||
--- a/mdadm.h
|
--- a/mdadm.h
|
||||||
+++ b/mdadm.h
|
+++ b/mdadm.h
|
||||||
@@ -279,6 +279,15 @@ struct mdinfo {
|
@@ -279,6 +279,15 @@ struct mdinfo {
|
||||||
@ -329,7 +396,7 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* If fd >= 0, get the array it is open on,
|
/* If fd >= 0, get the array it is open on,
|
||||||
@@ -701,7 +713,7 @@ extern int restore_stripes(int *dest, un
|
@@ -701,7 +713,7 @@ extern int restore_stripes(int *dest, unsigned long long *offsets,
|
||||||
|
|
||||||
extern char *map_num(mapping_t *map, int num);
|
extern char *map_num(mapping_t *map, int num);
|
||||||
extern int map_name(mapping_t *map, char *name);
|
extern int map_name(mapping_t *map, char *name);
|
||||||
@ -366,9 +433,11 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
/* records new bad block in metadata */
|
/* records new bad block in metadata */
|
||||||
int (*record_bad_block)(struct active_array *a, int n,
|
int (*record_bad_block)(struct active_array *a, int n,
|
||||||
unsigned long long sector, int length);
|
unsigned long long sector, int length);
|
||||||
|
diff --git a/super-ddf.c b/super-ddf.c
|
||||||
|
index 1707ad1..cdd16a4 100644
|
||||||
--- a/super-ddf.c
|
--- a/super-ddf.c
|
||||||
+++ b/super-ddf.c
|
+++ b/super-ddf.c
|
||||||
@@ -2290,7 +2290,7 @@ static unsigned int find_vde_by_guid(con
|
@@ -2290,7 +2290,7 @@ static unsigned int find_vde_by_guid(const struct ddf_super *ddf,
|
||||||
|
|
||||||
static int init_super_ddf(struct supertype *st,
|
static int init_super_ddf(struct supertype *st,
|
||||||
mdu_array_info_t *info,
|
mdu_array_info_t *info,
|
||||||
@ -377,7 +446,7 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
int *uuid, unsigned long long data_offset)
|
int *uuid, unsigned long long data_offset)
|
||||||
{
|
{
|
||||||
/* This is primarily called by Create when creating a new array.
|
/* This is primarily called by Create when creating a new array.
|
||||||
@@ -2328,7 +2328,7 @@ static int init_super_ddf(struct superty
|
@@ -2328,7 +2328,7 @@ static int init_super_ddf(struct supertype *st,
|
||||||
struct virtual_disk *vd;
|
struct virtual_disk *vd;
|
||||||
|
|
||||||
if (st->sb)
|
if (st->sb)
|
||||||
@ -386,7 +455,7 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
data_offset);
|
data_offset);
|
||||||
|
|
||||||
if (posix_memalign((void**)&ddf, 512, sizeof(*ddf)) != 0) {
|
if (posix_memalign((void**)&ddf, 512, sizeof(*ddf)) != 0) {
|
||||||
@@ -3347,7 +3347,7 @@ static int validate_geometry_ddf(struct
|
@@ -3347,7 +3347,7 @@ static int validate_geometry_ddf(struct supertype *st,
|
||||||
int *chunk, unsigned long long size,
|
int *chunk, unsigned long long size,
|
||||||
unsigned long long data_offset,
|
unsigned long long data_offset,
|
||||||
char *dev, unsigned long long *freesize,
|
char *dev, unsigned long long *freesize,
|
||||||
@ -395,9 +464,11 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
struct mdinfo *sra;
|
struct mdinfo *sra;
|
||||||
|
diff --git a/super-gpt.c b/super-gpt.c
|
||||||
|
index 8b080a0..bb38a97 100644
|
||||||
--- a/super-gpt.c
|
--- a/super-gpt.c
|
||||||
+++ b/super-gpt.c
|
+++ b/super-gpt.c
|
||||||
@@ -205,7 +205,7 @@ static int validate_geometry(struct supe
|
@@ -205,7 +205,7 @@ static int validate_geometry(struct supertype *st, int level,
|
||||||
int *chunk, unsigned long long size,
|
int *chunk, unsigned long long size,
|
||||||
unsigned long long data_offset,
|
unsigned long long data_offset,
|
||||||
char *subdev, unsigned long long *freesize,
|
char *subdev, unsigned long long *freesize,
|
||||||
@ -406,9 +477,11 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
{
|
{
|
||||||
pr_err("gpt metadata cannot be used this way\n");
|
pr_err("gpt metadata cannot be used this way\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
diff --git a/super-intel.c b/super-intel.c
|
||||||
|
index e1618f1..5d0f131 100644
|
||||||
--- a/super-intel.c
|
--- a/super-intel.c
|
||||||
+++ b/super-intel.c
|
+++ b/super-intel.c
|
||||||
@@ -5154,7 +5154,7 @@ static int check_name(struct intel_super
|
@@ -5155,7 +5155,7 @@ static int check_name(struct intel_super *super, char *name, int quiet)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info,
|
static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info,
|
||||||
@ -417,7 +490,7 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
char *homehost, int *uuid,
|
char *homehost, int *uuid,
|
||||||
long long data_offset)
|
long long data_offset)
|
||||||
{
|
{
|
||||||
@@ -5249,7 +5249,7 @@ static int init_super_imsm_volume(struct
|
@@ -5250,7 +5250,7 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info,
|
||||||
strncpy((char *) dev->volume, name, MAX_RAID_SERIAL_LEN);
|
strncpy((char *) dev->volume, name, MAX_RAID_SERIAL_LEN);
|
||||||
array_blocks = calc_array_size(info->level, info->raid_disks,
|
array_blocks = calc_array_size(info->level, info->raid_disks,
|
||||||
info->layout, info->chunk_size,
|
info->layout, info->chunk_size,
|
||||||
@ -426,7 +499,7 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
/* round array size down to closest MB */
|
/* round array size down to closest MB */
|
||||||
array_blocks = (array_blocks >> SECT_PER_MB_SHIFT) << SECT_PER_MB_SHIFT;
|
array_blocks = (array_blocks >> SECT_PER_MB_SHIFT) << SECT_PER_MB_SHIFT;
|
||||||
|
|
||||||
@@ -5263,7 +5263,7 @@ static int init_super_imsm_volume(struct
|
@@ -5264,7 +5264,7 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info,
|
||||||
vol->curr_migr_unit = 0;
|
vol->curr_migr_unit = 0;
|
||||||
map = get_imsm_map(dev, MAP_0);
|
map = get_imsm_map(dev, MAP_0);
|
||||||
set_pba_of_lba0(map, super->create_offset);
|
set_pba_of_lba0(map, super->create_offset);
|
||||||
@ -435,7 +508,7 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
map->blocks_per_strip = __cpu_to_le16(info_to_blocks_per_strip(info));
|
map->blocks_per_strip = __cpu_to_le16(info_to_blocks_per_strip(info));
|
||||||
map->failed_disk_num = ~0;
|
map->failed_disk_num = ~0;
|
||||||
if (info->level > 0)
|
if (info->level > 0)
|
||||||
@@ -5291,7 +5291,7 @@ static int init_super_imsm_volume(struct
|
@@ -5292,7 +5292,7 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info,
|
||||||
map->num_domains = 1;
|
map->num_domains = 1;
|
||||||
|
|
||||||
/* info->size is only int so use the 'size' parameter instead */
|
/* info->size is only int so use the 'size' parameter instead */
|
||||||
@ -444,7 +517,7 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
num_data_stripes /= map->num_domains;
|
num_data_stripes /= map->num_domains;
|
||||||
set_num_data_stripes(map, num_data_stripes);
|
set_num_data_stripes(map, num_data_stripes);
|
||||||
|
|
||||||
@@ -5313,7 +5313,7 @@ static int init_super_imsm_volume(struct
|
@@ -5314,7 +5314,7 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int init_super_imsm(struct supertype *st, mdu_array_info_t *info,
|
static int init_super_imsm(struct supertype *st, mdu_array_info_t *info,
|
||||||
@ -453,7 +526,7 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
char *homehost, int *uuid,
|
char *homehost, int *uuid,
|
||||||
unsigned long long data_offset)
|
unsigned long long data_offset)
|
||||||
{
|
{
|
||||||
@@ -5336,7 +5336,7 @@ static int init_super_imsm(struct supert
|
@@ -5337,7 +5337,7 @@ static int init_super_imsm(struct supertype *st, mdu_array_info_t *info,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (st->sb)
|
if (st->sb)
|
||||||
@ -462,7 +535,7 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
data_offset);
|
data_offset);
|
||||||
|
|
||||||
if (info)
|
if (info)
|
||||||
@@ -6913,7 +6913,7 @@ static int validate_geometry_imsm(struct
|
@@ -6914,7 +6914,7 @@ static int validate_geometry_imsm(struct supertype *st, int level, int layout,
|
||||||
int raiddisks, int *chunk, unsigned long long size,
|
int raiddisks, int *chunk, unsigned long long size,
|
||||||
unsigned long long data_offset,
|
unsigned long long data_offset,
|
||||||
char *dev, unsigned long long *freesize,
|
char *dev, unsigned long long *freesize,
|
||||||
@ -471,7 +544,7 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
{
|
{
|
||||||
int fd, cfd;
|
int fd, cfd;
|
||||||
struct mdinfo *sra;
|
struct mdinfo *sra;
|
||||||
@@ -10950,7 +10950,7 @@ enum imsm_reshape_type imsm_analyze_chan
|
@@ -10953,7 +10953,7 @@ enum imsm_reshape_type imsm_analyze_change(struct supertype *st,
|
||||||
geo->raid_disks + devNumChange,
|
geo->raid_disks + devNumChange,
|
||||||
&chunk,
|
&chunk,
|
||||||
geo->size, INVALID_SECTORS,
|
geo->size, INVALID_SECTORS,
|
||||||
@ -480,9 +553,11 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
change = -1;
|
change = -1;
|
||||||
|
|
||||||
if (check_devs) {
|
if (check_devs) {
|
||||||
|
diff --git a/super-mbr.c b/super-mbr.c
|
||||||
|
index f5e4cea..1bbe57a 100644
|
||||||
--- a/super-mbr.c
|
--- a/super-mbr.c
|
||||||
+++ b/super-mbr.c
|
+++ b/super-mbr.c
|
||||||
@@ -193,7 +193,7 @@ static int validate_geometry(struct supe
|
@@ -193,7 +193,7 @@ static int validate_geometry(struct supertype *st, int level,
|
||||||
int *chunk, unsigned long long size,
|
int *chunk, unsigned long long size,
|
||||||
unsigned long long data_offset,
|
unsigned long long data_offset,
|
||||||
char *subdev, unsigned long long *freesize,
|
char *subdev, unsigned long long *freesize,
|
||||||
@ -491,9 +566,11 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
{
|
{
|
||||||
pr_err("mbr metadata cannot be used this way\n");
|
pr_err("mbr metadata cannot be used this way\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
diff --git a/super0.c b/super0.c
|
||||||
|
index f5b4507..7a555e3 100644
|
||||||
--- a/super0.c
|
--- a/super0.c
|
||||||
+++ b/super0.c
|
+++ b/super0.c
|
||||||
@@ -725,7 +725,7 @@ static int update_super0(struct supertyp
|
@@ -725,7 +725,7 @@ static int update_super0(struct supertype *st, struct mdinfo *info,
|
||||||
* We use the first 8 bytes (64bits) of the sha1 of the host name
|
* We use the first 8 bytes (64bits) of the sha1 of the host name
|
||||||
*/
|
*/
|
||||||
static int init_super0(struct supertype *st, mdu_array_info_t *info,
|
static int init_super0(struct supertype *st, mdu_array_info_t *info,
|
||||||
@ -502,7 +579,7 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
char *homehost, int *uuid,
|
char *homehost, int *uuid,
|
||||||
unsigned long long data_offset)
|
unsigned long long data_offset)
|
||||||
{
|
{
|
||||||
@@ -764,8 +764,8 @@ static int init_super0(struct supertype
|
@@ -764,8 +764,8 @@ static int init_super0(struct supertype *st, mdu_array_info_t *info,
|
||||||
sb->gvalid_words = 0; /* ignored */
|
sb->gvalid_words = 0; /* ignored */
|
||||||
sb->ctime = time(0);
|
sb->ctime = time(0);
|
||||||
sb->level = info->level;
|
sb->level = info->level;
|
||||||
@ -513,7 +590,7 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
return 0;
|
return 0;
|
||||||
sb->nr_disks = info->nr_disks;
|
sb->nr_disks = info->nr_disks;
|
||||||
sb->raid_disks = info->raid_disks;
|
sb->raid_disks = info->raid_disks;
|
||||||
@@ -1267,7 +1267,7 @@ static int validate_geometry0(struct sup
|
@@ -1267,7 +1267,7 @@ static int validate_geometry0(struct supertype *st, int level,
|
||||||
int *chunk, unsigned long long size,
|
int *chunk, unsigned long long size,
|
||||||
unsigned long long data_offset,
|
unsigned long long data_offset,
|
||||||
char *subdev, unsigned long long *freesize,
|
char *subdev, unsigned long long *freesize,
|
||||||
@ -522,9 +599,11 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
{
|
{
|
||||||
unsigned long long ldsize;
|
unsigned long long ldsize;
|
||||||
int fd;
|
int fd;
|
||||||
|
diff --git a/super1.c b/super1.c
|
||||||
|
index f3520ac..4a0f041 100644
|
||||||
--- a/super1.c
|
--- a/super1.c
|
||||||
+++ b/super1.c
|
+++ b/super1.c
|
||||||
@@ -1397,7 +1397,7 @@ static int update_super1(struct supertyp
|
@@ -1397,7 +1397,7 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int init_super1(struct supertype *st, mdu_array_info_t *info,
|
static int init_super1(struct supertype *st, mdu_array_info_t *info,
|
||||||
@ -533,7 +612,7 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
int *uuid, unsigned long long data_offset)
|
int *uuid, unsigned long long data_offset)
|
||||||
{
|
{
|
||||||
struct mdp_superblock_1 *sb;
|
struct mdp_superblock_1 *sb;
|
||||||
@@ -1450,7 +1450,7 @@ static int init_super1(struct supertype
|
@@ -1450,7 +1450,7 @@ static int init_super1(struct supertype *st, mdu_array_info_t *info,
|
||||||
sb->ctime = __cpu_to_le64((unsigned long long)time(0));
|
sb->ctime = __cpu_to_le64((unsigned long long)time(0));
|
||||||
sb->level = __cpu_to_le32(info->level);
|
sb->level = __cpu_to_le32(info->level);
|
||||||
sb->layout = __cpu_to_le32(info->layout);
|
sb->layout = __cpu_to_le32(info->layout);
|
||||||
@ -542,7 +621,7 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
sb->chunksize = __cpu_to_le32(info->chunk_size>>9);
|
sb->chunksize = __cpu_to_le32(info->chunk_size>>9);
|
||||||
sb->raid_disks = __cpu_to_le32(info->raid_disks);
|
sb->raid_disks = __cpu_to_le32(info->raid_disks);
|
||||||
|
|
||||||
@@ -2492,7 +2492,7 @@ static int validate_geometry1(struct sup
|
@@ -2487,7 +2487,7 @@ static int validate_geometry1(struct supertype *st, int level,
|
||||||
int *chunk, unsigned long long size,
|
int *chunk, unsigned long long size,
|
||||||
unsigned long long data_offset,
|
unsigned long long data_offset,
|
||||||
char *subdev, unsigned long long *freesize,
|
char *subdev, unsigned long long *freesize,
|
||||||
@ -551,9 +630,11 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
{
|
{
|
||||||
unsigned long long ldsize, devsize;
|
unsigned long long ldsize, devsize;
|
||||||
int bmspace;
|
int bmspace;
|
||||||
|
diff --git a/sysfs.c b/sysfs.c
|
||||||
|
index b0657a0..53589a7 100644
|
||||||
--- a/sysfs.c
|
--- a/sysfs.c
|
||||||
+++ b/sysfs.c
|
+++ b/sysfs.c
|
||||||
@@ -242,6 +242,17 @@ struct mdinfo *sysfs_read(int fd, char *
|
@@ -242,6 +242,17 @@ struct mdinfo *sysfs_read(int fd, char *devnm, unsigned long options)
|
||||||
} else
|
} else
|
||||||
sra->sysfs_array_state[0] = 0;
|
sra->sysfs_array_state[0] = 0;
|
||||||
|
|
||||||
@ -571,3 +652,6 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
if (! (options & GET_DEVS))
|
if (! (options & GET_DEVS))
|
||||||
return sra;
|
return sra;
|
||||||
|
|
||||||
|
--
|
||||||
|
2.10.2
|
||||||
|
|
@ -1,13 +1,15 @@
|
|||||||
From 9a224a0f09175cde8ccecae445568bdb4512e2a8 Mon Sep 17 00:00:00 2001
|
From 65884368cd42d79b567f12d3e84adc7009e12d72 Mon Sep 17 00:00:00 2001
|
||||||
From: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
From: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
||||||
Date: Thu, 16 Mar 2017 22:09:44 +0100
|
Date: Wed, 29 Mar 2017 11:54:16 +0200
|
||||||
Subject: [PATCH] Detail: show consistency policy
|
Subject: [PATCH] Detail: show consistency policy
|
||||||
|
References: FATE#321941
|
||||||
|
|
||||||
Show the currently enabled consistency policy in the output from
|
Show the currently enabled consistency policy in the output from
|
||||||
--detail. Add 3 spaces to all existing items in Detail output to align
|
--detail. Add 3 spaces to all existing items in Detail output to align
|
||||||
with "Consistency Policy : ".
|
with "Consistency Policy : ".
|
||||||
|
|
||||||
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
||||||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
---
|
---
|
||||||
Detail.c | 90 +++++++++++++++++++++++++++++++++++------------------------
|
Detail.c | 90 +++++++++++++++++++++++++++++++++++------------------------
|
||||||
super-ddf.c | 6 ++--
|
super-ddf.c | 6 ++--
|
||||||
@ -17,10 +19,10 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
5 files changed, 65 insertions(+), 46 deletions(-)
|
5 files changed, 65 insertions(+), 46 deletions(-)
|
||||||
|
|
||||||
diff --git a/Detail.c b/Detail.c
|
diff --git a/Detail.c b/Detail.c
|
||||||
index 509b0d418768..3067fb6965b7 100644
|
index 3d92855..136875b 100644
|
||||||
--- a/Detail.c
|
--- a/Detail.c
|
||||||
+++ b/Detail.c
|
+++ b/Detail.c
|
||||||
@@ -394,24 +394,25 @@ int Detail(char *dev, struct context *c)
|
@@ -402,24 +402,25 @@ int Detail(char *dev, struct context *c)
|
||||||
printf("%s:\n", dev);
|
printf("%s:\n", dev);
|
||||||
|
|
||||||
if (container)
|
if (container)
|
||||||
@ -52,7 +54,7 @@ index 509b0d418768..3067fb6965b7 100644
|
|||||||
human_size(larray_size));
|
human_size(larray_size));
|
||||||
if (array.level >= 1) {
|
if (array.level >= 1) {
|
||||||
if (sra)
|
if (sra)
|
||||||
@@ -420,38 +421,38 @@ int Detail(char *dev, struct context *c)
|
@@ -428,38 +429,38 @@ int Detail(char *dev, struct context *c)
|
||||||
(larray_size >= 0xFFFFFFFFULL|| array.size == 0)) {
|
(larray_size >= 0xFFFFFFFFULL|| array.size == 0)) {
|
||||||
unsigned long long dsize = get_component_size(fd);
|
unsigned long long dsize = get_component_size(fd);
|
||||||
if (dsize > 0)
|
if (dsize > 0)
|
||||||
@ -101,7 +103,7 @@ index 509b0d418768..3067fb6965b7 100644
|
|||||||
if (array.raid_disks) {
|
if (array.raid_disks) {
|
||||||
static char *sync_action[] = {
|
static char *sync_action[] = {
|
||||||
", recovering", ", resyncing",
|
", recovering", ", resyncing",
|
||||||
@@ -465,7 +466,7 @@ int Detail(char *dev, struct context *c)
|
@@ -473,7 +474,7 @@ int Detail(char *dev, struct context *c)
|
||||||
else
|
else
|
||||||
st = ", degraded";
|
st = ", degraded";
|
||||||
|
|
||||||
@ -110,7 +112,7 @@ index 509b0d418768..3067fb6965b7 100644
|
|||||||
(array.state&(1<<MD_SB_CLEAN))?"clean":"active", st,
|
(array.state&(1<<MD_SB_CLEAN))?"clean":"active", st,
|
||||||
(!e || (e->percent < 0 && e->percent != RESYNC_PENDING &&
|
(!e || (e->percent < 0 && e->percent != RESYNC_PENDING &&
|
||||||
e->percent != RESYNC_DELAYED)) ? "" : sync_action[e->resync],
|
e->percent != RESYNC_DELAYED)) ? "" : sync_action[e->resync],
|
||||||
@@ -473,27 +474,27 @@ int Detail(char *dev, struct context *c)
|
@@ -481,27 +482,27 @@ int Detail(char *dev, struct context *c)
|
||||||
(e && e->percent == RESYNC_DELAYED) ? " (DELAYED)": "",
|
(e && e->percent == RESYNC_DELAYED) ? " (DELAYED)": "",
|
||||||
(e && e->percent == RESYNC_PENDING) ? " (PENDING)": "");
|
(e && e->percent == RESYNC_PENDING) ? " (PENDING)": "");
|
||||||
} else if (inactive) {
|
} else if (inactive) {
|
||||||
@ -146,7 +148,7 @@ index 509b0d418768..3067fb6965b7 100644
|
|||||||
print_r10_layout(array.layout);
|
print_r10_layout(array.layout);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
@@ -504,20 +505,35 @@ int Detail(char *dev, struct context *c)
|
@@ -512,20 +513,35 @@ int Detail(char *dev, struct context *c)
|
||||||
case 10:
|
case 10:
|
||||||
case 6:
|
case 6:
|
||||||
if (array.chunk_size)
|
if (array.chunk_size)
|
||||||
@ -185,7 +187,7 @@ index 509b0d418768..3067fb6965b7 100644
|
|||||||
is_rebuilding = 1;
|
is_rebuilding = 1;
|
||||||
}
|
}
|
||||||
free_mdstat(ms);
|
free_mdstat(ms);
|
||||||
@@ -525,39 +541,41 @@ int Detail(char *dev, struct context *c)
|
@@ -533,39 +549,41 @@ int Detail(char *dev, struct context *c)
|
||||||
if ((st && st->sb) && (info && info->reshape_active)) {
|
if ((st && st->sb) && (info && info->reshape_active)) {
|
||||||
#if 0
|
#if 0
|
||||||
This is pretty boring
|
This is pretty boring
|
||||||
@ -234,7 +236,7 @@ index 509b0d418768..3067fb6965b7 100644
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
} else if (e && e->percent >= 0)
|
} else if (e && e->percent >= 0)
|
||||||
printf("\n");
|
printf("\n");
|
||||||
@@ -572,7 +590,7 @@ This is pretty boring
|
@@ -580,7 +598,7 @@ This is pretty boring
|
||||||
DIR *dir = opendir("/sys/block");
|
DIR *dir = opendir("/sys/block");
|
||||||
struct dirent *de;
|
struct dirent *de;
|
||||||
|
|
||||||
@ -242,9 +244,9 @@ index 509b0d418768..3067fb6965b7 100644
|
|||||||
+ printf(" Member Arrays :");
|
+ printf(" Member Arrays :");
|
||||||
|
|
||||||
while (dir && (de = readdir(dir)) != NULL) {
|
while (dir && (de = readdir(dir)) != NULL) {
|
||||||
char path[200];
|
char path[287];
|
||||||
diff --git a/super-ddf.c b/super-ddf.c
|
diff --git a/super-ddf.c b/super-ddf.c
|
||||||
index cdd16a47aab3..c6037c1cca40 100644
|
index cdd16a4..c6037c1 100644
|
||||||
--- a/super-ddf.c
|
--- a/super-ddf.c
|
||||||
+++ b/super-ddf.c
|
+++ b/super-ddf.c
|
||||||
@@ -1742,10 +1742,10 @@ static void detail_super_ddf(struct supertype *st, char *homehost)
|
@@ -1742,10 +1742,10 @@ static void detail_super_ddf(struct supertype *st, char *homehost)
|
||||||
@ -262,10 +264,10 @@ index cdd16a47aab3..c6037c1cca40 100644
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
diff --git a/super-intel.c b/super-intel.c
|
diff --git a/super-intel.c b/super-intel.c
|
||||||
index 6d16a1919444..120ce77c0d3d 100644
|
index 5d0f131..2d92c8e 100644
|
||||||
--- a/super-intel.c
|
--- a/super-intel.c
|
||||||
+++ b/super-intel.c
|
+++ b/super-intel.c
|
||||||
@@ -1986,7 +1986,7 @@ static void detail_super_imsm(struct supertype *st, char *homehost)
|
@@ -1987,7 +1987,7 @@ static void detail_super_imsm(struct supertype *st, char *homehost)
|
||||||
|
|
||||||
getinfo_super_imsm(st, &info, NULL);
|
getinfo_super_imsm(st, &info, NULL);
|
||||||
fname_from_uuid(st, &info, nbuf, ':');
|
fname_from_uuid(st, &info, nbuf, ':');
|
||||||
@ -275,7 +277,7 @@ index 6d16a1919444..120ce77c0d3d 100644
|
|||||||
|
|
||||||
static void brief_detail_super_imsm(struct supertype *st)
|
static void brief_detail_super_imsm(struct supertype *st)
|
||||||
diff --git a/super0.c b/super0.c
|
diff --git a/super0.c b/super0.c
|
||||||
index 0fec96b7cd81..b2cdaec5fc90 100644
|
index 7a555e3..10d9c40 100644
|
||||||
--- a/super0.c
|
--- a/super0.c
|
||||||
+++ b/super0.c
|
+++ b/super0.c
|
||||||
@@ -353,7 +353,7 @@ err:
|
@@ -353,7 +353,7 @@ err:
|
||||||
@ -297,7 +299,7 @@ index 0fec96b7cd81..b2cdaec5fc90 100644
|
|||||||
|
|
||||||
static void brief_detail_super0(struct supertype *st)
|
static void brief_detail_super0(struct supertype *st)
|
||||||
diff --git a/super1.c b/super1.c
|
diff --git a/super1.c b/super1.c
|
||||||
index fa2383295bd4..672cdde690b4 100644
|
index 4a0f041..8df17a1 100644
|
||||||
--- a/super1.c
|
--- a/super1.c
|
||||||
+++ b/super1.c
|
+++ b/super1.c
|
||||||
@@ -780,19 +780,20 @@ static void detail_super1(struct supertype *st, char *homehost)
|
@@ -780,19 +780,20 @@ static void detail_super1(struct supertype *st, char *homehost)
|
||||||
@ -326,5 +328,5 @@ index fa2383295bd4..672cdde690b4 100644
|
|||||||
|
|
||||||
static void brief_detail_super1(struct supertype *st)
|
static void brief_detail_super1(struct supertype *st)
|
||||||
--
|
--
|
||||||
2.12.0
|
2.10.2
|
||||||
|
|
@ -1,7 +1,9 @@
|
|||||||
From dd3ce3b14b171ad049193053f7d6d2d126687fdc Mon Sep 17 00:00:00 2001
|
From 2432ce9b3235f34d00ef6c28ef6b624a32b85530 Mon Sep 17 00:00:00 2001
|
||||||
From: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
From: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
||||||
Date: Thu, 16 Mar 2017 22:09:45 +0100
|
Date: Wed, 29 Mar 2017 11:54:17 +0200
|
||||||
Subject: [PATCH] imsm: PPL support
|
Subject: [PATCH] imsm: PPL support
|
||||||
|
References: FATE#321941
|
||||||
|
|
||||||
|
|
||||||
Enable creating and assembling IMSM raid5 arrays with PPL. Update the
|
Enable creating and assembling IMSM raid5 arrays with PPL. Update the
|
||||||
IMSM metadata format to include new fields used for PPL.
|
IMSM metadata format to include new fields used for PPL.
|
||||||
@ -18,6 +20,7 @@ attributes 'ppl_sector' and 'ppl_size'. Enable PPL in the kernel by
|
|||||||
writing to 'consistency_policy' before the array is activated.
|
writing to 'consistency_policy' before the array is activated.
|
||||||
|
|
||||||
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
||||||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
---
|
---
|
||||||
Assemble.c | 49 +++++++++++
|
Assemble.c | 49 +++++++++++
|
||||||
Makefile | 5 +-
|
Makefile | 5 +-
|
||||||
@ -28,7 +31,7 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
6 files changed, 349 insertions(+), 24 deletions(-)
|
6 files changed, 349 insertions(+), 24 deletions(-)
|
||||||
|
|
||||||
diff --git a/Assemble.c b/Assemble.c
|
diff --git a/Assemble.c b/Assemble.c
|
||||||
index 3da090330019..8e55b49fa406 100644
|
index 3da0903..8e55b49 100644
|
||||||
--- a/Assemble.c
|
--- a/Assemble.c
|
||||||
+++ b/Assemble.c
|
+++ b/Assemble.c
|
||||||
@@ -1942,6 +1942,55 @@ int assemble_container_content(struct supertype *st, int mdfd,
|
@@ -1942,6 +1942,55 @@ int assemble_container_content(struct supertype *st, int mdfd,
|
||||||
@ -88,10 +91,10 @@ index 3da090330019..8e55b49fa406 100644
|
|||||||
content->array.layout, content->array.state & 1, avail) == 0) {
|
content->array.layout, content->array.state & 1, avail) == 0) {
|
||||||
if (c->export && result)
|
if (c->export && result)
|
||||||
diff --git a/Makefile b/Makefile
|
diff --git a/Makefile b/Makefile
|
||||||
index a6f464c31626..0d796d5c63c4 100644
|
index d1a6ac4..5ff6cc0 100644
|
||||||
--- a/Makefile
|
--- a/Makefile
|
||||||
+++ b/Makefile
|
+++ b/Makefile
|
||||||
@@ -146,7 +146,7 @@ MON_OBJS = mdmon.o monitor.o managemon.o util.o maps.o mdstat.o sysfs.o \
|
@@ -151,7 +151,7 @@ MON_OBJS = mdmon.o monitor.o managemon.o util.o maps.o mdstat.o sysfs.o \
|
||||||
Kill.o sg_io.o dlink.o ReadMe.o super-intel.o \
|
Kill.o sg_io.o dlink.o ReadMe.o super-intel.o \
|
||||||
super-mbr.o super-gpt.o \
|
super-mbr.o super-gpt.o \
|
||||||
super-ddf.o sha1.o crc32.o msg.o bitmap.o xmalloc.o \
|
super-ddf.o sha1.o crc32.o msg.o bitmap.o xmalloc.o \
|
||||||
@ -100,7 +103,7 @@ index a6f464c31626..0d796d5c63c4 100644
|
|||||||
|
|
||||||
MON_SRCS = $(patsubst %.o,%.c,$(MON_OBJS))
|
MON_SRCS = $(patsubst %.o,%.c,$(MON_OBJS))
|
||||||
|
|
||||||
@@ -156,7 +156,8 @@ STATICOBJS = pwgr.o
|
@@ -161,7 +161,8 @@ STATICOBJS = pwgr.o
|
||||||
ASSEMBLE_SRCS := mdassemble.c Assemble.c Manage.c config.c policy.c dlink.c util.c \
|
ASSEMBLE_SRCS := mdassemble.c Assemble.c Manage.c config.c policy.c dlink.c util.c \
|
||||||
maps.c lib.c xmalloc.c \
|
maps.c lib.c xmalloc.c \
|
||||||
super0.c super1.c super-ddf.c super-intel.c sha1.c crc32.c sg_io.c mdstat.c \
|
super0.c super1.c super-ddf.c super-intel.c sha1.c crc32.c sg_io.c mdstat.c \
|
||||||
@ -111,7 +114,7 @@ index a6f464c31626..0d796d5c63c4 100644
|
|||||||
ASSEMBLE_FLAGS:= $(CFLAGS) -DMDASSEMBLE
|
ASSEMBLE_FLAGS:= $(CFLAGS) -DMDASSEMBLE
|
||||||
ifdef MDASSEMBLE_AUTO
|
ifdef MDASSEMBLE_AUTO
|
||||||
diff --git a/md_p.h b/md_p.h
|
diff --git a/md_p.h b/md_p.h
|
||||||
index dc9fec165cb6..358a28ce3fcf 100644
|
index dc9fec1..358a28c 100644
|
||||||
--- a/md_p.h
|
--- a/md_p.h
|
||||||
+++ b/md_p.h
|
+++ b/md_p.h
|
||||||
@@ -267,4 +267,29 @@ struct r5l_meta_block {
|
@@ -267,4 +267,29 @@ struct r5l_meta_block {
|
||||||
@ -145,7 +148,7 @@ index dc9fec165cb6..358a28ce3fcf 100644
|
|||||||
+
|
+
|
||||||
#endif
|
#endif
|
||||||
diff --git a/mdadm.h b/mdadm.h
|
diff --git a/mdadm.h b/mdadm.h
|
||||||
index ed4d7e4e65ae..10c204160351 100644
|
index b52d4d3..d222cc3 100644
|
||||||
--- a/mdadm.h
|
--- a/mdadm.h
|
||||||
+++ b/mdadm.h
|
+++ b/mdadm.h
|
||||||
@@ -300,6 +300,8 @@ struct mdinfo {
|
@@ -300,6 +300,8 @@ struct mdinfo {
|
||||||
@ -169,7 +172,7 @@ index ed4d7e4e65ae..10c204160351 100644
|
|||||||
int (*record_bad_block)(struct active_array *a, int n,
|
int (*record_bad_block)(struct active_array *a, int n,
|
||||||
unsigned long long sector, int length);
|
unsigned long long sector, int length);
|
||||||
diff --git a/super-intel.c b/super-intel.c
|
diff --git a/super-intel.c b/super-intel.c
|
||||||
index 120ce77c0d3d..ad3a45369534 100644
|
index 2d92c8e..87fec8b 100644
|
||||||
--- a/super-intel.c
|
--- a/super-intel.c
|
||||||
+++ b/super-intel.c
|
+++ b/super-intel.c
|
||||||
@@ -102,6 +102,7 @@ struct imsm_disk {
|
@@ -102,6 +102,7 @@ struct imsm_disk {
|
||||||
@ -271,7 +274,7 @@ index 120ce77c0d3d..ad3a45369534 100644
|
|||||||
printf(" Id : %08x\n", __le32_to_cpu(disk->scsi_id));
|
printf(" Id : %08x\n", __le32_to_cpu(disk->scsi_id));
|
||||||
sz = total_blocks(disk) - reserved;
|
sz = total_blocks(disk) - reserved;
|
||||||
printf(" Usable Size : %llu%s\n",
|
printf(" Usable Size : %llu%s\n",
|
||||||
@@ -3113,6 +3153,15 @@ static unsigned long long imsm_component_size_aligment_check(int level,
|
@@ -3114,6 +3154,15 @@ static unsigned long long imsm_component_size_aligment_check(int level,
|
||||||
return component_size;
|
return component_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -287,7 +290,7 @@ index 120ce77c0d3d..ad3a45369534 100644
|
|||||||
static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info, char *dmap)
|
static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info, char *dmap)
|
||||||
{
|
{
|
||||||
struct intel_super *super = st->sb;
|
struct intel_super *super = st->sb;
|
||||||
@@ -3139,7 +3188,7 @@ static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info,
|
@@ -3140,7 +3189,7 @@ static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info,
|
||||||
info->array.utime = 0;
|
info->array.utime = 0;
|
||||||
info->array.chunk_size =
|
info->array.chunk_size =
|
||||||
__le16_to_cpu(map_to_analyse->blocks_per_strip) << 9;
|
__le16_to_cpu(map_to_analyse->blocks_per_strip) << 9;
|
||||||
@ -296,7 +299,7 @@ index 120ce77c0d3d..ad3a45369534 100644
|
|||||||
info->custom_array_size = __le32_to_cpu(dev->size_high);
|
info->custom_array_size = __le32_to_cpu(dev->size_high);
|
||||||
info->custom_array_size <<= 32;
|
info->custom_array_size <<= 32;
|
||||||
info->custom_array_size |= __le32_to_cpu(dev->size_low);
|
info->custom_array_size |= __le32_to_cpu(dev->size_low);
|
||||||
@@ -3220,10 +3269,20 @@ static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info,
|
@@ -3221,10 +3270,20 @@ static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info,
|
||||||
memset(info->uuid, 0, sizeof(info->uuid));
|
memset(info->uuid, 0, sizeof(info->uuid));
|
||||||
info->recovery_start = MaxSector;
|
info->recovery_start = MaxSector;
|
||||||
|
|
||||||
@ -318,7 +321,7 @@ index 120ce77c0d3d..ad3a45369534 100644
|
|||||||
imsm_reshape_blocks_arrays_changes(super) == 0) {
|
imsm_reshape_blocks_arrays_changes(super) == 0) {
|
||||||
info->resync_start = 0;
|
info->resync_start = 0;
|
||||||
}
|
}
|
||||||
@@ -3450,7 +3509,8 @@ static void getinfo_super_imsm(struct supertype *st, struct mdinfo *info, char *
|
@@ -3451,7 +3510,8 @@ static void getinfo_super_imsm(struct supertype *st, struct mdinfo *info, char *
|
||||||
* found the 'most fresh' version of the metadata
|
* found the 'most fresh' version of the metadata
|
||||||
*/
|
*/
|
||||||
info->disk.state |= is_failed(disk) ? (1 << MD_DISK_FAULTY) : 0;
|
info->disk.state |= is_failed(disk) ? (1 << MD_DISK_FAULTY) : 0;
|
||||||
@ -328,7 +331,7 @@ index 120ce77c0d3d..ad3a45369534 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* only call uuid_from_super_imsm when this disk is part of a populated container,
|
/* only call uuid_from_super_imsm when this disk is part of a populated container,
|
||||||
@@ -3905,7 +3965,7 @@ load_imsm_disk(int fd, struct intel_super *super, char *devname, int keep_fd)
|
@@ -3906,7 +3966,7 @@ load_imsm_disk(int fd, struct intel_super *super, char *devname, int keep_fd)
|
||||||
*/
|
*/
|
||||||
if (is_failed(&dl->disk))
|
if (is_failed(&dl->disk))
|
||||||
dl->index = -2;
|
dl->index = -2;
|
||||||
@ -337,7 +340,7 @@ index 120ce77c0d3d..ad3a45369534 100644
|
|||||||
dl->index = -1;
|
dl->index = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5302,6 +5362,20 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info,
|
@@ -5303,6 +5363,20 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info,
|
||||||
}
|
}
|
||||||
mpb->num_raid_devs++;
|
mpb->num_raid_devs++;
|
||||||
|
|
||||||
@ -358,7 +361,7 @@ index 120ce77c0d3d..ad3a45369534 100644
|
|||||||
dv->dev = dev;
|
dv->dev = dev;
|
||||||
dv->index = super->current_vol;
|
dv->index = super->current_vol;
|
||||||
dv->next = super->devlist;
|
dv->next = super->devlist;
|
||||||
@@ -5926,11 +6000,146 @@ static int mgmt_disk(struct supertype *st)
|
@@ -5927,11 +6001,146 @@ static int mgmt_disk(struct supertype *st)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -505,7 +508,7 @@ index 120ce77c0d3d..ad3a45369534 100644
|
|||||||
|
|
||||||
/* we are done with current_vol reset it to point st at the container */
|
/* we are done with current_vol reset it to point st at the container */
|
||||||
super->current_vol = -1;
|
super->current_vol = -1;
|
||||||
@@ -5938,24 +6147,29 @@ static int write_init_super_imsm(struct supertype *st)
|
@@ -5939,24 +6148,29 @@ static int write_init_super_imsm(struct supertype *st)
|
||||||
if (st->update_tail) {
|
if (st->update_tail) {
|
||||||
/* queue the recently created array / added disk
|
/* queue the recently created array / added disk
|
||||||
* as a metadata update */
|
* as a metadata update */
|
||||||
@ -542,7 +545,7 @@ index 120ce77c0d3d..ad3a45369534 100644
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -7372,7 +7586,8 @@ static struct mdinfo *container_content_imsm(struct supertype *st, char *subarra
|
@@ -7375,7 +7589,8 @@ static struct mdinfo *container_content_imsm(struct supertype *st, char *subarra
|
||||||
*
|
*
|
||||||
* FIXME handle dirty degraded
|
* FIXME handle dirty degraded
|
||||||
*/
|
*/
|
||||||
@ -552,7 +555,7 @@ index 120ce77c0d3d..ad3a45369534 100644
|
|||||||
this->resync_start = MaxSector;
|
this->resync_start = MaxSector;
|
||||||
if (skip)
|
if (skip)
|
||||||
continue;
|
continue;
|
||||||
@@ -7407,9 +7622,12 @@ static struct mdinfo *container_content_imsm(struct supertype *st, char *subarra
|
@@ -7410,9 +7625,12 @@ static struct mdinfo *container_content_imsm(struct supertype *st, char *subarra
|
||||||
info_d->component_size =
|
info_d->component_size =
|
||||||
num_data_stripes(map) *
|
num_data_stripes(map) *
|
||||||
map->blocks_per_strip;
|
map->blocks_per_strip;
|
||||||
@ -565,7 +568,7 @@ index 120ce77c0d3d..ad3a45369534 100644
|
|||||||
|
|
||||||
info_d->bb.supported = 1;
|
info_d->bb.supported = 1;
|
||||||
get_volume_badblocks(super->bbm_log, ord_to_idx(ord),
|
get_volume_badblocks(super->bbm_log, ord_to_idx(ord),
|
||||||
@@ -7925,12 +8143,16 @@ mark_checkpoint:
|
@@ -7928,12 +8146,16 @@ mark_checkpoint:
|
||||||
|
|
||||||
skip_mark_checkpoint:
|
skip_mark_checkpoint:
|
||||||
/* mark dirty / clean */
|
/* mark dirty / clean */
|
||||||
@ -587,7 +590,7 @@ index 120ce77c0d3d..ad3a45369534 100644
|
|||||||
super->updates_pending++;
|
super->updates_pending++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8442,6 +8664,11 @@ static struct mdinfo *imsm_activate_spare(struct active_array *a,
|
@@ -8445,6 +8667,11 @@ static struct mdinfo *imsm_activate_spare(struct active_array *a,
|
||||||
di->component_size = a->info.component_size;
|
di->component_size = a->info.component_size;
|
||||||
di->container_member = inst;
|
di->container_member = inst;
|
||||||
di->bb.supported = 1;
|
di->bb.supported = 1;
|
||||||
@ -599,7 +602,7 @@ index 120ce77c0d3d..ad3a45369534 100644
|
|||||||
super->random = random32();
|
super->random = random32();
|
||||||
di->next = rv;
|
di->next = rv;
|
||||||
rv = di;
|
rv = di;
|
||||||
@@ -11597,6 +11824,9 @@ struct superswitch super_imsm = {
|
@@ -11600,6 +11827,9 @@ struct superswitch super_imsm = {
|
||||||
.container_content = container_content_imsm,
|
.container_content = container_content_imsm,
|
||||||
.validate_container = validate_container_imsm,
|
.validate_container = validate_container_imsm,
|
||||||
|
|
||||||
@ -610,7 +613,7 @@ index 120ce77c0d3d..ad3a45369534 100644
|
|||||||
.name = "imsm",
|
.name = "imsm",
|
||||||
|
|
||||||
diff --git a/sysfs.c b/sysfs.c
|
diff --git a/sysfs.c b/sysfs.c
|
||||||
index 53589a76f094..2a91ba0a90cf 100644
|
index 53589a7..2a91ba0 100644
|
||||||
--- a/sysfs.c
|
--- a/sysfs.c
|
||||||
+++ b/sysfs.c
|
+++ b/sysfs.c
|
||||||
@@ -689,6 +689,16 @@ int sysfs_set_array(struct mdinfo *info, int vers)
|
@@ -689,6 +689,16 @@ int sysfs_set_array(struct mdinfo *info, int vers)
|
||||||
@ -642,5 +645,5 @@ index 53589a76f094..2a91ba0a90cf 100644
|
|||||||
/* This can correctly fail if array isn't started,
|
/* This can correctly fail if array isn't started,
|
||||||
* yet, so just ignore status for now.
|
* yet, so just ignore status for now.
|
||||||
--
|
--
|
||||||
2.12.0
|
2.10.2
|
||||||
|
|
@ -1,7 +1,8 @@
|
|||||||
From 35753b5ec92fd1d80c22b91aee4b61ed69691986 Mon Sep 17 00:00:00 2001
|
From e97a7cd011345e5dead736de51b33968da49d876 Mon Sep 17 00:00:00 2001
|
||||||
From: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
From: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
||||||
Date: Thu, 16 Mar 2017 22:09:46 +0100
|
Date: Wed, 29 Mar 2017 11:54:18 +0200
|
||||||
Subject: [PATCH] super1: PPL support
|
Subject: [PATCH] super1: PPL support
|
||||||
|
References: FATE#321941
|
||||||
|
|
||||||
Enable creating and assembling raid5 arrays with PPL for 1.x metadata.
|
Enable creating and assembling raid5 arrays with PPL for 1.x metadata.
|
||||||
|
|
||||||
@ -15,6 +16,7 @@ While at it, fix two endianness issues in write_empty_r5l_meta_block()
|
|||||||
and write_init_super1().
|
and write_init_super1().
|
||||||
|
|
||||||
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
||||||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
---
|
---
|
||||||
Assemble.c | 3 ++
|
Assemble.c | 3 ++
|
||||||
Create.c | 2 +
|
Create.c | 2 +
|
||||||
@ -25,7 +27,7 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
6 files changed, 155 insertions(+), 19 deletions(-)
|
6 files changed, 155 insertions(+), 19 deletions(-)
|
||||||
|
|
||||||
diff --git a/Assemble.c b/Assemble.c
|
diff --git a/Assemble.c b/Assemble.c
|
||||||
index 8e55b49fa406..c09842016c0a 100644
|
index 8e55b49..c098420 100644
|
||||||
--- a/Assemble.c
|
--- a/Assemble.c
|
||||||
+++ b/Assemble.c
|
+++ b/Assemble.c
|
||||||
@@ -962,6 +962,9 @@ static int start_array(int mdfd,
|
@@ -962,6 +962,9 @@ static int start_array(int mdfd,
|
||||||
@ -39,7 +41,7 @@ index 8e55b49fa406..c09842016c0a 100644
|
|||||||
if (rv && !err_ok) {
|
if (rv && !err_ok) {
|
||||||
pr_err("failed to set array info for %s: %s\n",
|
pr_err("failed to set array info for %s: %s\n",
|
||||||
diff --git a/Create.c b/Create.c
|
diff --git a/Create.c b/Create.c
|
||||||
index 4080bf69f05b..10e7d108956d 100644
|
index 4080bf6..10e7d10 100644
|
||||||
--- a/Create.c
|
--- a/Create.c
|
||||||
+++ b/Create.c
|
+++ b/Create.c
|
||||||
@@ -524,6 +524,8 @@ int Create(struct supertype *st, char *mddev,
|
@@ -524,6 +524,8 @@ int Create(struct supertype *st, char *mddev,
|
||||||
@ -52,7 +54,7 @@ index 4080bf69f05b..10e7d108956d 100644
|
|||||||
if (c->verbose > 0)
|
if (c->verbose > 0)
|
||||||
pr_err("automatically enabling write-intent bitmap on large array\n");
|
pr_err("automatically enabling write-intent bitmap on large array\n");
|
||||||
diff --git a/Grow.c b/Grow.c
|
diff --git a/Grow.c b/Grow.c
|
||||||
index 455c5f90bf58..e4351d7f952a 100755
|
index e22661c..a849012 100755
|
||||||
--- a/Grow.c
|
--- a/Grow.c
|
||||||
+++ b/Grow.c
|
+++ b/Grow.c
|
||||||
@@ -290,6 +290,7 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s)
|
@@ -290,6 +290,7 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s)
|
||||||
@ -97,7 +99,7 @@ index 455c5f90bf58..e4351d7f952a 100755
|
|||||||
if (strcmp(s->bitmap_file, "clustered") == 0)
|
if (strcmp(s->bitmap_file, "clustered") == 0)
|
||||||
array.state |= (1 << MD_SB_CLUSTERED);
|
array.state |= (1 << MD_SB_CLUSTERED);
|
||||||
diff --git a/Incremental.c b/Incremental.c
|
diff --git a/Incremental.c b/Incremental.c
|
||||||
index 0f507bb32c9e..81afc7ec36ae 100644
|
index 0f507bb..81afc7e 100644
|
||||||
--- a/Incremental.c
|
--- a/Incremental.c
|
||||||
+++ b/Incremental.c
|
+++ b/Incremental.c
|
||||||
@@ -528,6 +528,9 @@ int Incremental(struct mddev_dev *devlist, struct context *c,
|
@@ -528,6 +528,9 @@ int Incremental(struct mddev_dev *devlist, struct context *c,
|
||||||
@ -111,7 +113,7 @@ index 0f507bb32c9e..81afc7ec36ae 100644
|
|||||||
info.array.layout, info.array.state & 1,
|
info.array.layout, info.array.state & 1,
|
||||||
avail) == 0) {
|
avail) == 0) {
|
||||||
diff --git a/mdadm.h b/mdadm.h
|
diff --git a/mdadm.h b/mdadm.h
|
||||||
index 10c204160351..ab1b7fc66e7c 100644
|
index d222cc3..2c7066d 100644
|
||||||
--- a/mdadm.h
|
--- a/mdadm.h
|
||||||
+++ b/mdadm.h
|
+++ b/mdadm.h
|
||||||
@@ -302,6 +302,7 @@ struct mdinfo {
|
@@ -302,6 +302,7 @@ struct mdinfo {
|
||||||
@ -123,7 +125,7 @@ index 10c204160351..ab1b7fc66e7c 100644
|
|||||||
int new_level, delta_disks, new_layout, new_chunk;
|
int new_level, delta_disks, new_layout, new_chunk;
|
||||||
int errors;
|
int errors;
|
||||||
diff --git a/super1.c b/super1.c
|
diff --git a/super1.c b/super1.c
|
||||||
index 672cdde690b4..76eeca111821 100644
|
index 8df17a1..409b6c3 100644
|
||||||
--- a/super1.c
|
--- a/super1.c
|
||||||
+++ b/super1.c
|
+++ b/super1.c
|
||||||
@@ -48,10 +48,18 @@ struct mdp_superblock_1 {
|
@@ -48,10 +48,18 @@ struct mdp_superblock_1 {
|
||||||
@ -279,7 +281,7 @@ index 672cdde690b4..76eeca111821 100644
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1643,10 +1690,49 @@ static unsigned long choose_bm_space(unsigned long devsize)
|
@@ -1645,10 +1692,49 @@ static unsigned long choose_bm_space(unsigned long devsize)
|
||||||
|
|
||||||
static void free_super1(struct supertype *st);
|
static void free_super1(struct supertype *st);
|
||||||
|
|
||||||
@ -331,7 +333,7 @@ index 672cdde690b4..76eeca111821 100644
|
|||||||
static int write_empty_r5l_meta_block(struct supertype *st, int fd)
|
static int write_empty_r5l_meta_block(struct supertype *st, int fd)
|
||||||
{
|
{
|
||||||
struct r5l_meta_block *mb;
|
struct r5l_meta_block *mb;
|
||||||
@@ -1673,7 +1759,7 @@ static int write_empty_r5l_meta_block(struct supertype *st, int fd)
|
@@ -1675,7 +1761,7 @@ static int write_empty_r5l_meta_block(struct supertype *st, int fd)
|
||||||
crc = crc32c_le(crc, (void *)mb, META_BLOCK_SIZE);
|
crc = crc32c_le(crc, (void *)mb, META_BLOCK_SIZE);
|
||||||
mb->checksum = crc;
|
mb->checksum = crc;
|
||||||
|
|
||||||
@ -340,7 +342,7 @@ index 672cdde690b4..76eeca111821 100644
|
|||||||
pr_err("cannot seek to offset of the meta block\n");
|
pr_err("cannot seek to offset of the meta block\n");
|
||||||
goto fail_to_write;
|
goto fail_to_write;
|
||||||
}
|
}
|
||||||
@@ -1706,7 +1792,7 @@ static int write_init_super1(struct supertype *st)
|
@@ -1708,7 +1794,7 @@ static int write_init_super1(struct supertype *st)
|
||||||
|
|
||||||
for (di = st->info; di; di = di->next) {
|
for (di = st->info; di; di = di->next) {
|
||||||
if (di->disk.state & (1 << MD_DISK_JOURNAL))
|
if (di->disk.state & (1 << MD_DISK_JOURNAL))
|
||||||
@ -349,7 +351,7 @@ index 672cdde690b4..76eeca111821 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (di = st->info; di; di = di->next) {
|
for (di = st->info; di; di = di->next) {
|
||||||
@@ -1781,6 +1867,21 @@ static int write_init_super1(struct supertype *st)
|
@@ -1783,6 +1869,21 @@ static int write_init_super1(struct supertype *st)
|
||||||
(((char *)sb) + MAX_SB_SIZE);
|
(((char *)sb) + MAX_SB_SIZE);
|
||||||
bm_space = calc_bitmap_size(bms, 4096) >> 9;
|
bm_space = calc_bitmap_size(bms, 4096) >> 9;
|
||||||
bm_offset = (long)__le32_to_cpu(sb->bitmap_offset);
|
bm_offset = (long)__le32_to_cpu(sb->bitmap_offset);
|
||||||
@ -371,7 +373,7 @@ index 672cdde690b4..76eeca111821 100644
|
|||||||
} else {
|
} else {
|
||||||
bm_space = choose_bm_space(array_size);
|
bm_space = choose_bm_space(array_size);
|
||||||
bm_offset = 8;
|
bm_offset = 8;
|
||||||
@@ -1852,8 +1953,17 @@ static int write_init_super1(struct supertype *st)
|
@@ -1854,8 +1955,17 @@ static int write_init_super1(struct supertype *st)
|
||||||
goto error_out;
|
goto error_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -390,7 +392,7 @@ index 672cdde690b4..76eeca111821 100644
|
|||||||
close(di->fd);
|
close(di->fd);
|
||||||
di->fd = -1;
|
di->fd = -1;
|
||||||
if (rv)
|
if (rv)
|
||||||
@@ -2121,11 +2231,13 @@ static __u64 avail_size1(struct supertype *st, __u64 devsize,
|
@@ -2123,11 +2233,13 @@ static __u64 avail_size1(struct supertype *st, __u64 devsize,
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#ifndef MDASSEMBLE
|
#ifndef MDASSEMBLE
|
||||||
@ -405,7 +407,7 @@ index 672cdde690b4..76eeca111821 100644
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* Allow space for bad block log */
|
/* Allow space for bad block log */
|
||||||
@@ -2528,8 +2640,9 @@ static int validate_geometry1(struct supertype *st, int level,
|
@@ -2530,8 +2642,9 @@ static int validate_geometry1(struct supertype *st, int level,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -417,7 +419,7 @@ index 672cdde690b4..76eeca111821 100644
|
|||||||
|
|
||||||
if (data_offset == INVALID_SECTORS)
|
if (data_offset == INVALID_SECTORS)
|
||||||
data_offset = st->data_offset;
|
data_offset = st->data_offset;
|
||||||
@@ -2564,7 +2677,7 @@ static int validate_geometry1(struct supertype *st, int level,
|
@@ -2566,7 +2679,7 @@ static int validate_geometry1(struct supertype *st, int level,
|
||||||
switch(st->minor_version) {
|
switch(st->minor_version) {
|
||||||
case 0: /* metadata at end. Round down and subtract space to reserve */
|
case 0: /* metadata at end. Round down and subtract space to reserve */
|
||||||
devsize = (devsize & ~(4ULL*2-1));
|
devsize = (devsize & ~(4ULL*2-1));
|
||||||
@ -426,7 +428,7 @@ index 672cdde690b4..76eeca111821 100644
|
|||||||
devsize -= 8*2 + 8 + bmspace;
|
devsize -= 8*2 + 8 + bmspace;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
@@ -2640,6 +2753,7 @@ struct superswitch super1 = {
|
@@ -2642,6 +2755,7 @@ struct superswitch super1 = {
|
||||||
.add_to_super = add_to_super1,
|
.add_to_super = add_to_super1,
|
||||||
.examine_badblocks = examine_badblocks_super1,
|
.examine_badblocks = examine_badblocks_super1,
|
||||||
.copy_metadata = copy_metadata1,
|
.copy_metadata = copy_metadata1,
|
||||||
@ -435,5 +437,5 @@ index 672cdde690b4..76eeca111821 100644
|
|||||||
.match_home = match_home1,
|
.match_home = match_home1,
|
||||||
.uuid_from_super = uuid_from_super1,
|
.uuid_from_super = uuid_from_super1,
|
||||||
--
|
--
|
||||||
2.12.0
|
2.10.2
|
||||||
|
|
@ -1,12 +1,14 @@
|
|||||||
From 9b26e37ca8943a91e10e758bfeeaf040eef3393c Mon Sep 17 00:00:00 2001
|
From e6e9dd3f1b255f9921ebc023c1e5b65601a637e2 Mon Sep 17 00:00:00 2001
|
||||||
From: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
From: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
||||||
Date: Thu, 16 Mar 2017 22:09:47 +0100
|
Date: Wed, 29 Mar 2017 11:54:19 +0200
|
||||||
Subject: [PATCH] Add 'ppl' and 'no-ppl' options for --update=
|
Subject: [PATCH] Add 'ppl' and 'no-ppl' options for --update=
|
||||||
|
References: FATE#321941
|
||||||
|
|
||||||
This can be used with --assemble for super1 and with --update-subarray
|
This can be used with --assemble for super1 and with --update-subarray
|
||||||
for imsm to enable or disable PPL in the metadata.
|
for imsm to enable or disable PPL in the metadata.
|
||||||
|
|
||||||
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
||||||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
---
|
---
|
||||||
Assemble.c | 6 ++++++
|
Assemble.c | 6 ++++++
|
||||||
mdadm.8.in | 27 ++++++++++++++++++++++++---
|
mdadm.8.in | 27 ++++++++++++++++++++++++---
|
||||||
@ -16,7 +18,7 @@ Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|||||||
5 files changed, 139 insertions(+), 4 deletions(-)
|
5 files changed, 139 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
diff --git a/Assemble.c b/Assemble.c
|
diff --git a/Assemble.c b/Assemble.c
|
||||||
index c09842016c0a..6a6a56bfb8b9 100644
|
index c098420..6a6a56b 100644
|
||||||
--- a/Assemble.c
|
--- a/Assemble.c
|
||||||
+++ b/Assemble.c
|
+++ b/Assemble.c
|
||||||
@@ -602,6 +602,12 @@ static int load_devices(struct devs *devices, char *devmap,
|
@@ -602,6 +602,12 @@ static int load_devices(struct devs *devices, char *devmap,
|
||||||
@ -33,7 +35,7 @@ index c09842016c0a..6a6a56bfb8b9 100644
|
|||||||
tmpdev->disposition == 'I'
|
tmpdev->disposition == 'I'
|
||||||
? O_RDWR : (O_RDWR|O_EXCL));
|
? O_RDWR : (O_RDWR|O_EXCL));
|
||||||
diff --git a/mdadm.8.in b/mdadm.8.in
|
diff --git a/mdadm.8.in b/mdadm.8.in
|
||||||
index cad5db533fa4..1178ed9ba320 100644
|
index cad5db5..1178ed9 100644
|
||||||
--- a/mdadm.8.in
|
--- a/mdadm.8.in
|
||||||
+++ b/mdadm.8.in
|
+++ b/mdadm.8.in
|
||||||
@@ -1176,6 +1176,8 @@ argument given to this flag can be one of
|
@@ -1176,6 +1176,8 @@ argument given to this flag can be one of
|
||||||
@ -92,7 +94,7 @@ index cad5db533fa4..1178ed9ba320 100644
|
|||||||
.B \-\-examine
|
.B \-\-examine
|
||||||
The device should be a component of an md array.
|
The device should be a component of an md array.
|
||||||
diff --git a/mdadm.c b/mdadm.c
|
diff --git a/mdadm.c b/mdadm.c
|
||||||
index 65431b76cf15..3d0da1eca8d2 100644
|
index d4e8286..6edf3ab 100644
|
||||||
--- a/mdadm.c
|
--- a/mdadm.c
|
||||||
+++ b/mdadm.c
|
+++ b/mdadm.c
|
||||||
@@ -769,6 +769,10 @@ int main(int argc, char *argv[])
|
@@ -769,6 +769,10 @@ int main(int argc, char *argv[])
|
||||||
@ -116,7 +118,7 @@ index 65431b76cf15..3d0da1eca8d2 100644
|
|||||||
exit(outf == stdout ? 0 : 2);
|
exit(outf == stdout ? 0 : 2);
|
||||||
|
|
||||||
diff --git a/super-intel.c b/super-intel.c
|
diff --git a/super-intel.c b/super-intel.c
|
||||||
index ad3a45369534..53fab8a34a52 100644
|
index 87fec8b..785488a 100644
|
||||||
--- a/super-intel.c
|
--- a/super-intel.c
|
||||||
+++ b/super-intel.c
|
+++ b/super-intel.c
|
||||||
@@ -451,6 +451,7 @@ enum imsm_update_type {
|
@@ -451,6 +451,7 @@ enum imsm_update_type {
|
||||||
@ -140,7 +142,7 @@ index ad3a45369534..53fab8a34a52 100644
|
|||||||
static const char *_sys_dev_type[] = {
|
static const char *_sys_dev_type[] = {
|
||||||
[SYS_DEV_UNKNOWN] = "Unknown",
|
[SYS_DEV_UNKNOWN] = "Unknown",
|
||||||
[SYS_DEV_SAS] = "SAS",
|
[SYS_DEV_SAS] = "SAS",
|
||||||
@@ -7370,6 +7377,34 @@ static int update_subarray_imsm(struct supertype *st, char *subarray,
|
@@ -7373,6 +7380,34 @@ static int update_subarray_imsm(struct supertype *st, char *subarray,
|
||||||
}
|
}
|
||||||
super->updates_pending++;
|
super->updates_pending++;
|
||||||
}
|
}
|
||||||
@ -175,7 +177,7 @@ index ad3a45369534..53fab8a34a52 100644
|
|||||||
} else
|
} else
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
@@ -9596,6 +9631,21 @@ static void imsm_process_update(struct supertype *st,
|
@@ -9599,6 +9634,21 @@ static void imsm_process_update(struct supertype *st,
|
||||||
}
|
}
|
||||||
case update_prealloc_badblocks_mem:
|
case update_prealloc_badblocks_mem:
|
||||||
break;
|
break;
|
||||||
@ -197,7 +199,7 @@ index ad3a45369534..53fab8a34a52 100644
|
|||||||
default:
|
default:
|
||||||
pr_err("error: unsuported process update type:(type: %d)\n", type);
|
pr_err("error: unsuported process update type:(type: %d)\n", type);
|
||||||
}
|
}
|
||||||
@@ -9841,6 +9891,11 @@ static int imsm_prepare_update(struct supertype *st,
|
@@ -9844,6 +9894,11 @@ static int imsm_prepare_update(struct supertype *st,
|
||||||
super->extra_space += sizeof(struct bbm_log) -
|
super->extra_space += sizeof(struct bbm_log) -
|
||||||
get_imsm_bbm_log_size(super->bbm_log);
|
get_imsm_bbm_log_size(super->bbm_log);
|
||||||
break;
|
break;
|
||||||
@ -210,7 +212,7 @@ index ad3a45369534..53fab8a34a52 100644
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
diff --git a/super1.c b/super1.c
|
diff --git a/super1.c b/super1.c
|
||||||
index 76eeca111821..541f31eec16f 100644
|
index 409b6c3..e76f777 100644
|
||||||
--- a/super1.c
|
--- a/super1.c
|
||||||
+++ b/super1.c
|
+++ b/super1.c
|
||||||
@@ -1325,6 +1325,55 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
|
@@ -1325,6 +1325,55 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
|
||||||
@ -270,5 +272,5 @@ index 76eeca111821..541f31eec16f 100644
|
|||||||
if (info->name[0] == 0)
|
if (info->name[0] == 0)
|
||||||
sprintf(info->name, "%d", info->array.md_minor);
|
sprintf(info->name, "%d", info->array.md_minor);
|
||||||
--
|
--
|
||||||
2.12.0
|
2.10.2
|
||||||
|
|
@ -1,7 +1,8 @@
|
|||||||
From 78ddd8e9ac18c2d01d79ac8a5a6fa924f6315ffd Mon Sep 17 00:00:00 2001
|
From 860f11ed4d6a7bac6f2d698a30a13371c0aa7924 Mon Sep 17 00:00:00 2001
|
||||||
From: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
From: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
||||||
Date: Thu, 16 Mar 2017 22:09:48 +0100
|
Date: Wed, 29 Mar 2017 11:54:20 +0200
|
||||||
Subject: [PATCH] Grow: support consistency policy change
|
Subject: [PATCH] Grow: support consistency policy change
|
||||||
|
References: FATE#321941
|
||||||
|
|
||||||
Extend the --consistency-policy parameter to work also in Grow mode.
|
Extend the --consistency-policy parameter to work also in Grow mode.
|
||||||
Using it changes the currently active consistency policy in the kernel
|
Using it changes the currently active consistency policy in the kernel
|
||||||
@ -10,15 +11,17 @@ this supports only changing between "ppl" and "resync" policies, that is
|
|||||||
enabling or disabling PPL at runtime.
|
enabling or disabling PPL at runtime.
|
||||||
|
|
||||||
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
||||||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
---
|
---
|
||||||
Grow.c | 172 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
Grow.c | 172 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
ReadMe.c | 46 +++++++++--------
|
||||||
mdadm.8.in | 18 ++++++-
|
mdadm.8.in | 18 ++++++-
|
||||||
mdadm.c | 3 ++
|
mdadm.c | 3 ++
|
||||||
mdadm.h | 2 +
|
mdadm.h | 2 +
|
||||||
4 files changed, 194 insertions(+), 1 deletion(-)
|
5 files changed, 218 insertions(+), 23 deletions(-)
|
||||||
|
|
||||||
diff --git a/Grow.c b/Grow.c
|
diff --git a/Grow.c b/Grow.c
|
||||||
index e4351d7f952a..c01d0945e8f5 100755
|
index a849012..b86b53e 100755
|
||||||
--- a/Grow.c
|
--- a/Grow.c
|
||||||
+++ b/Grow.c
|
+++ b/Grow.c
|
||||||
@@ -528,6 +528,178 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s)
|
@@ -528,6 +528,178 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s)
|
||||||
@ -200,8 +203,65 @@ index e4351d7f952a..c01d0945e8f5 100755
|
|||||||
/*
|
/*
|
||||||
* When reshaping an array we might need to backup some data.
|
* When reshaping an array we might need to backup some data.
|
||||||
* This is written to all spares with a 'super_block' describing it.
|
* This is written to all spares with a 'super_block' describing it.
|
||||||
|
diff --git a/ReadMe.c b/ReadMe.c
|
||||||
|
index fc04c2c..eb8fb4b 100644
|
||||||
|
--- a/ReadMe.c
|
||||||
|
+++ b/ReadMe.c
|
||||||
|
@@ -559,28 +559,30 @@ char Help_grow[] =
|
||||||
|
"reconfiguration.\n"
|
||||||
|
"\n"
|
||||||
|
"Options that are valid with the grow (-G --grow) mode are:\n"
|
||||||
|
-" --level= -l : Tell mdadm what level to convert the array to.\n"
|
||||||
|
-" --layout= -p : For a FAULTY array, set/change the error mode.\n"
|
||||||
|
-" : for other arrays, update the layout\n"
|
||||||
|
-" --size= -z : Change the active size of devices in an array.\n"
|
||||||
|
-" : This is useful if all devices have been replaced\n"
|
||||||
|
-" : with larger devices. Value is in Kilobytes, or\n"
|
||||||
|
-" : the special word 'max' meaning 'as large as possible'.\n"
|
||||||
|
-" --assume-clean : When increasing the --size, this flag will avoid\n"
|
||||||
|
-" : a resync of the new space\n"
|
||||||
|
-" --chunk= -c : Change the chunksize of the array\n"
|
||||||
|
-" --raid-devices= -n : Change the number of active devices in an array.\n"
|
||||||
|
-" --add= -a : Add listed devices as part of reshape. This is\n"
|
||||||
|
-" : needed for resizing a RAID0 which cannot have\n"
|
||||||
|
-" : spares already present.\n"
|
||||||
|
-" --bitmap= -b : Add or remove a write-intent bitmap.\n"
|
||||||
|
-" --backup-file= file : A file on a different device to store data for a\n"
|
||||||
|
-" : short time while increasing raid-devices on a\n"
|
||||||
|
-" : RAID4/5/6 array. Also needed throughout a reshape\n"
|
||||||
|
-" : when changing parameters other than raid-devices\n"
|
||||||
|
-" --array-size= -Z : Change visible size of array. This does not change\n"
|
||||||
|
-" : any data on the device, and is not stable across restarts.\n"
|
||||||
|
-" --data-offset= : Location on device to move start of data to.\n"
|
||||||
|
+" --level= -l : Tell mdadm what level to convert the array to.\n"
|
||||||
|
+" --layout= -p : For a FAULTY array, set/change the error mode.\n"
|
||||||
|
+" : for other arrays, update the layout\n"
|
||||||
|
+" --size= -z : Change the active size of devices in an array.\n"
|
||||||
|
+" : This is useful if all devices have been replaced\n"
|
||||||
|
+" : with larger devices. Value is in Kilobytes, or\n"
|
||||||
|
+" : the special word 'max' meaning 'as large as possible'.\n"
|
||||||
|
+" --assume-clean : When increasing the --size, this flag will avoid\n"
|
||||||
|
+" : a resync of the new space\n"
|
||||||
|
+" --chunk= -c : Change the chunksize of the array\n"
|
||||||
|
+" --raid-devices= -n : Change the number of active devices in an array.\n"
|
||||||
|
+" --add= -a : Add listed devices as part of reshape. This is\n"
|
||||||
|
+" : needed for resizing a RAID0 which cannot have\n"
|
||||||
|
+" : spares already present.\n"
|
||||||
|
+" --bitmap= -b : Add or remove a write-intent bitmap.\n"
|
||||||
|
+" --backup-file= file : A file on a different device to store data for a\n"
|
||||||
|
+" : short time while increasing raid-devices on a\n"
|
||||||
|
+" : RAID4/5/6 array. Also needed throughout a reshape\n"
|
||||||
|
+" : when changing parameters other than raid-devices\n"
|
||||||
|
+" --array-size= -Z : Change visible size of array. This does not change any\n"
|
||||||
|
+" : data on the device, and is not stable across restarts.\n"
|
||||||
|
+" --data-offset= : Location on device to move start of data to.\n"
|
||||||
|
+" --consistency-policy= : Change the consistency policy of an active array.\n"
|
||||||
|
+" -k : Currently works only for PPL with RAID5.\n"
|
||||||
|
;
|
||||||
|
|
||||||
|
char Help_incr[] =
|
||||||
diff --git a/mdadm.8.in b/mdadm.8.in
|
diff --git a/mdadm.8.in b/mdadm.8.in
|
||||||
index 1178ed9ba320..744c12b534bf 100644
|
index 1178ed9..744c12b 100644
|
||||||
--- a/mdadm.8.in
|
--- a/mdadm.8.in
|
||||||
+++ b/mdadm.8.in
|
+++ b/mdadm.8.in
|
||||||
@@ -126,7 +126,7 @@ of component devices and changing the number of active devices in
|
@@ -126,7 +126,7 @@ of component devices and changing the number of active devices in
|
||||||
@ -251,10 +311,10 @@ index 1178ed9ba320..744c12b534bf 100644
|
|||||||
|
|
||||||
.HP 12
|
.HP 12
|
||||||
diff --git a/mdadm.c b/mdadm.c
|
diff --git a/mdadm.c b/mdadm.c
|
||||||
index 3d0da1eca8d2..0db4cb33caa4 100644
|
index 6edf3ab..5ebf117 100644
|
||||||
--- a/mdadm.c
|
--- a/mdadm.c
|
||||||
+++ b/mdadm.c
|
+++ b/mdadm.c
|
||||||
@@ -1217,6 +1217,7 @@ int main(int argc, char *argv[])
|
@@ -1221,6 +1221,7 @@ int main(int argc, char *argv[])
|
||||||
s.journaldisks = 1;
|
s.journaldisks = 1;
|
||||||
continue;
|
continue;
|
||||||
case O(CREATE, 'k'):
|
case O(CREATE, 'k'):
|
||||||
@ -262,7 +322,7 @@ index 3d0da1eca8d2..0db4cb33caa4 100644
|
|||||||
s.consistency_policy = map_name(consistency_policies,
|
s.consistency_policy = map_name(consistency_policies,
|
||||||
optarg);
|
optarg);
|
||||||
if (s.consistency_policy == UnSet ||
|
if (s.consistency_policy == UnSet ||
|
||||||
@@ -1675,6 +1676,8 @@ int main(int argc, char *argv[])
|
@@ -1679,6 +1680,8 @@ int main(int argc, char *argv[])
|
||||||
rv = Grow_reshape(devlist->devname, mdfd,
|
rv = Grow_reshape(devlist->devname, mdfd,
|
||||||
devlist->next,
|
devlist->next,
|
||||||
data_offset, &c, &s);
|
data_offset, &c, &s);
|
||||||
@ -272,7 +332,7 @@ index 3d0da1eca8d2..0db4cb33caa4 100644
|
|||||||
pr_err("no changes to --grow\n");
|
pr_err("no changes to --grow\n");
|
||||||
break;
|
break;
|
||||||
diff --git a/mdadm.h b/mdadm.h
|
diff --git a/mdadm.h b/mdadm.h
|
||||||
index ab1b7fc66e7c..7173b2589655 100644
|
index 2c7066d..4891acf 100644
|
||||||
--- a/mdadm.h
|
--- a/mdadm.h
|
||||||
+++ b/mdadm.h
|
+++ b/mdadm.h
|
||||||
@@ -1331,6 +1331,8 @@ extern int Grow_restart(struct supertype *st, struct mdinfo *info,
|
@@ -1331,6 +1331,8 @@ extern int Grow_restart(struct supertype *st, struct mdinfo *info,
|
||||||
@ -285,5 +345,5 @@ index ab1b7fc66e7c..7173b2589655 100644
|
|||||||
extern int restore_backup(struct supertype *st,
|
extern int restore_backup(struct supertype *st,
|
||||||
struct mdinfo *content,
|
struct mdinfo *content,
|
||||||
--
|
--
|
||||||
2.12.0
|
2.10.2
|
||||||
|
|
@ -0,0 +1,31 @@
|
|||||||
|
From a86b1c8d15dc0aca2eda5276bae088b5f55030a2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
|
Date: Wed, 29 Mar 2017 11:37:27 -0400
|
||||||
|
Subject: [PATCH] mdadm.h: struct mdinfo: reorganize ppl elements for better
|
||||||
|
struct packing
|
||||||
|
|
||||||
|
Minor optimization putting ints next to ints for better data
|
||||||
|
alignment.
|
||||||
|
|
||||||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
|
---
|
||||||
|
mdadm.h | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/mdadm.h b/mdadm.h
|
||||||
|
index 4891acf..dbf1f92 100644
|
||||||
|
--- a/mdadm.h
|
||||||
|
+++ b/mdadm.h
|
||||||
|
@@ -301,8 +301,8 @@ struct mdinfo {
|
||||||
|
};
|
||||||
|
long bitmap_offset; /* 0 == none, 1 == a file */
|
||||||
|
unsigned int ppl_size;
|
||||||
|
- unsigned long long ppl_sector;
|
||||||
|
int ppl_offset;
|
||||||
|
+ unsigned long long ppl_sector;
|
||||||
|
unsigned long safe_mode_delay; /* ms delay to mark clean */
|
||||||
|
int new_level, delta_disks, new_layout, new_chunk;
|
||||||
|
int errors;
|
||||||
|
--
|
||||||
|
2.10.2
|
||||||
|
|
@ -0,0 +1,45 @@
|
|||||||
|
From aa3131183661955de112fa7d9824207de63d9fa5 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Gioh Kim <gi-oh.kim@profitbricks.com>
|
||||||
|
Date: Wed, 29 Mar 2017 11:40:33 +0200
|
||||||
|
Subject: [PATCH] super1: replace hard-coded values with bit definitions
|
||||||
|
|
||||||
|
Some hard-coded values for disk status are replaced
|
||||||
|
with bit definitions.
|
||||||
|
|
||||||
|
Signed-off-by: Gioh Kim <gi-oh.kim@profitbricks.com>
|
||||||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
|
---
|
||||||
|
super1.c | 7 ++++---
|
||||||
|
1 file changed, 4 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/super1.c b/super1.c
|
||||||
|
index e76f777..6f91611 100644
|
||||||
|
--- a/super1.c
|
||||||
|
+++ b/super1.c
|
||||||
|
@@ -1040,7 +1040,7 @@ static void getinfo_super1(struct supertype *st, struct mdinfo *info, char *map)
|
||||||
|
info->disk.state = 0; /* spare: not active, not sync, not faulty */
|
||||||
|
break;
|
||||||
|
case MD_DISK_ROLE_FAULTY:
|
||||||
|
- info->disk.state = 1; /* faulty */
|
||||||
|
+ info->disk.state = (1 << MD_DISK_FAULTY); /* faulty */
|
||||||
|
break;
|
||||||
|
case MD_DISK_ROLE_JOURNAL:
|
||||||
|
info->disk.state = (1 << MD_DISK_JOURNAL);
|
||||||
|
@@ -1600,11 +1600,12 @@ static int add_to_super1(struct supertype *st, mdu_disk_info_t *dk,
|
||||||
|
}
|
||||||
|
|
||||||
|
dk_state = dk->state & ~(1<<MD_DISK_FAILFAST);
|
||||||
|
- if ((dk_state & 6) == 6) /* active, sync */
|
||||||
|
+ if ((dk_state & (1<<MD_DISK_ACTIVE)) &&
|
||||||
|
+ (dk_state & (1<<MD_DISK_SYNC)))/* active, sync */
|
||||||
|
*rp = __cpu_to_le16(dk->raid_disk);
|
||||||
|
else if (dk_state & (1<<MD_DISK_JOURNAL))
|
||||||
|
*rp = MD_DISK_ROLE_JOURNAL;
|
||||||
|
- else if ((dk_state & ~2) == 0) /* active or idle -> spare */
|
||||||
|
+ else if ((dk_state & ~(1<<MD_DISK_ACTIVE)) == 0) /* active or idle -> spare */
|
||||||
|
*rp = MD_DISK_ROLE_SPARE;
|
||||||
|
else
|
||||||
|
*rp = MD_DISK_ROLE_FAULTY;
|
||||||
|
--
|
||||||
|
2.10.2
|
||||||
|
|
@ -0,0 +1,79 @@
|
|||||||
|
From ed1809969802ba03be0a33b7cd9f0ea85c7a42aa Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
|
Date: Wed, 29 Mar 2017 11:55:19 -0400
|
||||||
|
Subject: [PATCH] mdadm: Clean up some ugly multiple actions on single line
|
||||||
|
|
||||||
|
'foo(); continue;' on the same line within a switch statement is
|
||||||
|
always wrong. Get rid of some of it.
|
||||||
|
|
||||||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
|
---
|
||||||
|
mdadm.c | 30 ++++++++++++++++++++----------
|
||||||
|
1 file changed, 20 insertions(+), 10 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/mdadm.c b/mdadm.c
|
||||||
|
index 5ebf117..502e721 100644
|
||||||
|
--- a/mdadm.c
|
||||||
|
+++ b/mdadm.c
|
||||||
|
@@ -1928,16 +1928,21 @@ static int misc_list(struct mddev_dev *devlist,
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
case 'Q':
|
||||||
|
- rv |= Query(dv->devname); continue;
|
||||||
|
+ rv |= Query(dv->devname);
|
||||||
|
+ continue;
|
||||||
|
case 'X':
|
||||||
|
- rv |= ExamineBitmap(dv->devname, c->brief, ss); continue;
|
||||||
|
+ rv |= ExamineBitmap(dv->devname, c->brief, ss);
|
||||||
|
+ continue;
|
||||||
|
case ExamineBB:
|
||||||
|
- rv |= ExamineBadblocks(dv->devname, c->brief, ss); continue;
|
||||||
|
+ rv |= ExamineBadblocks(dv->devname, c->brief, ss);
|
||||||
|
+ continue;
|
||||||
|
case 'W':
|
||||||
|
case WaitOpt:
|
||||||
|
- rv |= Wait(dv->devname); continue;
|
||||||
|
+ rv |= Wait(dv->devname);
|
||||||
|
+ continue;
|
||||||
|
case Waitclean:
|
||||||
|
- rv |= WaitClean(dv->devname, -1, c->verbose); continue;
|
||||||
|
+ rv |= WaitClean(dv->devname, -1, c->verbose);
|
||||||
|
+ continue;
|
||||||
|
case KillSubarray:
|
||||||
|
rv |= Kill_subarray(dv->devname, c->subarray, c->verbose);
|
||||||
|
continue;
|
||||||
|
@@ -1964,7 +1969,8 @@ static int misc_list(struct mddev_dev *devlist,
|
||||||
|
switch(dv->devname[0] == '/') {
|
||||||
|
case 0:
|
||||||
|
mdfd = open_dev(dv->devname);
|
||||||
|
- if (mdfd >= 0) break;
|
||||||
|
+ if (mdfd >= 0)
|
||||||
|
+ break;
|
||||||
|
case 1:
|
||||||
|
mdfd = open_mddev(dv->devname, 1);
|
||||||
|
}
|
||||||
|
@@ -1972,13 +1978,17 @@ static int misc_list(struct mddev_dev *devlist,
|
||||||
|
switch(dv->disposition) {
|
||||||
|
case 'R':
|
||||||
|
c->runstop = 1;
|
||||||
|
- rv |= Manage_run(dv->devname, mdfd, c); break;
|
||||||
|
+ rv |= Manage_run(dv->devname, mdfd, c);
|
||||||
|
+ break;
|
||||||
|
case 'S':
|
||||||
|
- rv |= Manage_stop(dv->devname, mdfd, c->verbose, 0); break;
|
||||||
|
+ rv |= Manage_stop(dv->devname, mdfd, c->verbose, 0);
|
||||||
|
+ break;
|
||||||
|
case 'o':
|
||||||
|
- rv |= Manage_ro(dv->devname, mdfd, 1); break;
|
||||||
|
+ rv |= Manage_ro(dv->devname, mdfd, 1);
|
||||||
|
+ break;
|
||||||
|
case 'w':
|
||||||
|
- rv |= Manage_ro(dv->devname, mdfd, -1); break;
|
||||||
|
+ rv |= Manage_ro(dv->devname, mdfd, -1);
|
||||||
|
+ break;
|
||||||
|
}
|
||||||
|
close(mdfd);
|
||||||
|
} else
|
||||||
|
--
|
||||||
|
2.10.2
|
||||||
|
|
196
0031-mdadm-Fixup-a-number-of-whitespace-inconsistency-cas.patch
Normal file
196
0031-mdadm-Fixup-a-number-of-whitespace-inconsistency-cas.patch
Normal file
@ -0,0 +1,196 @@
|
|||||||
|
From 8ea982179af73f5b1d3fc937676ec7c969a190ac Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
|
Date: Wed, 29 Mar 2017 12:02:14 -0400
|
||||||
|
Subject: [PATCH] mdadm: Fixup a number of whitespace inconsistency cases
|
||||||
|
|
||||||
|
Lots of code lacked whitespaces in assignments, and in other places
|
||||||
|
had them in the wrong place.
|
||||||
|
|
||||||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
|
---
|
||||||
|
mdadm.c | 51 +++++++++++++++++++++++++--------------------------
|
||||||
|
1 file changed, 25 insertions(+), 26 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/mdadm.c b/mdadm.c
|
||||||
|
index 502e721..0f32773 100644
|
||||||
|
--- a/mdadm.c
|
||||||
|
+++ b/mdadm.c
|
||||||
|
@@ -106,11 +106,11 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
|
srandom(time(0) ^ getpid());
|
||||||
|
|
||||||
|
- ident.uuid_set=0;
|
||||||
|
+ ident.uuid_set = 0;
|
||||||
|
ident.level = UnSet;
|
||||||
|
ident.raid_disks = UnSet;
|
||||||
|
- ident.super_minor= UnSet;
|
||||||
|
- ident.devices=0;
|
||||||
|
+ ident.super_minor = UnSet;
|
||||||
|
+ ident.devices = 0;
|
||||||
|
ident.spare_group = NULL;
|
||||||
|
ident.autof = 0;
|
||||||
|
ident.st = NULL;
|
||||||
|
@@ -120,10 +120,9 @@ int main(int argc, char *argv[])
|
||||||
|
ident.container = NULL;
|
||||||
|
ident.member = NULL;
|
||||||
|
|
||||||
|
- while ((option_index = -1) ,
|
||||||
|
- (opt=getopt_long(argc, argv,
|
||||||
|
- shortopt, long_options,
|
||||||
|
- &option_index)) != -1) {
|
||||||
|
+ while ((option_index = -1),
|
||||||
|
+ (opt = getopt_long(argc, argv, shortopt, long_options,
|
||||||
|
+ &option_index)) != -1) {
|
||||||
|
int newmode = mode;
|
||||||
|
/* firstly, some mode-independent options */
|
||||||
|
switch(opt) {
|
||||||
|
@@ -397,7 +396,7 @@ int main(int argc, char *argv[])
|
||||||
|
pr_err("metadata information already given\n");
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
- for(i=0; !ss && superlist[i]; i++)
|
||||||
|
+ for(i = 0; !ss && superlist[i]; i++)
|
||||||
|
ss = superlist[i]->match_metadata_desc(optarg);
|
||||||
|
|
||||||
|
if (!ss) {
|
||||||
|
@@ -542,7 +541,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
|
case 5:
|
||||||
|
s.layout = map_name(r5layout, optarg);
|
||||||
|
- if (s.layout==UnSet) {
|
||||||
|
+ if (s.layout == UnSet) {
|
||||||
|
pr_err("layout %s not understood for raid5.\n",
|
||||||
|
optarg);
|
||||||
|
exit(2);
|
||||||
|
@@ -550,7 +549,7 @@ int main(int argc, char *argv[])
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
s.layout = map_name(r6layout, optarg);
|
||||||
|
- if (s.layout==UnSet) {
|
||||||
|
+ if (s.layout == UnSet) {
|
||||||
|
pr_err("layout %s not understood for raid6.\n",
|
||||||
|
optarg);
|
||||||
|
exit(2);
|
||||||
|
@@ -665,7 +664,7 @@ int main(int argc, char *argv[])
|
||||||
|
case O(MISC,'f'): /* force zero */
|
||||||
|
case O(MISC,Force): /* force zero */
|
||||||
|
case O(MANAGE,Force): /* add device which is too large */
|
||||||
|
- c.force=1;
|
||||||
|
+ c.force = 1;
|
||||||
|
continue;
|
||||||
|
/* now for the Assemble options */
|
||||||
|
case O(ASSEMBLE, FreezeReshape): /* Freeze reshape during
|
||||||
|
@@ -777,12 +776,12 @@ int main(int argc, char *argv[])
|
||||||
|
continue;
|
||||||
|
if (strcmp(c.update, "revert-reshape") == 0)
|
||||||
|
continue;
|
||||||
|
- if (strcmp(c.update, "byteorder")==0) {
|
||||||
|
+ if (strcmp(c.update, "byteorder") == 0) {
|
||||||
|
if (ss) {
|
||||||
|
pr_err("must not set metadata type with --update=byteorder.\n");
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
- for(i=0; !ss && superlist[i]; i++)
|
||||||
|
+ for(i = 0; !ss && superlist[i]; i++)
|
||||||
|
ss = superlist[i]->match_metadata_desc(
|
||||||
|
"0.swap");
|
||||||
|
if (!ss) {
|
||||||
|
@@ -1476,7 +1475,7 @@ int main(int argc, char *argv[])
|
||||||
|
pr_err("can only assemble a single array when providing a backup file.\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
- for (dv = devlist ; dv ; dv=dv->next) {
|
||||||
|
+ for (dv = devlist; dv; dv = dv->next) {
|
||||||
|
struct mddev_ident *array_ident = conf_get_ident(dv->devname);
|
||||||
|
if (array_ident == NULL) {
|
||||||
|
pr_err("%s not identified in config file.\n",
|
||||||
|
@@ -1611,10 +1610,10 @@ int main(int argc, char *argv[])
|
||||||
|
else
|
||||||
|
c.delay = 60;
|
||||||
|
}
|
||||||
|
- rv= Monitor(devlist, mailaddr, program,
|
||||||
|
- &c, daemonise, oneshot,
|
||||||
|
- dosyslog, pidfile, increments,
|
||||||
|
- spare_sharing);
|
||||||
|
+ rv = Monitor(devlist, mailaddr, program,
|
||||||
|
+ &c, daemonise, oneshot,
|
||||||
|
+ dosyslog, pidfile, increments,
|
||||||
|
+ spare_sharing);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GROW:
|
||||||
|
@@ -1654,7 +1653,7 @@ int main(int argc, char *argv[])
|
||||||
|
rv = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
- for (dv=devlist->next; dv ; dv=dv->next) {
|
||||||
|
+ for (dv = devlist->next; dv; dv = dv->next) {
|
||||||
|
rv = Grow_Add_device(devlist->devname, mdfd,
|
||||||
|
dv->devname);
|
||||||
|
if (rv)
|
||||||
|
@@ -1749,7 +1748,7 @@ static int scan_assemble(struct supertype *ss,
|
||||||
|
pr_err("No devices listed in conf file were found.\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
- for (a = array_list; a ; a = a->next) {
|
||||||
|
+ for (a = array_list; a; a = a->next) {
|
||||||
|
a->assembled = 0;
|
||||||
|
if (a->autof == 0)
|
||||||
|
a->autof = c->autof;
|
||||||
|
@@ -1760,7 +1759,7 @@ static int scan_assemble(struct supertype *ss,
|
||||||
|
failures = 0;
|
||||||
|
successes = 0;
|
||||||
|
rv = 0;
|
||||||
|
- for (a = array_list; a ; a = a->next) {
|
||||||
|
+ for (a = array_list; a; a = a->next) {
|
||||||
|
int r;
|
||||||
|
if (a->assembled)
|
||||||
|
continue;
|
||||||
|
@@ -1826,7 +1825,7 @@ static int misc_scan(char devmode, struct context *c)
|
||||||
|
int rv = 0;
|
||||||
|
|
||||||
|
for (members = 0; members <= 1; members++) {
|
||||||
|
- for (e=ms ; e ; e=e->next) {
|
||||||
|
+ for (e = ms; e; e = e->next) {
|
||||||
|
char *name = NULL;
|
||||||
|
struct map_ent *me;
|
||||||
|
struct stat stb;
|
||||||
|
@@ -1864,7 +1863,7 @@ static int stop_scan(int verbose)
|
||||||
|
/* Due to possible stacking of devices, repeat until
|
||||||
|
* nothing more can be stopped
|
||||||
|
*/
|
||||||
|
- int progress=1, err;
|
||||||
|
+ int progress = 1, err;
|
||||||
|
int last = 0;
|
||||||
|
int rv = 0;
|
||||||
|
do {
|
||||||
|
@@ -1873,7 +1872,7 @@ static int stop_scan(int verbose)
|
||||||
|
|
||||||
|
if (!progress) last = 1;
|
||||||
|
progress = 0; err = 0;
|
||||||
|
- for (e=ms ; e ; e=e->next) {
|
||||||
|
+ for (e = ms; e; e = e->next) {
|
||||||
|
char *name = get_md_name(e->devnm);
|
||||||
|
int mdfd;
|
||||||
|
|
||||||
|
@@ -1908,7 +1907,7 @@ static int misc_list(struct mddev_dev *devlist,
|
||||||
|
struct mddev_dev *dv;
|
||||||
|
int rv = 0;
|
||||||
|
|
||||||
|
- for (dv=devlist ; dv; dv=(rv & 16) ? NULL : dv->next) {
|
||||||
|
+ for (dv = devlist; dv; dv = (rv & 16) ? NULL : dv->next) {
|
||||||
|
int mdfd;
|
||||||
|
|
||||||
|
switch(dv->disposition) {
|
||||||
|
@@ -1974,7 +1973,7 @@ static int misc_list(struct mddev_dev *devlist,
|
||||||
|
case 1:
|
||||||
|
mdfd = open_mddev(dv->devname, 1);
|
||||||
|
}
|
||||||
|
- if (mdfd>=0) {
|
||||||
|
+ if (mdfd >= 0) {
|
||||||
|
switch(dv->disposition) {
|
||||||
|
case 'R':
|
||||||
|
c->runstop = 1;
|
||||||
|
--
|
||||||
|
2.10.2
|
||||||
|
|
99
0032-util-Cosmetic-changes.patch
Normal file
99
0032-util-Cosmetic-changes.patch
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
From efa295309fd2d85133aaf3c224cd5834b689234c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
|
Date: Wed, 29 Mar 2017 12:05:12 -0400
|
||||||
|
Subject: [PATCH] util: Cosmetic changes
|
||||||
|
|
||||||
|
Fixup a number of indentation and whitespace issues
|
||||||
|
|
||||||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
|
---
|
||||||
|
util.c | 22 ++++++++++------------
|
||||||
|
1 file changed, 10 insertions(+), 12 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/util.c b/util.c
|
||||||
|
index 683c869..374015e 100644
|
||||||
|
--- a/util.c
|
||||||
|
+++ b/util.c
|
||||||
|
@@ -828,14 +828,12 @@ char *human_size(long long bytes)
|
||||||
|
long cMiB = (bytes * 200LL / (1LL<<20) + 1) / 2;
|
||||||
|
long cMB = (bytes / ( 1000000LL / 200LL ) +1) /2;
|
||||||
|
snprintf(buf, sizeof(buf), " (%ld.%02ld MiB %ld.%02ld MB)",
|
||||||
|
- cMiB/100 , cMiB % 100,
|
||||||
|
- cMB/100, cMB % 100);
|
||||||
|
+ cMiB/100, cMiB % 100, cMB/100, cMB % 100);
|
||||||
|
} else {
|
||||||
|
long cGiB = (bytes * 200LL / (1LL<<30) +1) / 2;
|
||||||
|
long cGB = (bytes / (1000000000LL/200LL ) +1) /2;
|
||||||
|
snprintf(buf, sizeof(buf), " (%ld.%02ld GiB %ld.%02ld GB)",
|
||||||
|
- cGiB/100 , cGiB % 100,
|
||||||
|
- cGB/100, cGB % 100);
|
||||||
|
+ cGiB/100, cGiB % 100, cGB/100, cGB % 100);
|
||||||
|
}
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
@@ -862,22 +860,22 @@ char *human_size_brief(long long bytes, int prefix)
|
||||||
|
if (bytes < 2*1024LL*1024LL*1024LL) {
|
||||||
|
long cMiB = (bytes * 200LL / (1LL<<20) +1) /2;
|
||||||
|
snprintf(buf, sizeof(buf), "%ld.%02ldMiB",
|
||||||
|
- cMiB/100 , cMiB % 100);
|
||||||
|
+ cMiB/100, cMiB % 100);
|
||||||
|
} else {
|
||||||
|
long cGiB = (bytes * 200LL / (1LL<<30) +1) /2;
|
||||||
|
snprintf(buf, sizeof(buf), "%ld.%02ldGiB",
|
||||||
|
- cGiB/100 , cGiB % 100);
|
||||||
|
+ cGiB/100, cGiB % 100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (prefix == JEDEC) {
|
||||||
|
if (bytes < 2*1024LL*1024LL*1024LL) {
|
||||||
|
long cMB = (bytes / ( 1000000LL / 200LL ) +1) /2;
|
||||||
|
snprintf(buf, sizeof(buf), "%ld.%02ldMB",
|
||||||
|
- cMB/100, cMB % 100);
|
||||||
|
+ cMB/100, cMB % 100);
|
||||||
|
} else {
|
||||||
|
long cGB = (bytes / (1000000000LL/200LL ) +1) /2;
|
||||||
|
snprintf(buf, sizeof(buf), "%ld.%02ldGB",
|
||||||
|
- cGB/100 , cGB % 100);
|
||||||
|
+ cGB/100, cGB % 100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
@@ -1093,7 +1091,7 @@ int open_dev_excl(char *devnm)
|
||||||
|
long delay = 1000;
|
||||||
|
|
||||||
|
sprintf(buf, "%d:%d", major(devid), minor(devid));
|
||||||
|
- for (i = 0 ; i < 25 ; i++) {
|
||||||
|
+ for (i = 0; i < 25; i++) {
|
||||||
|
int fd = dev_open(buf, flags|O_EXCL);
|
||||||
|
if (fd >= 0)
|
||||||
|
return fd;
|
||||||
|
@@ -1134,7 +1132,7 @@ void wait_for(char *dev, int fd)
|
||||||
|
(stb_want.st_mode & S_IFMT) != S_IFBLK)
|
||||||
|
return;
|
||||||
|
|
||||||
|
- for (i = 0 ; i < 25 ; i++) {
|
||||||
|
+ for (i = 0; i < 25; i++) {
|
||||||
|
struct stat stb;
|
||||||
|
if (stat(dev, &stb) == 0 &&
|
||||||
|
(stb.st_mode & S_IFMT) == S_IFBLK &&
|
||||||
|
@@ -1205,7 +1203,7 @@ struct supertype *super_by_fd(int fd, char **subarrayp)
|
||||||
|
verstr = "-no-metadata-";
|
||||||
|
}
|
||||||
|
|
||||||
|
- for (i = 0; st == NULL && superlist[i] ; i++)
|
||||||
|
+ for (i = 0; st == NULL && superlist[i]; i++)
|
||||||
|
st = superlist[i]->match_metadata_desc(verstr);
|
||||||
|
|
||||||
|
sysfs_free(sra);
|
||||||
|
@@ -1270,7 +1268,7 @@ struct supertype *guess_super_type(int fd, enum guess_types guess_type)
|
||||||
|
st = xcalloc(1, sizeof(*st));
|
||||||
|
st->container_devnm[0] = 0;
|
||||||
|
|
||||||
|
- for (i = 0 ; superlist[i]; i++) {
|
||||||
|
+ for (i = 0; superlist[i]; i++) {
|
||||||
|
int rv;
|
||||||
|
ss = superlist[i];
|
||||||
|
if (guess_type == guess_array && ss->add_to_super == NULL)
|
||||||
|
--
|
||||||
|
2.10.2
|
||||||
|
|
176
0033-Grow-Fixup-a-pile-of-cosmetic-issues.patch
Normal file
176
0033-Grow-Fixup-a-pile-of-cosmetic-issues.patch
Normal file
@ -0,0 +1,176 @@
|
|||||||
|
From 6ebf34e6bdd9e952d00ad3c2f12a130bfb68965e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
|
Date: Wed, 29 Mar 2017 12:15:20 -0400
|
||||||
|
Subject: [PATCH] Grow: Fixup a pile of cosmetic issues
|
||||||
|
|
||||||
|
No code change, simply cleanup ugliness.
|
||||||
|
|
||||||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
|
---
|
||||||
|
Grow.c | 60 ++++++++++++++++++++++++++++++++----------------------------
|
||||||
|
1 file changed, 32 insertions(+), 28 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/Grow.c b/Grow.c
|
||||||
|
index b86b53e..6405f0e 100755
|
||||||
|
--- a/Grow.c
|
||||||
|
+++ b/Grow.c
|
||||||
|
@@ -1269,8 +1269,7 @@ char *analyse_change(char *devname, struct mdinfo *info, struct reshape *re)
|
||||||
|
* raid5 with 2 disks, or
|
||||||
|
* raid0 with 1 disk
|
||||||
|
*/
|
||||||
|
- if (info->new_level > 1 &&
|
||||||
|
- (info->component_size & 7))
|
||||||
|
+ if (info->new_level > 1 && (info->component_size & 7))
|
||||||
|
return "Cannot convert RAID1 of this size - reduce size to multiple of 4K first.";
|
||||||
|
if (info->new_level == 0) {
|
||||||
|
if (info->delta_disks != UnSet &&
|
||||||
|
@@ -1288,12 +1287,9 @@ char *analyse_change(char *devname, struct mdinfo *info, struct reshape *re)
|
||||||
|
re->level = 1;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
- if (info->array.raid_disks != 2 &&
|
||||||
|
- info->new_level == 5)
|
||||||
|
+ if (info->array.raid_disks != 2 && info->new_level == 5)
|
||||||
|
return "Can only convert a 2-device array to RAID5";
|
||||||
|
- if (info->array.raid_disks == 2 &&
|
||||||
|
- info->new_level == 5) {
|
||||||
|
-
|
||||||
|
+ if (info->array.raid_disks == 2 && info->new_level == 5) {
|
||||||
|
re->level = 5;
|
||||||
|
re->before.data_disks = 1;
|
||||||
|
if (info->delta_disks != UnSet &&
|
||||||
|
@@ -1404,7 +1400,8 @@ char *analyse_change(char *devname, struct mdinfo *info, struct reshape *re)
|
||||||
|
case 0:
|
||||||
|
/* RAID0 can be converted to RAID10, or to RAID456 */
|
||||||
|
if (info->new_level == 10) {
|
||||||
|
- if (info->new_layout == UnSet && info->delta_disks == UnSet) {
|
||||||
|
+ if (info->new_layout == UnSet &&
|
||||||
|
+ info->delta_disks == UnSet) {
|
||||||
|
/* Assume near=2 layout */
|
||||||
|
info->new_layout = 0x102;
|
||||||
|
info->delta_disks = info->array.raid_disks;
|
||||||
|
@@ -1643,16 +1640,19 @@ char *analyse_change(char *devname, struct mdinfo *info, struct reshape *re)
|
||||||
|
if (info->delta_disks == UnSet)
|
||||||
|
info->delta_disks = delta_parity;
|
||||||
|
|
||||||
|
- re->after.data_disks = (re->before.data_disks
|
||||||
|
- + info->delta_disks
|
||||||
|
- - delta_parity);
|
||||||
|
+ re->after.data_disks =
|
||||||
|
+ (re->before.data_disks + info->delta_disks - delta_parity);
|
||||||
|
+
|
||||||
|
switch (re->level) {
|
||||||
|
- case 6: re->parity = 2;
|
||||||
|
+ case 6:
|
||||||
|
+ re->parity = 2;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
- case 5: re->parity = 1;
|
||||||
|
+ case 5:
|
||||||
|
+ re->parity = 1;
|
||||||
|
break;
|
||||||
|
- default: re->parity = 0;
|
||||||
|
+ default:
|
||||||
|
+ re->parity = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* So we have a restripe operation, we need to calculate the number
|
||||||
|
@@ -1706,7 +1706,7 @@ static int set_array_size(struct supertype *st, struct mdinfo *sra,
|
||||||
|
|
||||||
|
if (text_version == NULL)
|
||||||
|
text_version = sra->text_version;
|
||||||
|
- subarray = strchr(text_version+1, '/')+1;
|
||||||
|
+ subarray = strchr(text_version + 1, '/')+1;
|
||||||
|
info = st->ss->container_content(st, subarray);
|
||||||
|
if (info) {
|
||||||
|
unsigned long long current_size = 0;
|
||||||
|
@@ -1789,8 +1789,8 @@ int Grow_reshape(char *devname, int fd,
|
||||||
|
devname);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
- if (data_offset != INVALID_SECTORS && array.level != 10
|
||||||
|
- && (array.level < 4 || array.level > 6)) {
|
||||||
|
+ if (data_offset != INVALID_SECTORS && array.level != 10 &&
|
||||||
|
+ (array.level < 4 || array.level > 6)) {
|
||||||
|
pr_err("--grow --data-offset not yet supported\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
@@ -1802,8 +1802,8 @@ int Grow_reshape(char *devname, int fd,
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (s->raiddisks && s->raiddisks < array.raid_disks && array.level > 1 &&
|
||||||
|
- get_linux_version() < 2006032 &&
|
||||||
|
+ if (s->raiddisks && s->raiddisks < array.raid_disks &&
|
||||||
|
+ array.level > 1 && get_linux_version() < 2006032 &&
|
||||||
|
!check_env("MDADM_FORCE_FEWER")) {
|
||||||
|
pr_err("reducing the number of devices is not safe before Linux 2.6.32\n"
|
||||||
|
" Please use a newer kernel\n");
|
||||||
|
@@ -1873,10 +1873,11 @@ int Grow_reshape(char *devname, int fd,
|
||||||
|
/* check if reshape is allowed based on metadata
|
||||||
|
* indications stored in content.array.status
|
||||||
|
*/
|
||||||
|
- if (content->array.state & (1<<MD_SB_BLOCK_VOLUME))
|
||||||
|
+ if (content->array.state &
|
||||||
|
+ (1 << MD_SB_BLOCK_VOLUME))
|
||||||
|
allow_reshape = 0;
|
||||||
|
- if (content->array.state
|
||||||
|
- & (1<<MD_SB_BLOCK_CONTAINER_RESHAPE))
|
||||||
|
+ if (content->array.state &
|
||||||
|
+ (1 << MD_SB_BLOCK_CONTAINER_RESHAPE))
|
||||||
|
allow_reshape = 0;
|
||||||
|
if (!allow_reshape) {
|
||||||
|
pr_err("cannot reshape arrays in container with unsupported metadata: %s(%s)\n",
|
||||||
|
@@ -1896,7 +1897,7 @@ int Grow_reshape(char *devname, int fd,
|
||||||
|
for (dv = devlist; dv; dv = dv->next)
|
||||||
|
added_disks++;
|
||||||
|
if (s->raiddisks > array.raid_disks &&
|
||||||
|
- array.spare_disks +added_disks < (s->raiddisks - array.raid_disks) &&
|
||||||
|
+ array.spare_disks + added_disks < (s->raiddisks - array.raid_disks) &&
|
||||||
|
!c->force) {
|
||||||
|
pr_err("Need %d spare%s to avoid degraded array, and only have %d.\n"
|
||||||
|
" Use --force to over-ride this check.\n",
|
||||||
|
@@ -1906,8 +1907,8 @@ int Grow_reshape(char *devname, int fd,
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
- sra = sysfs_read(fd, NULL, GET_LEVEL | GET_DISKS | GET_DEVS
|
||||||
|
- | GET_STATE | GET_VERSION);
|
||||||
|
+ sra = sysfs_read(fd, NULL, GET_LEVEL | GET_DISKS | GET_DEVS |
|
||||||
|
+ GET_STATE | GET_VERSION);
|
||||||
|
if (sra) {
|
||||||
|
if (st->ss->external && subarray == NULL) {
|
||||||
|
array.level = LEVEL_CONTAINER;
|
||||||
|
@@ -1930,7 +1931,8 @@ int Grow_reshape(char *devname, int fd,
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ========= set size =============== */
|
||||||
|
- if (s->size > 0 && (s->size == MAX_SIZE || s->size != (unsigned)array.size)) {
|
||||||
|
+ if (s->size > 0 &&
|
||||||
|
+ (s->size == MAX_SIZE || s->size != (unsigned)array.size)) {
|
||||||
|
unsigned long long orig_size = get_component_size(fd)/2;
|
||||||
|
unsigned long long min_csize;
|
||||||
|
struct mdinfo *mdi;
|
||||||
|
@@ -1946,7 +1948,8 @@ int Grow_reshape(char *devname, int fd,
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reshape_super(st, s->size, UnSet, UnSet, 0, 0, UnSet, NULL,
|
||||||
|
- devname, APPLY_METADATA_CHANGES, c->verbose > 0)) {
|
||||||
|
+ devname, APPLY_METADATA_CHANGES,
|
||||||
|
+ c->verbose > 0)) {
|
||||||
|
rv = 1;
|
||||||
|
goto release;
|
||||||
|
}
|
||||||
|
@@ -1965,7 +1968,8 @@ int Grow_reshape(char *devname, int fd,
|
||||||
|
sizeinfo->array.layout,
|
||||||
|
sizeinfo->array.raid_disks);
|
||||||
|
new_size /= data_disks;
|
||||||
|
- dprintf("Metadata size correction from %llu to %llu (%llu)\n", orig_size, new_size,
|
||||||
|
+ dprintf("Metadata size correction from %llu to %llu (%llu)\n",
|
||||||
|
+ orig_size, new_size,
|
||||||
|
new_size * data_disks);
|
||||||
|
s->size = new_size;
|
||||||
|
sysfs_free(sizeinfo);
|
||||||
|
--
|
||||||
|
2.10.2
|
||||||
|
|
51
0034-Grow-Remove-unnecessary-optimization.patch
Normal file
51
0034-Grow-Remove-unnecessary-optimization.patch
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
From 758b327cf5a7aab50ae5c70ecbc371dc4f715bb6 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jes Sorensen <jes@wobbly.dhcp.thefacebook.com>
|
||||||
|
Date: Thu, 30 Mar 2017 10:39:29 -0400
|
||||||
|
Subject: [PATCH] Grow: Remove unnecessary optimization
|
||||||
|
|
||||||
|
Per explanation by Neil, this optimization of writing "size" to the
|
||||||
|
attribute of each device, however when reducing the size of devices,
|
||||||
|
the size change isn't permitted until the array has been shrunk, so
|
||||||
|
this will fail anyway.
|
||||||
|
|
||||||
|
This effectively reverts 65a9798b58b4e4de0157043e2b30a738c27eff43
|
||||||
|
|
||||||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
|
---
|
||||||
|
Grow.c | 12 ------------
|
||||||
|
1 file changed, 12 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/Grow.c b/Grow.c
|
||||||
|
index af8d520..0d551ce 100755
|
||||||
|
--- a/Grow.c
|
||||||
|
+++ b/Grow.c
|
||||||
|
@@ -1982,15 +1982,7 @@ int Grow_reshape(char *devname, int fd,
|
||||||
|
* understands '0' to mean 'max'.
|
||||||
|
*/
|
||||||
|
min_csize = 0;
|
||||||
|
- rv = 0;
|
||||||
|
for (mdi = sra->devs; mdi; mdi = mdi->next) {
|
||||||
|
- if (sysfs_set_num(sra, mdi, "size",
|
||||||
|
- s->size == MAX_SIZE ? 0 : s->size) < 0) {
|
||||||
|
- /* Probably kernel refusing to let us
|
||||||
|
- * reduce the size - not an error.
|
||||||
|
- */
|
||||||
|
- break;
|
||||||
|
- }
|
||||||
|
if (array.not_persistent == 0 &&
|
||||||
|
array.major_version == 0 &&
|
||||||
|
get_linux_version() < 3001000) {
|
||||||
|
@@ -2005,10 +1997,6 @@ int Grow_reshape(char *devname, int fd,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
- if (rv) {
|
||||||
|
- pr_err("Cannot set size on array members.\n");
|
||||||
|
- goto size_change_error;
|
||||||
|
- }
|
||||||
|
if (min_csize && s->size > min_csize) {
|
||||||
|
pr_err("Cannot safely make this array use more than 2TB per device on this kernel.\n");
|
||||||
|
rv = 1;
|
||||||
|
--
|
||||||
|
2.10.2
|
||||||
|
|
41
0035-Grow-Do-not-shadow-an-existing-variable.patch
Normal file
41
0035-Grow-Do-not-shadow-an-existing-variable.patch
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
From 49948a3561dcd48a94b1c5e98a6d23c9263d1ca3 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
|
Date: Thu, 30 Mar 2017 10:46:01 -0400
|
||||||
|
Subject: [PATCH] Grow: Do not shadow an existing variable
|
||||||
|
|
||||||
|
Declaring 'int rv' twice within the same function is asking for
|
||||||
|
trouble.
|
||||||
|
|
||||||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
|
---
|
||||||
|
Grow.c | 6 +++---
|
||||||
|
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/Grow.c b/Grow.c
|
||||||
|
index 0d551ce..0c16d5b 100755
|
||||||
|
--- a/Grow.c
|
||||||
|
+++ b/Grow.c
|
||||||
|
@@ -1834,7 +1834,7 @@ int Grow_reshape(char *devname, int fd,
|
||||||
|
* pre-requisite spare devices (mdmon owns final validation)
|
||||||
|
*/
|
||||||
|
if (st->ss->external) {
|
||||||
|
- int rv;
|
||||||
|
+ int retval;
|
||||||
|
|
||||||
|
if (subarray) {
|
||||||
|
container = st->container_devnm;
|
||||||
|
@@ -1852,9 +1852,9 @@ int Grow_reshape(char *devname, int fd,
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
- rv = st->ss->load_container(st, cfd, NULL);
|
||||||
|
+ retval = st->ss->load_container(st, cfd, NULL);
|
||||||
|
|
||||||
|
- if (rv) {
|
||||||
|
+ if (retval) {
|
||||||
|
pr_err("Cannot read superblock for %s\n",
|
||||||
|
devname);
|
||||||
|
free(subarray);
|
||||||
|
--
|
||||||
|
2.10.2
|
||||||
|
|
139
0036-imsm-use-rounded-size-for-metadata-initialization.patch
Normal file
139
0036-imsm-use-rounded-size-for-metadata-initialization.patch
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
From b53bfba6119d3f6f56eb9e10e5a59da6901af159 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
|
||||||
|
Date: Thu, 30 Mar 2017 16:25:41 +0200
|
||||||
|
Subject: [PATCH] imsm: use rounded size for metadata initialization
|
||||||
|
|
||||||
|
Array size is rounded to the nearest MB, however number of data stripes
|
||||||
|
and blocks per disk are calculated using size passed by the user. If
|
||||||
|
given size is not aligned, there is a mismatch. It's not possible to
|
||||||
|
assemble raid0 migrated to raid5 since raid5 arrays use number of data
|
||||||
|
stripes to calculate array size.
|
||||||
|
|
||||||
|
Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
|
||||||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
|
---
|
||||||
|
super-intel.c | 52 ++++++++++++++++++++++++++++++++++------------------
|
||||||
|
1 file changed, 34 insertions(+), 18 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/super-intel.c b/super-intel.c
|
||||||
|
index 785488a..84dfe2b 100644
|
||||||
|
--- a/super-intel.c
|
||||||
|
+++ b/super-intel.c
|
||||||
|
@@ -264,6 +264,8 @@ struct bbm_log {
|
||||||
|
static char *map_state_str[] = { "normal", "uninitialized", "degraded", "failed" };
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+#define BLOCKS_PER_KB (1024/512)
|
||||||
|
+
|
||||||
|
#define RAID_DISK_RESERVED_BLOCKS_IMSM_HI 2209
|
||||||
|
|
||||||
|
#define GEN_MIGR_AREA_SIZE 2048 /* General Migration Copy Area size in blocks */
|
||||||
|
@@ -1324,6 +1326,19 @@ static int is_journal(struct imsm_disk *disk)
|
||||||
|
return (disk->status & JOURNAL_DISK) == JOURNAL_DISK;
|
||||||
|
}
|
||||||
|
|
||||||
|
+/* round array size down to closest MB and ensure it splits evenly
|
||||||
|
+ * between members
|
||||||
|
+ */
|
||||||
|
+static unsigned long long round_size_to_mb(unsigned long long size, unsigned int
|
||||||
|
+ disk_count)
|
||||||
|
+{
|
||||||
|
+ size /= disk_count;
|
||||||
|
+ size = (size >> SECT_PER_MB_SHIFT) << SECT_PER_MB_SHIFT;
|
||||||
|
+ size *= disk_count;
|
||||||
|
+
|
||||||
|
+ return size;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/* try to determine how much space is reserved for metadata from
|
||||||
|
* the last get_extents() entry on the smallest active disk,
|
||||||
|
* otherwise fallback to the default
|
||||||
|
@@ -3330,11 +3345,10 @@ static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info,
|
||||||
|
if (used_disks > 0) {
|
||||||
|
array_blocks = blocks_per_member(map) *
|
||||||
|
used_disks;
|
||||||
|
- /* round array size down to closest MB
|
||||||
|
- */
|
||||||
|
- info->custom_array_size = (array_blocks
|
||||||
|
- >> SECT_PER_MB_SHIFT)
|
||||||
|
- << SECT_PER_MB_SHIFT;
|
||||||
|
+ info->custom_array_size =
|
||||||
|
+ round_size_to_mb(array_blocks,
|
||||||
|
+ used_disks);
|
||||||
|
+
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case MIGR_VERIFY:
|
||||||
|
@@ -5241,6 +5255,8 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info,
|
||||||
|
unsigned long long array_blocks;
|
||||||
|
size_t size_old, size_new;
|
||||||
|
unsigned long long num_data_stripes;
|
||||||
|
+ unsigned int data_disks;
|
||||||
|
+ unsigned long long size_per_member;
|
||||||
|
|
||||||
|
if (super->orom && mpb->num_raid_devs >= super->orom->vpa) {
|
||||||
|
pr_err("This imsm-container already has the maximum of %d volumes\n", super->orom->vpa);
|
||||||
|
@@ -5317,9 +5333,11 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info,
|
||||||
|
strncpy((char *) dev->volume, name, MAX_RAID_SERIAL_LEN);
|
||||||
|
array_blocks = calc_array_size(info->level, info->raid_disks,
|
||||||
|
info->layout, info->chunk_size,
|
||||||
|
- s->size * 2);
|
||||||
|
- /* round array size down to closest MB */
|
||||||
|
- array_blocks = (array_blocks >> SECT_PER_MB_SHIFT) << SECT_PER_MB_SHIFT;
|
||||||
|
+ s->size * BLOCKS_PER_KB);
|
||||||
|
+ data_disks = get_data_disks(info->level, info->layout,
|
||||||
|
+ info->raid_disks);
|
||||||
|
+ array_blocks = round_size_to_mb(array_blocks, data_disks);
|
||||||
|
+ size_per_member = array_blocks / data_disks;
|
||||||
|
|
||||||
|
dev->size_low = __cpu_to_le32((__u32) array_blocks);
|
||||||
|
dev->size_high = __cpu_to_le32((__u32) (array_blocks >> 32));
|
||||||
|
@@ -5331,7 +5349,9 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info,
|
||||||
|
vol->curr_migr_unit = 0;
|
||||||
|
map = get_imsm_map(dev, MAP_0);
|
||||||
|
set_pba_of_lba0(map, super->create_offset);
|
||||||
|
- set_blocks_per_member(map, info_to_blocks_per_member(info, s->size));
|
||||||
|
+ set_blocks_per_member(map, info_to_blocks_per_member(info,
|
||||||
|
+ size_per_member /
|
||||||
|
+ BLOCKS_PER_KB));
|
||||||
|
map->blocks_per_strip = __cpu_to_le16(info_to_blocks_per_strip(info));
|
||||||
|
map->failed_disk_num = ~0;
|
||||||
|
if (info->level > 0)
|
||||||
|
@@ -5359,7 +5379,7 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info,
|
||||||
|
map->num_domains = 1;
|
||||||
|
|
||||||
|
/* info->size is only int so use the 'size' parameter instead */
|
||||||
|
- num_data_stripes = (s->size * 2) / info_to_blocks_per_strip(info);
|
||||||
|
+ num_data_stripes = size_per_member / info_to_blocks_per_strip(info);
|
||||||
|
num_data_stripes /= map->num_domains;
|
||||||
|
set_num_data_stripes(map, num_data_stripes);
|
||||||
|
|
||||||
|
@@ -7981,9 +8001,7 @@ static unsigned long long imsm_set_array_size(struct imsm_dev *dev,
|
||||||
|
array_blocks = new_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
- /* round array size down to closest MB
|
||||||
|
- */
|
||||||
|
- array_blocks = (array_blocks >> SECT_PER_MB_SHIFT) << SECT_PER_MB_SHIFT;
|
||||||
|
+ array_blocks = round_size_to_mb(array_blocks, used_disks);
|
||||||
|
dev->size_low = __cpu_to_le32((__u32)array_blocks);
|
||||||
|
dev->size_high = __cpu_to_le32((__u32)(array_blocks >> 32));
|
||||||
|
|
||||||
|
@@ -8096,11 +8114,9 @@ static int imsm_set_array_state(struct active_array *a, int consistent)
|
||||||
|
array_blocks =
|
||||||
|
blocks_per_member(map) *
|
||||||
|
used_disks;
|
||||||
|
- /* round array size down to closest MB
|
||||||
|
- */
|
||||||
|
- array_blocks = (array_blocks
|
||||||
|
- >> SECT_PER_MB_SHIFT)
|
||||||
|
- << SECT_PER_MB_SHIFT;
|
||||||
|
+ array_blocks =
|
||||||
|
+ round_size_to_mb(array_blocks,
|
||||||
|
+ used_disks);
|
||||||
|
a->info.custom_array_size = array_blocks;
|
||||||
|
/* encourage manager to update array
|
||||||
|
* size
|
||||||
|
--
|
||||||
|
2.10.2
|
||||||
|
|
@ -0,0 +1,44 @@
|
|||||||
|
From 13428e2e76e8149336282d514908ced424f878a2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Gioh Kim <gi-oh.kim@profitbricks.com>
|
||||||
|
Date: Thu, 30 Mar 2017 18:58:13 +0200
|
||||||
|
Subject: [PATCH] mdadm.c: fix compile error "switch condition has boolean
|
||||||
|
value"
|
||||||
|
|
||||||
|
Remove a boolean expression in switch condition
|
||||||
|
to prevent compile error of some compilers,
|
||||||
|
for example, gcc version 5.2.1 20151010 (Ubuntu 5.2.1-22ubuntu2).
|
||||||
|
|
||||||
|
Signed-off-by: Gioh Kim <gi-oh.kim@profitbricks.com>
|
||||||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
|
---
|
||||||
|
mdadm.c | 14 ++++++--------
|
||||||
|
1 file changed, 6 insertions(+), 8 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/mdadm.c b/mdadm.c
|
||||||
|
index 0f32773..d6b5437 100644
|
||||||
|
--- a/mdadm.c
|
||||||
|
+++ b/mdadm.c
|
||||||
|
@@ -1965,14 +1965,12 @@ static int misc_list(struct mddev_dev *devlist,
|
||||||
|
rv |= SetAction(dv->devname, c->action);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
- switch(dv->devname[0] == '/') {
|
||||||
|
- case 0:
|
||||||
|
- mdfd = open_dev(dv->devname);
|
||||||
|
- if (mdfd >= 0)
|
||||||
|
- break;
|
||||||
|
- case 1:
|
||||||
|
- mdfd = open_mddev(dv->devname, 1);
|
||||||
|
- }
|
||||||
|
+
|
||||||
|
+ if (dv->devname[0] != '/')
|
||||||
|
+ mdfd = open_dev(dv->devname);
|
||||||
|
+ if (dv->devname[0] == '/' || mdfd < 0)
|
||||||
|
+ mdfd = open_mddev(dv->devname, 1);
|
||||||
|
+
|
||||||
|
if (mdfd >= 0) {
|
||||||
|
switch(dv->disposition) {
|
||||||
|
case 'R':
|
||||||
|
--
|
||||||
|
2.12.0
|
||||||
|
|
@ -0,0 +1,76 @@
|
|||||||
|
From cf622ec1d81a5bb3f882922667bac494b3a16581 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
|
Date: Wed, 5 Apr 2017 11:53:12 -0400
|
||||||
|
Subject: [PATCH] Create: Fixup bad placement of logical || && in multi-line if
|
||||||
|
statements
|
||||||
|
|
||||||
|
These always go at the end of the line, never at the front
|
||||||
|
|
||||||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
|
---
|
||||||
|
Create.c | 28 +++++++++++-----------------
|
||||||
|
1 file changed, 11 insertions(+), 17 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/Create.c b/Create.c
|
||||||
|
index ba24606..17333ce 100644
|
||||||
|
--- a/Create.c
|
||||||
|
+++ b/Create.c
|
||||||
|
@@ -457,8 +457,8 @@ int Create(struct supertype *st, char *mddev,
|
||||||
|
st->minor_version >= 1)
|
||||||
|
/* metadata at front */
|
||||||
|
warn |= check_partitions(fd, dname, 0, 0);
|
||||||
|
- else if (s->level == 1 || s->level == LEVEL_CONTAINER
|
||||||
|
- || (s->level == 0 && s->raiddisks == 1))
|
||||||
|
+ else if (s->level == 1 || s->level == LEVEL_CONTAINER ||
|
||||||
|
+ (s->level == 0 && s->raiddisks == 1))
|
||||||
|
/* partitions could be meaningful */
|
||||||
|
warn |= check_partitions(fd, dname, freesize*2, s->size*2);
|
||||||
|
else
|
||||||
|
@@ -495,9 +495,8 @@ int Create(struct supertype *st, char *mddev,
|
||||||
|
pr_err("no size and no drives given - aborting create.\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
- if (s->level > 0 || s->level == LEVEL_MULTIPATH
|
||||||
|
- || s->level == LEVEL_FAULTY
|
||||||
|
- || st->ss->external ) {
|
||||||
|
+ if (s->level > 0 || s->level == LEVEL_MULTIPATH ||
|
||||||
|
+ s->level == LEVEL_FAULTY || st->ss->external ) {
|
||||||
|
/* size is meaningful */
|
||||||
|
if (!st->ss->validate_geometry(st, s->level, s->layout,
|
||||||
|
s->raiddisks,
|
||||||
|
@@ -616,8 +615,8 @@ int Create(struct supertype *st, char *mddev,
|
||||||
|
* it could be in conflict with already existing device
|
||||||
|
* e.g. container, array
|
||||||
|
*/
|
||||||
|
- if (strncmp(chosen_name, "/dev/md/", 8) == 0
|
||||||
|
- && map_by_name(&map, chosen_name+8) != NULL) {
|
||||||
|
+ if (strncmp(chosen_name, "/dev/md/", 8) == 0 &&
|
||||||
|
+ map_by_name(&map, chosen_name+8) != NULL) {
|
||||||
|
pr_err("Array name %s is in use already.\n",
|
||||||
|
chosen_name);
|
||||||
|
close(mdfd);
|
||||||
|
@@ -653,16 +652,11 @@ int Create(struct supertype *st, char *mddev,
|
||||||
|
info.array.md_minor = minor(stb.st_rdev);
|
||||||
|
info.array.not_persistent = 0;
|
||||||
|
|
||||||
|
- if ( ( (s->level == 4 || s->level == 5) &&
|
||||||
|
- (insert_point < s->raiddisks || first_missing < s->raiddisks) )
|
||||||
|
- ||
|
||||||
|
- ( s->level == 6 && (insert_point < s->raiddisks
|
||||||
|
- || second_missing < s->raiddisks))
|
||||||
|
- ||
|
||||||
|
- ( s->level <= 0 )
|
||||||
|
- ||
|
||||||
|
- s->assume_clean
|
||||||
|
- ) {
|
||||||
|
+ if (((s->level == 4 || s->level == 5) &&
|
||||||
|
+ (insert_point < s->raiddisks || first_missing < s->raiddisks)) ||
|
||||||
|
+ (s->level == 6 && (insert_point < s->raiddisks ||
|
||||||
|
+ second_missing < s->raiddisks)) ||
|
||||||
|
+ (s->level <= 0) || s->assume_clean) {
|
||||||
|
info.array.state = 1; /* clean, but one+ drive will be missing*/
|
||||||
|
info.resync_start = MaxSector;
|
||||||
|
} else {
|
||||||
|
--
|
||||||
|
2.12.0
|
||||||
|
|
164
0039-Create-Fixup-various-whitespace-issues.patch
Normal file
164
0039-Create-Fixup-various-whitespace-issues.patch
Normal file
@ -0,0 +1,164 @@
|
|||||||
|
From 98dbf73cba81cd846f9c706f37edc22e21038cf4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
|
Date: Wed, 5 Apr 2017 11:57:30 -0400
|
||||||
|
Subject: [PATCH] Create: Fixup various whitespace issues
|
||||||
|
|
||||||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
|
---
|
||||||
|
Create.c | 50 ++++++++++++++++++++++++--------------------------
|
||||||
|
1 file changed, 24 insertions(+), 26 deletions(-)
|
||||||
|
|
||||||
|
Index: mdadm/Create.c
|
||||||
|
===================================================================
|
||||||
|
--- mdadm.orig/Create.c
|
||||||
|
+++ mdadm/Create.c
|
||||||
|
@@ -84,12 +84,12 @@ int Create(struct supertype *st, char *m
|
||||||
|
* RUN_ARRAY
|
||||||
|
*/
|
||||||
|
int mdfd;
|
||||||
|
- unsigned long long minsize=0, maxsize=0;
|
||||||
|
+ unsigned long long minsize = 0, maxsize = 0;
|
||||||
|
char *mindisc = NULL;
|
||||||
|
char *maxdisc = NULL;
|
||||||
|
int dnum, raid_disk_num;
|
||||||
|
struct mddev_dev *dv;
|
||||||
|
- int fail=0, warn=0;
|
||||||
|
+ int fail = 0, warn = 0;
|
||||||
|
struct stat stb;
|
||||||
|
int first_missing = subdevs * 2;
|
||||||
|
int second_missing = subdevs * 2;
|
||||||
|
@@ -260,7 +260,7 @@ int Create(struct supertype *st, char *m
|
||||||
|
&s->chunk, s->size*2,
|
||||||
|
data_offset, NULL,
|
||||||
|
&newsize, s->consistency_policy,
|
||||||
|
- c->verbose>=0))
|
||||||
|
+ c->verbose >= 0))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (s->chunk && s->chunk != UnSet) {
|
||||||
|
@@ -291,7 +291,7 @@ int Create(struct supertype *st, char *m
|
||||||
|
info.array.active_disks = 0;
|
||||||
|
info.array.working_disks = 0;
|
||||||
|
dnum = 0;
|
||||||
|
- for (dv = devlist; dv ; dv = dv->next)
|
||||||
|
+ for (dv = devlist; dv; dv = dv->next)
|
||||||
|
if (data_offset == VARIABLE_OFFSET)
|
||||||
|
dv->data_offset = INVALID_SECTORS;
|
||||||
|
else
|
||||||
|
@@ -303,7 +303,7 @@ int Create(struct supertype *st, char *m
|
||||||
|
int dfd;
|
||||||
|
char *doff;
|
||||||
|
|
||||||
|
- if (strcasecmp(dname, "missing")==0) {
|
||||||
|
+ if (strcasecmp(dname, "missing") == 0) {
|
||||||
|
if (first_missing > dnum)
|
||||||
|
first_missing = dnum;
|
||||||
|
if (second_missing > dnum && dnum > first_missing)
|
||||||
|
@@ -349,7 +349,7 @@ int Create(struct supertype *st, char *m
|
||||||
|
*/
|
||||||
|
int i;
|
||||||
|
char *name = "default";
|
||||||
|
- for(i=0; !st && superlist[i]; i++) {
|
||||||
|
+ for(i = 0; !st && superlist[i]; i++) {
|
||||||
|
st = superlist[i]->match_metadata_desc(name);
|
||||||
|
if (!st)
|
||||||
|
continue;
|
||||||
|
@@ -445,10 +445,10 @@ int Create(struct supertype *st, char *m
|
||||||
|
skip_size_check:
|
||||||
|
if (c->runstop != 1 || c->verbose >= 0) {
|
||||||
|
int fd = open(dname, O_RDONLY);
|
||||||
|
- if (fd <0 ) {
|
||||||
|
+ if (fd < 0) {
|
||||||
|
pr_err("Cannot open %s: %s\n",
|
||||||
|
dname, strerror(errno));
|
||||||
|
- fail=1;
|
||||||
|
+ fail = 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
warn |= check_ext2(fd, dname);
|
||||||
|
@@ -497,7 +497,7 @@ int Create(struct supertype *st, char *m
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (s->level > 0 || s->level == LEVEL_MULTIPATH ||
|
||||||
|
- s->level == LEVEL_FAULTY || st->ss->external ) {
|
||||||
|
+ s->level == LEVEL_FAULTY || st->ss->external) {
|
||||||
|
/* size is meaningful */
|
||||||
|
if (!st->ss->validate_geometry(st, s->level, s->layout,
|
||||||
|
s->raiddisks,
|
||||||
|
@@ -572,9 +572,9 @@ int Create(struct supertype *st, char *m
|
||||||
|
* as missing, so that a reconstruct happens (faster than re-parity)
|
||||||
|
* FIX: Can we do this for raid6 as well?
|
||||||
|
*/
|
||||||
|
- if (st->ss->external == 0 &&
|
||||||
|
- s->assume_clean==0 && c->force == 0 && first_missing >= s->raiddisks) {
|
||||||
|
- switch ( s->level ) {
|
||||||
|
+ if (st->ss->external == 0 && s->assume_clean == 0 &&
|
||||||
|
+ c->force == 0 && first_missing >= s->raiddisks) {
|
||||||
|
+ switch (s->level) {
|
||||||
|
case 4:
|
||||||
|
case 5:
|
||||||
|
insert_point = s->raiddisks-1;
|
||||||
|
@@ -649,7 +649,7 @@ int Create(struct supertype *st, char *m
|
||||||
|
* with, but it chooses to trust me instead. Sigh
|
||||||
|
*/
|
||||||
|
info.array.md_minor = 0;
|
||||||
|
- if (fstat(mdfd, &stb)==0)
|
||||||
|
+ if (fstat(mdfd, &stb) == 0)
|
||||||
|
info.array.md_minor = minor(stb.st_rdev);
|
||||||
|
info.array.not_persistent = 0;
|
||||||
|
|
||||||
|
@@ -715,13 +715,11 @@ int Create(struct supertype *st, char *m
|
||||||
|
name = strrchr(mddev, '/');
|
||||||
|
if (name) {
|
||||||
|
name++;
|
||||||
|
- if (strncmp(name, "md_", 3)==0 &&
|
||||||
|
- strlen(name) > 3 &&
|
||||||
|
- (name-mddev) == 5 /* /dev/ */)
|
||||||
|
+ if (strncmp(name, "md_", 3) == 0 &&
|
||||||
|
+ strlen(name) > 3 && (name-mddev) == 5 /* /dev/ */)
|
||||||
|
name += 3;
|
||||||
|
- else if (strncmp(name, "md", 2)==0 &&
|
||||||
|
- strlen(name) > 2 &&
|
||||||
|
- isdigit(name[2]) &&
|
||||||
|
+ else if (strncmp(name, "md", 2) == 0 &&
|
||||||
|
+ strlen(name) > 2 && isdigit(name[2]) &&
|
||||||
|
(name-mddev) == 5 /* /dev/ */)
|
||||||
|
name += 2;
|
||||||
|
}
|
||||||
|
@@ -769,9 +767,9 @@ int Create(struct supertype *st, char *m
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (s->bitmap_file && (strcmp(s->bitmap_file, "internal")==0 ||
|
||||||
|
- strcmp(s->bitmap_file, "clustered")==0)) {
|
||||||
|
- if ((vers%100) < 2) {
|
||||||
|
+ if (s->bitmap_file && (strcmp(s->bitmap_file, "internal") == 0 ||
|
||||||
|
+ strcmp(s->bitmap_file, "clustered") == 0)) {
|
||||||
|
+ if ((vers % 100) < 2) {
|
||||||
|
pr_err("internal bitmaps not supported by this kernel.\n");
|
||||||
|
goto abort_locked;
|
||||||
|
}
|
||||||
|
@@ -851,11 +849,11 @@ int Create(struct supertype *st, char *m
|
||||||
|
|
||||||
|
infos = xmalloc(sizeof(*infos) * total_slots);
|
||||||
|
enable_fds(total_slots);
|
||||||
|
- for (pass=1; pass <=2 ; pass++) {
|
||||||
|
+ for (pass = 1; pass <= 2; pass++) {
|
||||||
|
struct mddev_dev *moved_disk = NULL; /* the disk that was moved out of the insert point */
|
||||||
|
|
||||||
|
- for (dnum=0, raid_disk_num=0, dv = devlist ; dv ;
|
||||||
|
- dv=(dv->next)?(dv->next):moved_disk, dnum++) {
|
||||||
|
+ for (dnum = 0, raid_disk_num = 0, dv = devlist; dv;
|
||||||
|
+ dv = (dv->next) ? (dv->next) : moved_disk, dnum++) {
|
||||||
|
int fd;
|
||||||
|
struct stat stb;
|
||||||
|
struct mdinfo *inf = &infos[dnum];
|
||||||
|
@@ -867,7 +865,7 @@ int Create(struct supertype *st, char *m
|
||||||
|
moved_disk = dv;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
- if (strcasecmp(dv->devname, "missing")==0) {
|
||||||
|
+ if (strcasecmp(dv->devname, "missing") == 0) {
|
||||||
|
raid_disk_num += 1;
|
||||||
|
continue;
|
||||||
|
}
|
28
0040-mdadm.c-fix-compile-warning-mdfd-is-uninitialized.patch
Normal file
28
0040-mdadm.c-fix-compile-warning-mdfd-is-uninitialized.patch
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
From 5fbc1f1527ec86ae904739a27c0af4e3bc89084e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Zhilong Liu <zlliu@suse.com>
|
||||||
|
Date: Mon, 10 Apr 2017 12:49:52 +0800
|
||||||
|
Subject: [PATCH] mdadm.c:fix compile warning "mdfd is uninitialized"
|
||||||
|
|
||||||
|
Initialized the mdfd as -1 to prevent compile error
|
||||||
|
of some compilers.
|
||||||
|
For example, gcc version 4.8.5(SUSE Linux).
|
||||||
|
|
||||||
|
Signed-off-by: Zhilong Liu <zlliu@suse.com>
|
||||||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||||||
|
---
|
||||||
|
mdadm.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
Index: mdadm/mdadm.c
|
||||||
|
===================================================================
|
||||||
|
--- mdadm.orig/mdadm.c
|
||||||
|
+++ mdadm/mdadm.c
|
||||||
|
@@ -1908,7 +1908,7 @@ static int misc_list(struct mddev_dev *d
|
||||||
|
int rv = 0;
|
||||||
|
|
||||||
|
for (dv = devlist; dv; dv = (rv & 16) ? NULL : dv->next) {
|
||||||
|
- int mdfd;
|
||||||
|
+ int mdfd = -1;
|
||||||
|
|
||||||
|
switch(dv->disposition) {
|
||||||
|
case 'D':
|
@ -0,0 +1,54 @@
|
|||||||
|
From 039df36231335fabe4da1a22fa3accb160d8bc1b Mon Sep 17 00:00:00 2001
|
||||||
|
From: NeilBrown <neilb@suse.com>
|
||||||
|
Date: Wed, 12 Apr 2017 16:29:04 +1000
|
||||||
|
Subject: [PATCH] mdopen: use parameters/new_array to create arrays whenever
|
||||||
|
possible.
|
||||||
|
|
||||||
|
In a sufficiently recent kernel, an md%d array can be
|
||||||
|
created by writing to .../parameters/new_array.
|
||||||
|
If mdadm does this consistently, then another new
|
||||||
|
feature, disabling create_on_open, can be enabled.
|
||||||
|
This avoids races on shutdown.
|
||||||
|
|
||||||
|
An added benefit of using new_array (where available)
|
||||||
|
is that it allows md arrays with numbers larger than 511
|
||||||
|
(e.g. md999) to be created. The old create_on_open
|
||||||
|
mechanism doesn't support such devices since
|
||||||
|
Commit: af5628f05db6 ("md: disable probing for md devices 512 and over.")
|
||||||
|
in Linux 3.17.
|
||||||
|
|
||||||
|
After a few more mdadm releases it would be good to
|
||||||
|
have mdadm disable create_on_open automatically.
|
||||||
|
|
||||||
|
Signed-off-by: NeilBrown <neilb@suse.com>
|
||||||
|
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
||||||
|
---
|
||||||
|
mdopen.c | 12 ++++++++++++
|
||||||
|
1 file changed, 12 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/mdopen.c b/mdopen.c
|
||||||
|
index fe240e5..82b97fc 100644
|
||||||
|
--- a/mdopen.c
|
||||||
|
+++ b/mdopen.c
|
||||||
|
@@ -313,6 +313,18 @@ int create_mddev(char *dev, char *name, int autof, int trustworthy,
|
||||||
|
if (n < 0)
|
||||||
|
devnm[0] = 0;
|
||||||
|
}
|
||||||
|
+ if (num >= 0) {
|
||||||
|
+ int fd;
|
||||||
|
+ int n = -1;
|
||||||
|
+ sprintf(devnm, "md%d", num);
|
||||||
|
+ fd = open("/sys/module/md_mod/parameters/new_array", O_WRONLY);
|
||||||
|
+ if (fd >= 0) {
|
||||||
|
+ n = write(fd, devnm, strlen(devnm));
|
||||||
|
+ close(fd);
|
||||||
|
+ }
|
||||||
|
+ if (n < 0)
|
||||||
|
+ devnm[0] = 0;
|
||||||
|
+ }
|
||||||
|
if (devnm[0])
|
||||||
|
;
|
||||||
|
else if (num < 0) {
|
||||||
|
--
|
||||||
|
2.10.2
|
||||||
|
|
@ -0,0 +1,43 @@
|
|||||||
|
From 8a70632fc2f9026e0f4895f5348cc7cd20d9fbb3 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Zhilong Liu <zlliu@suse.com>
|
||||||
|
Date: Wed, 12 Apr 2017 16:36:38 +0800
|
||||||
|
Subject: [PATCH] mdadm/manpage:update manpage for readonly parameter
|
||||||
|
|
||||||
|
update readonly in manpage:
|
||||||
|
Currently both the readwrite and readonly are worked well,
|
||||||
|
update the readonly section.
|
||||||
|
One commit in linux/driver/md. Cleared "MD_CLOSING bit" to
|
||||||
|
Fixes: af8d8e6f0315 ("md: changes for MD_STILL_CLOSED flag")
|
||||||
|
|
||||||
|
Signed-off-by: Zhilong Liu <zlliu@suse.com>
|
||||||
|
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
||||||
|
---
|
||||||
|
mdadm.8.in | 5 +++--
|
||||||
|
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/mdadm.8.in b/mdadm.8.in
|
||||||
|
index 744c12b..f10a8b8 100644
|
||||||
|
--- a/mdadm.8.in
|
||||||
|
+++ b/mdadm.8.in
|
||||||
|
@@ -925,7 +925,8 @@ will not try to be so clever.
|
||||||
|
Start the array
|
||||||
|
.B read only
|
||||||
|
rather than read-write as normal. No writes will be allowed to the
|
||||||
|
-array, and no resync, recovery, or reshape will be started.
|
||||||
|
+array, and no resync, recovery, or reshape will be started. It works with
|
||||||
|
+Create, Assemble, Manage and Misc mode.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.BR \-a ", " "\-\-auto{=yes,md,mdp,part,p}{NN}"
|
||||||
|
@@ -2232,7 +2233,7 @@ be in use.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.B \-\-readonly
|
||||||
|
-start the array readonly \(em not supported yet.
|
||||||
|
+start the array in readonly mode.
|
||||||
|
|
||||||
|
.SH MANAGE MODE
|
||||||
|
.HP 12
|
||||||
|
--
|
||||||
|
2.10.2
|
||||||
|
|
@ -0,0 +1,30 @@
|
|||||||
|
From e39c76b9b72db00d32780e9f30dfba25f58922d2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Zhilong Liu <zlliu@suse.com>
|
||||||
|
Date: Wed, 12 Apr 2017 16:37:27 +0800
|
||||||
|
Subject: [PATCH] mdadm/manpage:clustered arrays don't support array-size yet
|
||||||
|
|
||||||
|
Update manpage for array-size section:
|
||||||
|
Clustered arrays don't support the --array-size yet.
|
||||||
|
|
||||||
|
Signed-off-by: Zhilong Liu <zlliu@suse.com>
|
||||||
|
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
||||||
|
---
|
||||||
|
mdadm.8.in | 2 ++
|
||||||
|
1 file changed, 2 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/mdadm.8.in b/mdadm.8.in
|
||||||
|
index f10a8b8..fb99a5c 100644
|
||||||
|
--- a/mdadm.8.in
|
||||||
|
+++ b/mdadm.8.in
|
||||||
|
@@ -541,6 +541,8 @@ A value of
|
||||||
|
restores the apparent size of the array to be whatever the real
|
||||||
|
amount of available space is.
|
||||||
|
|
||||||
|
+Clustered arrays do not support this parameter yet.
|
||||||
|
+
|
||||||
|
.TP
|
||||||
|
.BR \-c ", " \-\-chunk=
|
||||||
|
Specify chunk size of kilobytes. The default when creating an
|
||||||
|
--
|
||||||
|
2.10.2
|
||||||
|
|
28
0044-maps-Terminate-modes-map-correctly.patch
Normal file
28
0044-maps-Terminate-modes-map-correctly.patch
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
From e47781fcea24778a16e4be53e5b84eab8db9413c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jes Sorensen <jsorensen@fb.com>
|
||||||
|
Date: Thu, 20 Apr 2017 00:13:31 -0400
|
||||||
|
Subject: [PATCH] maps: Terminate 'modes' map correctly.
|
||||||
|
|
||||||
|
While we are unlikely to fail here, terminate the modes map correctly
|
||||||
|
to ensure we don't start running over undefined data.
|
||||||
|
|
||||||
|
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
||||||
|
---
|
||||||
|
maps.c | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
diff --git a/maps.c b/maps.c
|
||||||
|
index a8a4639..a2d293b 100644
|
||||||
|
--- a/maps.c
|
||||||
|
+++ b/maps.c
|
||||||
|
@@ -106,6 +106,7 @@ mapping_t modes[] = {
|
||||||
|
{ "grow", GROW},
|
||||||
|
{ "incremental", INCREMENTAL},
|
||||||
|
{ "auto-detect", AUTODETECT},
|
||||||
|
+ { NULL, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
mapping_t faultylayout[] = {
|
||||||
|
--
|
||||||
|
2.10.2
|
||||||
|
|
@ -0,0 +1,36 @@
|
|||||||
|
From a250ce240f245df594570a5e25398680d403af67 Mon Sep 17 00:00:00 2001
|
||||||
|
From: NeilBrown <neilb@suse.com>
|
||||||
|
Date: Thu, 20 Apr 2017 12:40:05 +1000
|
||||||
|
Subject: [PATCH] Grow_continue_command: ensure 'content' is properly
|
||||||
|
initialised.
|
||||||
|
|
||||||
|
Grow_continue_command() call verify_reshape_position(), which assumes
|
||||||
|
that info->sys_name is initialised.
|
||||||
|
'info' in verify_reshape_position() is 'content' in Grow_continue_command().
|
||||||
|
|
||||||
|
In the st->ss->external != 0 branch of that function, sysfs_init() is called
|
||||||
|
to initialize content->sys_name.
|
||||||
|
In the st->ss->external == 0 branch, ->sys_name is not initialized so
|
||||||
|
verify_reshape_position() will not do the right thing.
|
||||||
|
|
||||||
|
Signed-off-by: NeilBrown <neilb@suse.com>
|
||||||
|
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
||||||
|
---
|
||||||
|
Grow.c | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
diff --git a/Grow.c b/Grow.c
|
||||||
|
index 15f4ed1..c6967ed 100755
|
||||||
|
--- a/Grow.c
|
||||||
|
+++ b/Grow.c
|
||||||
|
@@ -5002,6 +5002,7 @@ int Grow_continue_command(char *devname, int fd,
|
||||||
|
goto Grow_continue_command_exit;
|
||||||
|
}
|
||||||
|
content = &array;
|
||||||
|
+ sysfs_init(content, fd, NULL);
|
||||||
|
/* Need to load a superblock.
|
||||||
|
* FIXME we should really get what we need from
|
||||||
|
* sysfs
|
||||||
|
--
|
||||||
|
2.10.2
|
||||||
|
|
@ -0,0 +1,49 @@
|
|||||||
|
From 5c4b3b9aa9f576305b36d5ccbd4b929b51307ce9 Mon Sep 17 00:00:00 2001
|
||||||
|
From: NeilBrown <neilb@suse.com>
|
||||||
|
Date: Thu, 20 Apr 2017 12:40:05 +1000
|
||||||
|
Subject: [PATCH] systemd/mdadm-last-resort: use ConditionPathExists instead of
|
||||||
|
Conflicts
|
||||||
|
|
||||||
|
Commit cec72c071bbe ("systemd/mdadm-last-resort: add Conflicts to .service file.")
|
||||||
|
|
||||||
|
added a 'Conflicts' directive to the mdadm-last-resort@.service file in
|
||||||
|
the hope that this would make sure the service didn't run after the device
|
||||||
|
was active, even if the timer managed to get started, which is possible in
|
||||||
|
race conditions.
|
||||||
|
|
||||||
|
This seemed to work is testing, but it isn't clear why, and it is known
|
||||||
|
to cause problems.
|
||||||
|
If systemd happens to know that the mentioned device is a dependency of a
|
||||||
|
mount point, the Conflicts can unmount that mountpoint, which is certainly
|
||||||
|
not wanted.
|
||||||
|
|
||||||
|
So remove the "Conflicts" and instead use
|
||||||
|
ConditionPathExists=!/sys/devices/virtual/block/%i/md/sync_action
|
||||||
|
|
||||||
|
The "sync_action" file exists for any array which requires last-resort
|
||||||
|
handling, and only appears when the array is activated. So it is safe
|
||||||
|
to rely on it to determine if the last-resort is really needed.
|
||||||
|
|
||||||
|
Fixes: cec72c071bbe ("systemd/mdadm-last-resort: add Conflicts to .service file.")
|
||||||
|
Signed-off-by: NeilBrown <neilb@suse.com>
|
||||||
|
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
||||||
|
---
|
||||||
|
systemd/mdadm-last-resort@.service | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/systemd/mdadm-last-resort@.service b/systemd/mdadm-last-resort@.service
|
||||||
|
index e93d72b..f9d4d12 100644
|
||||||
|
--- a/systemd/mdadm-last-resort@.service
|
||||||
|
+++ b/systemd/mdadm-last-resort@.service
|
||||||
|
@@ -1,7 +1,7 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Activate md array even though degraded
|
||||||
|
DefaultDependencies=no
|
||||||
|
-Conflicts=sys-devices-virtual-block-%i.device
|
||||||
|
+ConditionPathExists=!/sys/devices/virtual/block/%i/md/sync_action
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
--
|
||||||
|
2.10.2
|
||||||
|
|
@ -0,0 +1,69 @@
|
|||||||
|
From b9c9bd9bacaab701d5b3cb3e4b6cb02ea8d36e47 Mon Sep 17 00:00:00 2001
|
||||||
|
From: NeilBrown <neilb@suse.com>
|
||||||
|
Date: Thu, 20 Apr 2017 12:40:06 +1000
|
||||||
|
Subject: [PATCH] Detail: ensure --export names are acceptable as shell
|
||||||
|
variables.
|
||||||
|
|
||||||
|
If an array contains a device which has a name that
|
||||||
|
contains something other than alphnumerics and underscores,
|
||||||
|
then some values reported by "mdadm --detail --export" will
|
||||||
|
not be valid as variable assignment of the shell.
|
||||||
|
This particularly affects dm devices.
|
||||||
|
e.g.
|
||||||
|
MD_DEVICE_dm-4_ROLE=1
|
||||||
|
MD_DEVICE_dm-4_DEV=/dev/dm-4
|
||||||
|
|
||||||
|
As it is particularly useful to be able to work with these
|
||||||
|
in a shell script, and as the precise name is not important,
|
||||||
|
change all non-alphanumerics to '_'.
|
||||||
|
|
||||||
|
MD_DEVICE_dm_4_ROLE=1
|
||||||
|
MD_DEVICE_dm_4_DEV=/dev/dm-4
|
||||||
|
|
||||||
|
Signed-off-by: NeilBrown <neilb@suse.com>
|
||||||
|
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
||||||
|
---
|
||||||
|
Detail.c | 12 +++++++++---
|
||||||
|
1 file changed, 9 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/Detail.c b/Detail.c
|
||||||
|
index e40cd8f..91c5a98 100644
|
||||||
|
--- a/Detail.c
|
||||||
|
+++ b/Detail.c
|
||||||
|
@@ -25,6 +25,7 @@
|
||||||
|
#include "mdadm.h"
|
||||||
|
#include "md_p.h"
|
||||||
|
#include "md_u.h"
|
||||||
|
+#include <ctype.h>
|
||||||
|
#include <dirent.h>
|
||||||
|
|
||||||
|
static int cmpstringp(const void *p1, const void *p2)
|
||||||
|
@@ -276,17 +277,22 @@ int Detail(char *dev, struct context *c)
|
||||||
|
char *path =
|
||||||
|
map_dev(mdi->disk.major,
|
||||||
|
mdi->disk.minor, 0);
|
||||||
|
+ char *sysdev = xstrdup(mdi->sys_name + 1);
|
||||||
|
+ char *cp;
|
||||||
|
+ for (cp = sysdev; *cp; cp++)
|
||||||
|
+ if (!isalnum(*cp))
|
||||||
|
+ *cp = '_';
|
||||||
|
|
||||||
|
if (mdi->disk.raid_disk >= 0)
|
||||||
|
printf("MD_DEVICE_%s_ROLE=%d\n",
|
||||||
|
- mdi->sys_name+4,
|
||||||
|
+ sysdev,
|
||||||
|
mdi->disk.raid_disk);
|
||||||
|
else
|
||||||
|
printf("MD_DEVICE_%s_ROLE=spare\n",
|
||||||
|
- mdi->sys_name+4);
|
||||||
|
+ sysdev);
|
||||||
|
if (path)
|
||||||
|
printf("MD_DEVICE_%s_DEV=%s\n",
|
||||||
|
- mdi->sys_name+4, path);
|
||||||
|
+ sysdev, path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
goto out;
|
||||||
|
--
|
||||||
|
2.10.2
|
||||||
|
|
33
0048-Grow-set-component-size-prior-to-array-size.patch
Normal file
33
0048-Grow-set-component-size-prior-to-array-size.patch
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
From 07c45a1871df0a70beb8da80d11601d33c7a5de2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
|
||||||
|
Date: Mon, 5 Jun 2017 16:09:44 +0200
|
||||||
|
Subject: [PATCH] Grow: set component size prior to array size
|
||||||
|
|
||||||
|
It is a partial revert of commit 758b327cf5a7 ("Grow: Remove unnecessary
|
||||||
|
optimization"). For native metadata component size is set in kernel for
|
||||||
|
entire disk space. As external metadata supports multiple arrays within
|
||||||
|
one disk, the component size is set to array size. If component size is
|
||||||
|
not updated prior to array size update, the grow operation fails.
|
||||||
|
|
||||||
|
Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
|
||||||
|
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
||||||
|
---
|
||||||
|
Grow.c | 2 ++
|
||||||
|
1 file changed, 2 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/Grow.c b/Grow.c
|
||||||
|
index ecf5ca0..4ecb1d8 100644
|
||||||
|
--- a/Grow.c
|
||||||
|
+++ b/Grow.c
|
||||||
|
@@ -1977,6 +1977,8 @@ int Grow_reshape(char *devname, int fd,
|
||||||
|
*/
|
||||||
|
min_csize = 0;
|
||||||
|
for (mdi = sra->devs; mdi; mdi = mdi->next) {
|
||||||
|
+ sysfs_set_num(sra, mdi, "size", s->size == MAX_SIZE ? 0
|
||||||
|
+ : s->size);
|
||||||
|
if (array.not_persistent == 0 &&
|
||||||
|
array.major_version == 0 &&
|
||||||
|
get_linux_version() < 3001000) {
|
||||||
|
--
|
||||||
|
2.12.0
|
||||||
|
|
@ -0,0 +1,47 @@
|
|||||||
|
From 922a58292fafa4efcfcd44fbc46b0665681c955a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
|
||||||
|
Date: Fri, 9 Jun 2017 16:20:19 +0200
|
||||||
|
Subject: [PATCH] Grow: don't allow to enable PPL when reshape is in progress
|
||||||
|
|
||||||
|
Don't allow to enable PPL consistency policy when reshape is in progress.
|
||||||
|
Current PPL implementation doesn't work when reshape is taking place.
|
||||||
|
|
||||||
|
Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
|
||||||
|
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
||||||
|
---
|
||||||
|
Grow.c | 12 ++++++++++++
|
||||||
|
1 file changed, 12 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/Grow.c b/Grow.c
|
||||||
|
index f7325cb..b1cb306 100644
|
||||||
|
--- a/Grow.c
|
||||||
|
+++ b/Grow.c
|
||||||
|
@@ -530,6 +530,7 @@ int Grow_consistency_policy(char *devname, int fd, struct context *c, struct sha
|
||||||
|
char *subarray = NULL;
|
||||||
|
int ret = 0;
|
||||||
|
char container_dev[PATH_MAX];
|
||||||
|
+ char buf[20];
|
||||||
|
|
||||||
|
if (s->consistency_policy != CONSISTENCY_POLICY_RESYNC &&
|
||||||
|
s->consistency_policy != CONSISTENCY_POLICY_PPL) {
|
||||||
|
@@ -577,6 +578,17 @@ int Grow_consistency_policy(char *devname, int fd, struct context *c, struct sha
|
||||||
|
goto free_info;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ if (s->consistency_policy == CONSISTENCY_POLICY_PPL) {
|
||||||
|
+ if (sysfs_get_str(sra, NULL, "sync_action", buf, 20) <= 0) {
|
||||||
|
+ ret = 1;
|
||||||
|
+ goto free_info;
|
||||||
|
+ } else if (strcmp(buf, "reshape\n") == 0) {
|
||||||
|
+ pr_err("PPL cannot be enabled when reshape is in progress\n");
|
||||||
|
+ ret = 1;
|
||||||
|
+ goto free_info;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
if (subarray) {
|
||||||
|
char *update;
|
||||||
|
|
||||||
|
--
|
||||||
|
2.12.0
|
||||||
|
|
@ -0,0 +1,36 @@
|
|||||||
|
From b208f817ec538e56df7280f0353e6bda532b9432 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
|
||||||
|
Date: Thu, 8 Jun 2017 16:05:51 +0200
|
||||||
|
Subject: [PATCH] Grow: don't allow array geometry change with ppl enabled
|
||||||
|
|
||||||
|
Don't allow array geometry change (size expand, disk adding) when PPL
|
||||||
|
consistency policy is enabled. Current PPL implementation doesn't work when
|
||||||
|
reshape is taking place.
|
||||||
|
|
||||||
|
Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
|
||||||
|
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
||||||
|
---
|
||||||
|
Grow.c | 7 +++++++
|
||||||
|
1 file changed, 7 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/Grow.c b/Grow.c
|
||||||
|
index 4ecb1d8..f7325cb 100644
|
||||||
|
--- a/Grow.c
|
||||||
|
+++ b/Grow.c
|
||||||
|
@@ -1880,6 +1880,13 @@ int Grow_reshape(char *devname, int fd,
|
||||||
|
free(subarray);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
+ if (content->consistency_policy ==
|
||||||
|
+ CONSISTENCY_POLICY_PPL) {
|
||||||
|
+ pr_err("Operation not supported when ppl consistency policy is enabled\n");
|
||||||
|
+ sysfs_free(cc);
|
||||||
|
+ free(subarray);
|
||||||
|
+ return 1;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
sysfs_free(cc);
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.12.0
|
||||||
|
|
44
0051-IMSM-Correct-examine-output-for-4k-disks.patch
Normal file
44
0051-IMSM-Correct-examine-output-for-4k-disks.patch
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
From 84918897ee8bb450ea09f7c95b9da44df8e925e4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Maksymilian Kunt <maksymilian.kunt@intel.com>
|
||||||
|
Date: Tue, 9 May 2017 14:03:27 +0200
|
||||||
|
Subject: [PATCH] IMSM: Correct --examine output for 4k disks
|
||||||
|
|
||||||
|
"Array Size" and "Per Dev Size" are incorrect for disks with sector size
|
||||||
|
different than 512B.
|
||||||
|
|
||||||
|
Calculate "Array Size" and "Per Dev Size" based on sector size. Additionally
|
||||||
|
print "Sector Size".
|
||||||
|
|
||||||
|
Signed-off-by: Maksymilian Kunt <maksymilian.kunt@intel.com>
|
||||||
|
Signed-off-by: Mariusz Dabrowski <mariusz.dabrowski@intel.com>
|
||||||
|
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
||||||
|
---
|
||||||
|
super-intel.c | 7 +++++--
|
||||||
|
1 file changed, 5 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/super-intel.c b/super-intel.c
|
||||||
|
index ba6f810..8ca80d3 100644
|
||||||
|
--- a/super-intel.c
|
||||||
|
+++ b/super-intel.c
|
||||||
|
@@ -1482,13 +1482,16 @@ static void print_imsm_dev(struct intel_super *super,
|
||||||
|
ord & IMSM_ORD_REBUILD ? " (out-of-sync)" : "");
|
||||||
|
} else
|
||||||
|
printf(" This Slot : ?\n");
|
||||||
|
+ printf(" Sector Size : %u\n", super->sector_size);
|
||||||
|
sz = __le32_to_cpu(dev->size_high);
|
||||||
|
sz <<= 32;
|
||||||
|
sz += __le32_to_cpu(dev->size_low);
|
||||||
|
- printf(" Array Size : %llu%s\n", (unsigned long long)sz,
|
||||||
|
+ printf(" Array Size : %llu%s\n",
|
||||||
|
+ (unsigned long long)sz * 512 / super->sector_size,
|
||||||
|
human_size(sz * 512));
|
||||||
|
sz = blocks_per_member(map);
|
||||||
|
- printf(" Per Dev Size : %llu%s\n", (unsigned long long)sz,
|
||||||
|
+ printf(" Per Dev Size : %llu%s\n",
|
||||||
|
+ (unsigned long long)sz * 512 / super->sector_size,
|
||||||
|
human_size(sz * 512));
|
||||||
|
printf(" Sector Offset : %llu\n",
|
||||||
|
pba_of_lba0(map));
|
||||||
|
--
|
||||||
|
2.12.0
|
||||||
|
|
@ -0,0 +1,42 @@
|
|||||||
|
From 5c5ea85b4deedf5e7491a905bbb4f4a3bc284f2c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Alexey Obitotskiy <aleksey.obitotskiy@intel.com>
|
||||||
|
Date: Tue, 9 May 2017 12:25:43 +0200
|
||||||
|
Subject: [PATCH] imsm: allow drives in a container regardless of sector size
|
||||||
|
|
||||||
|
IMSM doesn't allow to create arrays including drives with different
|
||||||
|
sector sizes. The initial idea was not to permit to combine drives
|
||||||
|
with different sector size in the same container. The problem is it
|
||||||
|
only worked for array creation. On array assemble there are no
|
||||||
|
calls to metadata handlers to see if drive is suitable for a container
|
||||||
|
(e.g. as a spare) and it leads to wrong configuration.
|
||||||
|
|
||||||
|
Revert the change and allow adding drives with different sector size
|
||||||
|
to the container.
|
||||||
|
|
||||||
|
Signed-off-by: Alexey Obitotskiy <aleksey.obitotskiy@intel.com>
|
||||||
|
Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
|
||||||
|
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
||||||
|
---
|
||||||
|
super-intel.c | 6 ------
|
||||||
|
1 file changed, 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/super-intel.c b/super-intel.c
|
||||||
|
index e13c940..2a5d848 100644
|
||||||
|
--- a/super-intel.c
|
||||||
|
+++ b/super-intel.c
|
||||||
|
@@ -5716,12 +5716,6 @@ static int add_to_super_imsm(struct supertype *st, mdu_disk_info_t *dk,
|
||||||
|
if (super->sector_size == 0) {
|
||||||
|
/* this a first device, so sector_size is not set yet */
|
||||||
|
super->sector_size = member_sector_size;
|
||||||
|
- } else if (member_sector_size != super->sector_size) {
|
||||||
|
- pr_err("Mixing between different sector size is forbidden, aborting...\n");
|
||||||
|
- if (dd->devname)
|
||||||
|
- free(dd->devname);
|
||||||
|
- free(dd);
|
||||||
|
- return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* clear migr_rec when adding disk to container */
|
||||||
|
--
|
||||||
|
2.12.0
|
||||||
|
|
@ -0,0 +1,83 @@
|
|||||||
|
From 853375734edcfd70ba64b444b9e69f7e336a30b7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Alexey Obitotskiy <aleksey.obitotskiy@intel.com>
|
||||||
|
Date: Tue, 9 May 2017 12:25:44 +0200
|
||||||
|
Subject: [PATCH] imsm: allocate buffer to support maximum sector size
|
||||||
|
|
||||||
|
Allocate migration record buffer to support maximum sector size. Disk with
|
||||||
|
non-matching sector size is not going to be included in the array, however
|
||||||
|
some preparation/cleanup actions still take place on it and they would
|
||||||
|
cause a crash. Clear migration record using sector size of the disk (not
|
||||||
|
array) as they might not match.
|
||||||
|
|
||||||
|
Signed-off-by: Alexey Obitotskiy <aleksey.obitotskiy@intel.com>
|
||||||
|
Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
|
||||||
|
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
||||||
|
---
|
||||||
|
super-intel.c | 21 +++++++++++----------
|
||||||
|
1 file changed, 11 insertions(+), 10 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/super-intel.c b/super-intel.c
|
||||||
|
index 2a5d848..cfb10d5 100644
|
||||||
|
--- a/super-intel.c
|
||||||
|
+++ b/super-intel.c
|
||||||
|
@@ -4229,8 +4229,8 @@ static int load_imsm_mpb(int fd, struct intel_super *super, char *devname)
|
||||||
|
sectors = mpb_sectors(anchor, sector_size) - 1;
|
||||||
|
free(anchor);
|
||||||
|
|
||||||
|
- if (posix_memalign(&super->migr_rec_buf, sector_size,
|
||||||
|
- MIGR_REC_BUF_SECTORS*sector_size) != 0) {
|
||||||
|
+ if (posix_memalign(&super->migr_rec_buf, MAX_SECTOR_SIZE,
|
||||||
|
+ MIGR_REC_BUF_SECTORS*MAX_SECTOR_SIZE) != 0) {
|
||||||
|
pr_err("could not allocate migr_rec buffer\n");
|
||||||
|
free(super->buf);
|
||||||
|
return 2;
|
||||||
|
@@ -5258,8 +5258,9 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info,
|
||||||
|
pr_err("could not allocate new mpb\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
- if (posix_memalign(&super->migr_rec_buf, sector_size,
|
||||||
|
- MIGR_REC_BUF_SECTORS*sector_size) != 0) {
|
||||||
|
+ if (posix_memalign(&super->migr_rec_buf, MAX_SECTOR_SIZE,
|
||||||
|
+ MIGR_REC_BUF_SECTORS*
|
||||||
|
+ MAX_SECTOR_SIZE) != 0) {
|
||||||
|
pr_err("could not allocate migr_rec buffer\n");
|
||||||
|
free(super->buf);
|
||||||
|
free(super);
|
||||||
|
@@ -5719,12 +5720,12 @@ static int add_to_super_imsm(struct supertype *st, mdu_disk_info_t *dk,
|
||||||
|
}
|
||||||
|
|
||||||
|
/* clear migr_rec when adding disk to container */
|
||||||
|
- memset(super->migr_rec_buf, 0, MIGR_REC_BUF_SECTORS*super->sector_size);
|
||||||
|
- if (lseek64(fd, size - MIGR_REC_SECTOR_POSITION*super->sector_size,
|
||||||
|
+ memset(super->migr_rec_buf, 0, MIGR_REC_BUF_SECTORS*MAX_SECTOR_SIZE);
|
||||||
|
+ if (lseek64(fd, size - MIGR_REC_SECTOR_POSITION*member_sector_size,
|
||||||
|
SEEK_SET) >= 0) {
|
||||||
|
if ((unsigned int)write(fd, super->migr_rec_buf,
|
||||||
|
- MIGR_REC_BUF_SECTORS*super->sector_size) !=
|
||||||
|
- MIGR_REC_BUF_SECTORS*super->sector_size)
|
||||||
|
+ MIGR_REC_BUF_SECTORS*member_sector_size) !=
|
||||||
|
+ MIGR_REC_BUF_SECTORS*member_sector_size)
|
||||||
|
perror("Write migr_rec failed");
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -5916,7 +5917,7 @@ static int write_super_imsm(struct supertype *st, int doclose)
|
||||||
|
}
|
||||||
|
if (clear_migration_record)
|
||||||
|
memset(super->migr_rec_buf, 0,
|
||||||
|
- MIGR_REC_BUF_SECTORS*sector_size);
|
||||||
|
+ MIGR_REC_BUF_SECTORS*MAX_SECTOR_SIZE);
|
||||||
|
|
||||||
|
if (sector_size == 4096)
|
||||||
|
convert_to_4k(super);
|
||||||
|
@@ -11770,7 +11771,7 @@ static int imsm_manage_reshape(
|
||||||
|
/* clear migr_rec on disks after successful migration */
|
||||||
|
struct dl *d;
|
||||||
|
|
||||||
|
- memset(super->migr_rec_buf, 0, MIGR_REC_BUF_SECTORS*sector_size);
|
||||||
|
+ memset(super->migr_rec_buf, 0, MIGR_REC_BUF_SECTORS*MAX_SECTOR_SIZE);
|
||||||
|
for (d = super->disks; d; d = d->next) {
|
||||||
|
if (d->index < 0 || is_failed(&d->disk))
|
||||||
|
continue;
|
||||||
|
--
|
||||||
|
2.12.0
|
||||||
|
|
@ -0,0 +1,67 @@
|
|||||||
|
From f2cc4f7d829e1b849e78bdf6c38b7bd6e234c600 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Alexey Obitotskiy <aleksey.obitotskiy@intel.com>
|
||||||
|
Date: Tue, 9 May 2017 12:25:45 +0200
|
||||||
|
Subject: [PATCH] imsm: don't allow disks with different sector size in one
|
||||||
|
array
|
||||||
|
|
||||||
|
As there is no support in IMSM for arrays including disks with different
|
||||||
|
sector sizes, don't allow to create such configuration. Also skip the
|
||||||
|
disk with unsuitable sector size when looking for spares in the same
|
||||||
|
container.
|
||||||
|
|
||||||
|
Signed-off-by: Alexey Obitotskiy <aleksey.obitotskiy@intel.com>
|
||||||
|
Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
|
||||||
|
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
||||||
|
---
|
||||||
|
super-intel.c | 24 ++++++++++++++++++++++++
|
||||||
|
1 file changed, 24 insertions(+)
|
||||||
|
|
||||||
|
Index: mdadm/super-intel.c
|
||||||
|
===================================================================
|
||||||
|
--- mdadm.orig/super-intel.c
|
||||||
|
+++ mdadm/super-intel.c
|
||||||
|
@@ -5487,6 +5487,22 @@ static int init_super_imsm(struct supert
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static int drive_validate_sector_size(struct intel_super *super, struct dl *dl)
|
||||||
|
+{
|
||||||
|
+ unsigned int member_sector_size;
|
||||||
|
+
|
||||||
|
+ if (dl->fd < 0) {
|
||||||
|
+ pr_err("Invalid file descriptor for %s\n", dl->devname);
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (!get_dev_sector_size(dl->fd, dl->devname, &member_sector_size))
|
||||||
|
+ return 0;
|
||||||
|
+ if (member_sector_size != super->sector_size)
|
||||||
|
+ return 0;
|
||||||
|
+ return 1;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
#ifndef MDASSEMBLE
|
||||||
|
static int add_to_super_imsm_volume(struct supertype *st, mdu_disk_info_t *dk,
|
||||||
|
int fd, char *devname)
|
||||||
|
@@ -5527,6 +5543,11 @@ static int add_to_super_imsm_volume(stru
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ if (!drive_validate_sector_size(super, dl)) {
|
||||||
|
+ pr_err("Combining drives of different sector size in one volume is not allowed\n");
|
||||||
|
+ return 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
/* add a pristine spare to the metadata */
|
||||||
|
if (dl->index < 0) {
|
||||||
|
dl->index = super->anchor->num_disks;
|
||||||
|
@@ -8490,6 +8511,9 @@ static struct dl *imsm_add_spare(struct
|
||||||
|
if (dl->index == -1 && !activate_new)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
+ if (!drive_validate_sector_size(super, dl))
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
/* Does this unused device have the requisite free space?
|
||||||
|
* It needs to be able to cover all member volumes
|
||||||
|
*/
|
343
0055-Allow-more-spare-selection-criteria.patch
Normal file
343
0055-Allow-more-spare-selection-criteria.patch
Normal file
@ -0,0 +1,343 @@
|
|||||||
|
From fbfdcb06dc5b1dcb227b0394f174faa2df734700 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Alexey Obitotskiy <aleksey.obitotskiy@intel.com>
|
||||||
|
Date: Tue, 9 May 2017 12:25:46 +0200
|
||||||
|
Subject: [PATCH] Allow more spare selection criteria
|
||||||
|
|
||||||
|
Disks can be moved across containers in order to be used as a spare
|
||||||
|
drive for reubild. At the moment the only requirement checked for such
|
||||||
|
disk is its size (if it matches donor expectations). In order to
|
||||||
|
introduce more criteria rename corresponding superswitch method to more
|
||||||
|
generic name and move function parameter to a structure. This change is
|
||||||
|
a big edit but it doesn't introduce any changes in code logic, it just
|
||||||
|
updates function naming and parameters.
|
||||||
|
|
||||||
|
Signed-off-by: Alexey Obitotskiy <aleksey.obitotskiy@intel.com>
|
||||||
|
Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
|
||||||
|
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
||||||
|
---
|
||||||
|
Incremental.c | 18 +++++++++++-------
|
||||||
|
Monitor.c | 30 ++++++++++++++++--------------
|
||||||
|
mdadm.h | 16 +++++++++++-----
|
||||||
|
super-intel.c | 33 +++++++++++++++++++++------------
|
||||||
|
util.c | 6 +++---
|
||||||
|
5 files changed, 62 insertions(+), 41 deletions(-)
|
||||||
|
|
||||||
|
Index: mdadm/Incremental.c
|
||||||
|
===================================================================
|
||||||
|
--- mdadm.orig/Incremental.c
|
||||||
|
+++ mdadm/Incremental.c
|
||||||
|
@@ -889,7 +889,7 @@ static int array_try_spare(char *devname
|
||||||
|
struct domainlist *dl = NULL;
|
||||||
|
struct mdinfo *sra;
|
||||||
|
unsigned long long devsize;
|
||||||
|
- unsigned long long component_size = 0;
|
||||||
|
+ struct spare_criteria sc = {0};
|
||||||
|
|
||||||
|
if (is_subarray(mp->metadata))
|
||||||
|
continue;
|
||||||
|
@@ -958,7 +958,8 @@ static int array_try_spare(char *devname
|
||||||
|
}
|
||||||
|
if (st3->ss->load_container &&
|
||||||
|
!st3->ss->load_container(st3, mdfd, mp->path)) {
|
||||||
|
- component_size = st3->ss->min_acceptable_spare_size(st3);
|
||||||
|
+ if (st3->ss->get_spare_criteria)
|
||||||
|
+ st3->ss->get_spare_criteria(st3, &sc);
|
||||||
|
st3->ss->free_super(st3);
|
||||||
|
}
|
||||||
|
free(st3);
|
||||||
|
@@ -969,9 +970,8 @@ static int array_try_spare(char *devname
|
||||||
|
sra->devs
|
||||||
|
? sra->devs->data_offset
|
||||||
|
: INVALID_SECTORS)
|
||||||
|
- < sra->component_size)
|
||||||
|
- ||
|
||||||
|
- (sra->component_size == 0 && devsize < component_size)) {
|
||||||
|
+ < sra->component_size) ||
|
||||||
|
+ (sra->component_size == 0 && devsize < sc.min_size)) {
|
||||||
|
if (verbose > 1)
|
||||||
|
pr_err("not adding %s to %s as it is too small\n",
|
||||||
|
devname, mp->path);
|
||||||
|
@@ -1655,12 +1655,15 @@ static int Incremental_container(struct
|
||||||
|
struct supertype *sst =
|
||||||
|
super_imsm.match_metadata_desc("imsm");
|
||||||
|
struct mdinfo *sinfo;
|
||||||
|
- unsigned long long min_size = 0;
|
||||||
|
- if (st->ss->min_acceptable_spare_size)
|
||||||
|
- min_size = st->ss->min_acceptable_spare_size(st);
|
||||||
|
+
|
||||||
|
if (!sst->ss->load_container(sst, sfd, NULL)) {
|
||||||
|
+ struct spare_criteria sc = {0};
|
||||||
|
+
|
||||||
|
+ if (st->ss->get_spare_criteria)
|
||||||
|
+ st->ss->get_spare_criteria(st, &sc);
|
||||||
|
+
|
||||||
|
close(sfd);
|
||||||
|
- sinfo = container_choose_spares(sst, min_size,
|
||||||
|
+ sinfo = container_choose_spares(sst, &sc,
|
||||||
|
domains, NULL,
|
||||||
|
st->ss->name, 0);
|
||||||
|
sst->ss->free_super(sst);
|
||||||
|
Index: mdadm/Monitor.c
|
||||||
|
===================================================================
|
||||||
|
--- mdadm.orig/Monitor.c
|
||||||
|
+++ mdadm/Monitor.c
|
||||||
|
@@ -746,13 +746,14 @@ static int add_new_arrays(struct mdstat_
|
||||||
|
return new_found;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int get_min_spare_size_required(struct state *st, unsigned long long *sizep)
|
||||||
|
+static int get_required_spare_criteria(struct state *st,
|
||||||
|
+ struct spare_criteria *sc)
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
|
||||||
|
if (!st->metadata ||
|
||||||
|
- !st->metadata->ss->min_acceptable_spare_size) {
|
||||||
|
- *sizep = 0;
|
||||||
|
+ !st->metadata->ss->get_spare_criteria) {
|
||||||
|
+ sc->min_size = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -766,7 +767,8 @@ static int get_min_spare_size_required(s
|
||||||
|
close(fd);
|
||||||
|
if (!st->metadata->sb)
|
||||||
|
return 1;
|
||||||
|
- *sizep = st->metadata->ss->min_acceptable_spare_size(st->metadata);
|
||||||
|
+
|
||||||
|
+ st->metadata->ss->get_spare_criteria(st->metadata, sc);
|
||||||
|
st->metadata->ss->free_super(st->metadata);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
@@ -798,7 +800,7 @@ static int check_donor(struct state *fro
|
||||||
|
}
|
||||||
|
|
||||||
|
static dev_t choose_spare(struct state *from, struct state *to,
|
||||||
|
- struct domainlist *domlist, unsigned long long min_size)
|
||||||
|
+ struct domainlist *domlist, struct spare_criteria *sc)
|
||||||
|
{
|
||||||
|
int d;
|
||||||
|
dev_t dev = 0;
|
||||||
|
@@ -813,9 +815,9 @@ static dev_t choose_spare(struct state *
|
||||||
|
test_partition_from_id(from->devid[d]))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
- if (min_size &&
|
||||||
|
+ if (sc->min_size &&
|
||||||
|
dev_size_from_id(from->devid[d], &dev_size) &&
|
||||||
|
- dev_size < min_size)
|
||||||
|
+ dev_size < sc->min_size)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
pol = devid_policy(from->devid[d]);
|
||||||
|
@@ -832,7 +834,7 @@ static dev_t choose_spare(struct state *
|
||||||
|
|
||||||
|
static dev_t container_choose_spare(struct state *from, struct state *to,
|
||||||
|
struct domainlist *domlist,
|
||||||
|
- unsigned long long min_size, int active)
|
||||||
|
+ struct spare_criteria *sc, int active)
|
||||||
|
{
|
||||||
|
/* This is similar to choose_spare, but we cannot trust devstate,
|
||||||
|
* so we need to read the metadata instead
|
||||||
|
@@ -883,7 +885,7 @@ static dev_t container_choose_spare(stru
|
||||||
|
}
|
||||||
|
|
||||||
|
/* We only need one spare so full list not needed */
|
||||||
|
- list = container_choose_spares(st, min_size, domlist, from->spare_group,
|
||||||
|
+ list = container_choose_spares(st, sc, domlist, from->spare_group,
|
||||||
|
to->metadata->ss->name, 1);
|
||||||
|
if (list) {
|
||||||
|
struct mdinfo *disks = list->devs;
|
||||||
|
@@ -899,6 +901,7 @@ static void try_spare_migration(struct s
|
||||||
|
{
|
||||||
|
struct state *from;
|
||||||
|
struct state *st;
|
||||||
|
+ struct spare_criteria sc;
|
||||||
|
|
||||||
|
link_containers_with_subarrays(statelist);
|
||||||
|
for (st = statelist; st; st = st->next)
|
||||||
|
@@ -907,7 +910,6 @@ static void try_spare_migration(struct s
|
||||||
|
struct domainlist *domlist = NULL;
|
||||||
|
int d;
|
||||||
|
struct state *to = st;
|
||||||
|
- unsigned long long min_size;
|
||||||
|
|
||||||
|
if (to->parent_devnm[0] && !to->parent)
|
||||||
|
/* subarray monitored without parent container
|
||||||
|
@@ -918,14 +920,14 @@ static void try_spare_migration(struct s
|
||||||
|
/* member of a container */
|
||||||
|
to = to->parent;
|
||||||
|
|
||||||
|
- if (get_min_spare_size_required(to, &min_size))
|
||||||
|
+ if (get_required_spare_criteria(to, &sc))
|
||||||
|
continue;
|
||||||
|
if (to->metadata->ss->external) {
|
||||||
|
/* We must make sure there is
|
||||||
|
* no suitable spare in container already.
|
||||||
|
* If there is we don't add more */
|
||||||
|
dev_t devid = container_choose_spare(
|
||||||
|
- to, to, NULL, min_size, st->active);
|
||||||
|
+ to, to, NULL, &sc, st->active);
|
||||||
|
if (devid > 0)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
@@ -948,10 +950,10 @@ static void try_spare_migration(struct s
|
||||||
|
continue;
|
||||||
|
if (from->metadata->ss->external)
|
||||||
|
devid = container_choose_spare(
|
||||||
|
- from, to, domlist, min_size, 0);
|
||||||
|
+ from, to, domlist, &sc, 0);
|
||||||
|
else
|
||||||
|
devid = choose_spare(from, to, domlist,
|
||||||
|
- min_size);
|
||||||
|
+ &sc);
|
||||||
|
if (devid > 0
|
||||||
|
&& move_spare(from->devname, to->devname, devid)) {
|
||||||
|
alert("MoveSpare", to->devname, from->devname, info);
|
||||||
|
Index: mdadm/mdadm.h
|
||||||
|
===================================================================
|
||||||
|
--- mdadm.orig/mdadm.h
|
||||||
|
+++ mdadm/mdadm.h
|
||||||
|
@@ -351,6 +351,10 @@ struct createinfo {
|
||||||
|
struct supertype *supertype;
|
||||||
|
};
|
||||||
|
|
||||||
|
+struct spare_criteria {
|
||||||
|
+ unsigned long long min_size;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
enum mode {
|
||||||
|
ASSEMBLE=1,
|
||||||
|
BUILD,
|
||||||
|
@@ -929,11 +933,13 @@ extern struct superswitch {
|
||||||
|
*/
|
||||||
|
__u64 (*avail_size)(struct supertype *st, __u64 size,
|
||||||
|
unsigned long long data_offset);
|
||||||
|
- /* This is similar to 'avail_size' in purpose, but is used for
|
||||||
|
- * containers for which there is no 'component size' to compare.
|
||||||
|
- * This reports that whole-device size which is a minimum
|
||||||
|
+ /*
|
||||||
|
+ * Return spare criteria for array:
|
||||||
|
+ * - minimum disk size can be used in array;
|
||||||
|
+ * Return values: 0 - for success and -EINVAL on error.
|
||||||
|
*/
|
||||||
|
- unsigned long long (*min_acceptable_spare_size)(struct supertype *st);
|
||||||
|
+ int (*get_spare_criteria)(struct supertype *st,
|
||||||
|
+ struct spare_criteria *sc);
|
||||||
|
/* Find somewhere to put a bitmap - possibly auto-size it - and
|
||||||
|
* update the metadata to record this. The array may be newly
|
||||||
|
* created, in which case data_size may be updated, or it might
|
||||||
|
@@ -1491,7 +1497,7 @@ extern int assemble_container_content(st
|
||||||
|
#define INCR_ALREADY 4
|
||||||
|
#define INCR_YES 8
|
||||||
|
extern struct mdinfo *container_choose_spares(struct supertype *st,
|
||||||
|
- unsigned long long min_size,
|
||||||
|
+ struct spare_criteria *criteria,
|
||||||
|
struct domainlist *domlist,
|
||||||
|
char *spare_group,
|
||||||
|
const char *metadata, int get_one);
|
||||||
|
Index: mdadm/super-intel.c
|
||||||
|
===================================================================
|
||||||
|
--- mdadm.orig/super-intel.c
|
||||||
|
+++ mdadm/super-intel.c
|
||||||
|
@@ -1386,37 +1386,44 @@ static __u32 imsm_min_reserved_sectors(s
|
||||||
|
return (remainder < rv) ? remainder : rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
-/* Return minimum size of a spare that can be used in this array*/
|
||||||
|
-static unsigned long long min_acceptable_spare_size_imsm(struct supertype *st)
|
||||||
|
+/*
|
||||||
|
+ * Return minimum size of a spare and sector size
|
||||||
|
+ * that can be used in this array
|
||||||
|
+ */
|
||||||
|
+int get_spare_criteria_imsm(struct supertype *st, struct spare_criteria *c)
|
||||||
|
{
|
||||||
|
struct intel_super *super = st->sb;
|
||||||
|
struct dl *dl;
|
||||||
|
struct extent *e;
|
||||||
|
int i;
|
||||||
|
- unsigned long long rv = 0;
|
||||||
|
+ unsigned long long size = 0;
|
||||||
|
+
|
||||||
|
+ c->min_size = 0;
|
||||||
|
|
||||||
|
if (!super)
|
||||||
|
- return rv;
|
||||||
|
+ return -EINVAL;
|
||||||
|
/* find first active disk in array */
|
||||||
|
dl = super->disks;
|
||||||
|
while (dl && (is_failed(&dl->disk) || dl->index == -1))
|
||||||
|
dl = dl->next;
|
||||||
|
if (!dl)
|
||||||
|
- return rv;
|
||||||
|
+ return -EINVAL;
|
||||||
|
/* find last lba used by subarrays */
|
||||||
|
e = get_extents(super, dl);
|
||||||
|
if (!e)
|
||||||
|
- return rv;
|
||||||
|
+ return -EINVAL;
|
||||||
|
for (i = 0; e[i].size; i++)
|
||||||
|
continue;
|
||||||
|
if (i > 0)
|
||||||
|
- rv = e[i-1].start + e[i-1].size;
|
||||||
|
+ size = e[i-1].start + e[i-1].size;
|
||||||
|
free(e);
|
||||||
|
|
||||||
|
/* add the amount of space needed for metadata */
|
||||||
|
- rv = rv + imsm_min_reserved_sectors(super);
|
||||||
|
+ size += imsm_min_reserved_sectors(super);
|
||||||
|
+
|
||||||
|
+ c->min_size = size * 512;
|
||||||
|
|
||||||
|
- return rv * 512;
|
||||||
|
+ return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int is_gen_migration(struct imsm_dev *dev);
|
||||||
|
@@ -10868,8 +10875,10 @@ static int imsm_reshape_is_allowed_on_co
|
||||||
|
*/
|
||||||
|
static struct mdinfo *get_spares_for_grow(struct supertype *st)
|
||||||
|
{
|
||||||
|
- unsigned long long min_size = min_acceptable_spare_size_imsm(st);
|
||||||
|
- return container_choose_spares(st, min_size, NULL, NULL, NULL, 0);
|
||||||
|
+ struct spare_criteria sc;
|
||||||
|
+
|
||||||
|
+ get_spare_criteria_imsm(st, &sc);
|
||||||
|
+ return container_choose_spares(st, &sc, NULL, NULL, NULL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
@@ -11908,7 +11917,7 @@ struct superswitch super_imsm = {
|
||||||
|
.update_super = update_super_imsm,
|
||||||
|
|
||||||
|
.avail_size = avail_size_imsm,
|
||||||
|
- .min_acceptable_spare_size = min_acceptable_spare_size_imsm,
|
||||||
|
+ .get_spare_criteria = get_spare_criteria_imsm,
|
||||||
|
|
||||||
|
.compare_super = compare_super_imsm,
|
||||||
|
|
||||||
|
Index: mdadm/util.c
|
||||||
|
===================================================================
|
||||||
|
--- mdadm.orig/util.c
|
||||||
|
+++ mdadm/util.c
|
||||||
|
@@ -2083,7 +2083,7 @@ int experimental(void)
|
||||||
|
* if spare_group given add it to domains of each spare
|
||||||
|
* metadata allows to test domains using metadata of destination array */
|
||||||
|
struct mdinfo *container_choose_spares(struct supertype *st,
|
||||||
|
- unsigned long long min_size,
|
||||||
|
+ struct spare_criteria *criteria,
|
||||||
|
struct domainlist *domlist,
|
||||||
|
char *spare_group,
|
||||||
|
const char *metadata, int get_one)
|
||||||
|
@@ -2107,9 +2107,9 @@ struct mdinfo *container_choose_spares(s
|
||||||
|
unsigned long long dev_size;
|
||||||
|
dev_t dev = makedev(d->disk.major,d->disk.minor);
|
||||||
|
|
||||||
|
- if (!min_size ||
|
||||||
|
+ if (!criteria->min_size ||
|
||||||
|
(dev_size_from_id(dev, &dev_size) &&
|
||||||
|
- dev_size >= min_size))
|
||||||
|
+ dev_size >= criteria->min_size))
|
||||||
|
found = 1;
|
||||||
|
/* check if domain matches */
|
||||||
|
if (found && domlist) {
|
181
0056-Add-sector-size-as-spare-selection-criterion.patch
Normal file
181
0056-Add-sector-size-as-spare-selection-criterion.patch
Normal file
@ -0,0 +1,181 @@
|
|||||||
|
From 4b57ecf6cea134edff75a2f3a87ee48d52715c70 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Alexey Obitotskiy <aleksey.obitotskiy@intel.com>
|
||||||
|
Date: Tue, 9 May 2017 12:25:47 +0200
|
||||||
|
Subject: [PATCH] Add sector size as spare selection criterion
|
||||||
|
|
||||||
|
Add sector size as new spare selection criterion. Assume that 0 means
|
||||||
|
there is no requirement for the sector size in the array. Skip disks
|
||||||
|
with unsuitable sector size when looking for a spare to move across
|
||||||
|
containers.
|
||||||
|
|
||||||
|
Signed-off-by: Alexey Obitotskiy <aleksey.obitotskiy@intel.com>
|
||||||
|
Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
|
||||||
|
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
||||||
|
---
|
||||||
|
Incremental.c | 4 ++--
|
||||||
|
Monitor.c | 8 ++++++++
|
||||||
|
mdadm.h | 3 +++
|
||||||
|
super-intel.c | 2 ++
|
||||||
|
util.c | 31 ++++++++++++++++++++++++++++++-
|
||||||
|
5 files changed, 45 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/Incremental.c b/Incremental.c
|
||||||
|
index fe9d644..30dc7a2 100644
|
||||||
|
--- a/Incremental.c
|
||||||
|
+++ b/Incremental.c
|
||||||
|
@@ -867,7 +867,7 @@ static int array_try_spare(char *devname, int *dfdp, struct dev_policy *pol,
|
||||||
|
struct domainlist *dl = NULL;
|
||||||
|
struct mdinfo *sra;
|
||||||
|
unsigned long long devsize;
|
||||||
|
- struct spare_criteria sc = {0};
|
||||||
|
+ struct spare_criteria sc = {0, 0};
|
||||||
|
|
||||||
|
if (is_subarray(mp->metadata))
|
||||||
|
continue;
|
||||||
|
@@ -1627,7 +1627,7 @@ static int Incremental_container(struct supertype *st, char *devname,
|
||||||
|
struct mdinfo *sinfo;
|
||||||
|
|
||||||
|
if (!sst->ss->load_container(sst, sfd, NULL)) {
|
||||||
|
- struct spare_criteria sc = {0};
|
||||||
|
+ struct spare_criteria sc = {0, 0};
|
||||||
|
|
||||||
|
if (st->ss->get_spare_criteria)
|
||||||
|
st->ss->get_spare_criteria(st, &sc);
|
||||||
|
diff --git a/Monitor.c b/Monitor.c
|
||||||
|
index 9a2baad..c96f8e8 100644
|
||||||
|
--- a/Monitor.c
|
||||||
|
+++ b/Monitor.c
|
||||||
|
@@ -731,6 +731,7 @@ static int get_required_spare_criteria(struct state *st,
|
||||||
|
if (!st->metadata ||
|
||||||
|
!st->metadata->ss->get_spare_criteria) {
|
||||||
|
sc->min_size = 0;
|
||||||
|
+ sc->sector_size = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -787,6 +788,7 @@ static dev_t choose_spare(struct state *from, struct state *to,
|
||||||
|
from->devstate[d] == 0) {
|
||||||
|
struct dev_policy *pol;
|
||||||
|
unsigned long long dev_size;
|
||||||
|
+ unsigned int dev_sector_size;
|
||||||
|
|
||||||
|
if (to->metadata->ss->external &&
|
||||||
|
test_partition_from_id(from->devid[d]))
|
||||||
|
@@ -797,6 +799,12 @@ static dev_t choose_spare(struct state *from, struct state *to,
|
||||||
|
dev_size < sc->min_size)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
+ if (sc->sector_size &&
|
||||||
|
+ dev_sector_size_from_id(from->devid[d],
|
||||||
|
+ &dev_sector_size) &&
|
||||||
|
+ sc->sector_size != dev_sector_size)
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
pol = devid_policy(from->devid[d]);
|
||||||
|
if (from->spare_group)
|
||||||
|
pol_add(&pol, pol_domain,
|
||||||
|
diff --git a/mdadm.h b/mdadm.h
|
||||||
|
index 8da7fd3..ec0a39e 100644
|
||||||
|
--- a/mdadm.h
|
||||||
|
+++ b/mdadm.h
|
||||||
|
@@ -363,6 +363,7 @@ struct createinfo {
|
||||||
|
|
||||||
|
struct spare_criteria {
|
||||||
|
unsigned long long min_size;
|
||||||
|
+ unsigned int sector_size;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum mode {
|
||||||
|
@@ -947,6 +948,7 @@ extern struct superswitch {
|
||||||
|
/*
|
||||||
|
* Return spare criteria for array:
|
||||||
|
* - minimum disk size can be used in array;
|
||||||
|
+ * - sector size can be used in array.
|
||||||
|
* Return values: 0 - for success and -EINVAL on error.
|
||||||
|
*/
|
||||||
|
int (*get_spare_criteria)(struct supertype *st,
|
||||||
|
@@ -1189,6 +1191,7 @@ extern int get_dev_size(int fd, char *dname, unsigned long long *sizep);
|
||||||
|
extern int get_dev_sector_size(int fd, char *dname, unsigned int *sectsizep);
|
||||||
|
extern int must_be_container(int fd);
|
||||||
|
extern int dev_size_from_id(dev_t id, unsigned long long *size);
|
||||||
|
+extern int dev_sector_size_from_id(dev_t id, unsigned int *size);
|
||||||
|
void wait_for(char *dev, int fd);
|
||||||
|
|
||||||
|
/*
|
||||||
|
diff --git a/super-intel.c b/super-intel.c
|
||||||
|
index be973f8..ba6f810 100644
|
||||||
|
--- a/super-intel.c
|
||||||
|
+++ b/super-intel.c
|
||||||
|
@@ -1396,6 +1396,7 @@ int get_spare_criteria_imsm(struct supertype *st, struct spare_criteria *c)
|
||||||
|
unsigned long long size = 0;
|
||||||
|
|
||||||
|
c->min_size = 0;
|
||||||
|
+ c->sector_size = 0;
|
||||||
|
|
||||||
|
if (!super)
|
||||||
|
return -EINVAL;
|
||||||
|
@@ -1419,6 +1420,7 @@ int get_spare_criteria_imsm(struct supertype *st, struct spare_criteria *c)
|
||||||
|
size += imsm_min_reserved_sectors(super);
|
||||||
|
|
||||||
|
c->min_size = size * 512;
|
||||||
|
+ c->sector_size = super->sector_size;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
diff --git a/util.c b/util.c
|
||||||
|
index 8b3c67d..fc9cd3f 100644
|
||||||
|
--- a/util.c
|
||||||
|
+++ b/util.c
|
||||||
|
@@ -1265,6 +1265,23 @@ int dev_size_from_id(dev_t id, unsigned long long *size)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
+int dev_sector_size_from_id(dev_t id, unsigned int *size)
|
||||||
|
+{
|
||||||
|
+ char buf[20];
|
||||||
|
+ int fd;
|
||||||
|
+
|
||||||
|
+ sprintf(buf, "%d:%d", major(id), minor(id));
|
||||||
|
+ fd = dev_open(buf, O_RDONLY);
|
||||||
|
+ if (fd < 0)
|
||||||
|
+ return 0;
|
||||||
|
+ if (get_dev_sector_size(fd, NULL, size)) {
|
||||||
|
+ close(fd);
|
||||||
|
+ return 1;
|
||||||
|
+ }
|
||||||
|
+ close(fd);
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
struct supertype *dup_super(struct supertype *orig)
|
||||||
|
{
|
||||||
|
struct supertype *st;
|
||||||
|
@@ -2129,12 +2146,24 @@ struct mdinfo *container_choose_spares(struct supertype *st,
|
||||||
|
if (d->disk.state == 0) {
|
||||||
|
/* check if size is acceptable */
|
||||||
|
unsigned long long dev_size;
|
||||||
|
+ unsigned int dev_sector_size;
|
||||||
|
+ int size_valid = 0;
|
||||||
|
+ int sector_size_valid = 0;
|
||||||
|
+
|
||||||
|
dev_t dev = makedev(d->disk.major,d->disk.minor);
|
||||||
|
|
||||||
|
if (!criteria->min_size ||
|
||||||
|
(dev_size_from_id(dev, &dev_size) &&
|
||||||
|
dev_size >= criteria->min_size))
|
||||||
|
- found = 1;
|
||||||
|
+ size_valid = 1;
|
||||||
|
+
|
||||||
|
+ if (!criteria->sector_size ||
|
||||||
|
+ (dev_sector_size_from_id(dev, &dev_sector_size) &&
|
||||||
|
+ criteria->sector_size == dev_sector_size))
|
||||||
|
+ sector_size_valid = 1;
|
||||||
|
+
|
||||||
|
+ found = size_valid && sector_size_valid;
|
||||||
|
+
|
||||||
|
/* check if domain matches */
|
||||||
|
if (found && domlist) {
|
||||||
|
struct dev_policy *pol = devid_policy(dev);
|
||||||
|
--
|
||||||
|
2.12.0
|
||||||
|
|
@ -0,0 +1,58 @@
|
|||||||
|
From: Lidong Zhong <lzhong@suse.com>
|
||||||
|
Date: Thu, 25 May 2017 17:28:11 +0800
|
||||||
|
Subject: [PATCH] super1: fix sb->max_dev when adding a new disk in linear array
|
||||||
|
Git-commit: 68fee4af1703dc0bc0d1c9c99fd750e8dca3a131
|
||||||
|
Patch-mainline: v4.0-148
|
||||||
|
References: bsc#1032802
|
||||||
|
|
||||||
|
The value of sb->max_dev will always be increased by 1 when adding
|
||||||
|
a new disk in linear array. It causes an inconsistence between each
|
||||||
|
disk in the array and the "Array State" value of "mdadm --examine DISK"
|
||||||
|
is wrong. For example, when adding the first new disk into linear array
|
||||||
|
it will be:
|
||||||
|
|
||||||
|
Array State : RAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
('A' == active, '.' == missing, 'R' == replacing)
|
||||||
|
|
||||||
|
Adding the second disk into linear array it will be
|
||||||
|
|
||||||
|
Array State : .AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
('A' == active, '.' == missing, 'R' == replacing)
|
||||||
|
|
||||||
|
Signed-off-by: Lidong Zhong <lzhong@suse.com>
|
||||||
|
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
||||||
|
Signed-off-by: Coly Li <colyli@suse.de>
|
||||||
|
---
|
||||||
|
super1.c | 7 ++++++-
|
||||||
|
1 file changed, 6 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/super1.c b/super1.c
|
||||||
|
index 2fcb814..86ec850 100644
|
||||||
|
--- a/super1.c
|
||||||
|
+++ b/super1.c
|
||||||
|
@@ -1267,8 +1267,9 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
|
||||||
|
break;
|
||||||
|
sb->dev_number = __cpu_to_le32(i);
|
||||||
|
info->disk.number = i;
|
||||||
|
- if (max >= __le32_to_cpu(sb->max_dev))
|
||||||
|
+ if (i >= max) {
|
||||||
|
sb->max_dev = __cpu_to_le32(max+1);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
random_uuid(sb->device_uuid);
|
||||||
|
|
||||||
|
@@ -1293,7 +1294,11 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (strcmp(update, "linear-grow-update") == 0) {
|
||||||
|
+ int max = __le32_to_cpu(sb->max_dev);
|
||||||
|
sb->raid_disks = __cpu_to_le32(info->array.raid_disks);
|
||||||
|
+ if (info->array.raid_disks > max) {
|
||||||
|
+ sb->max_dev = __cpu_to_le32(max+1);
|
||||||
|
+ }
|
||||||
|
sb->dev_roles[info->disk.number] =
|
||||||
|
__cpu_to_le16(info->disk.raid_disk);
|
||||||
|
} else if (strcmp(update, "resync") == 0) {
|
||||||
|
--
|
||||||
|
2.13.1
|
||||||
|
|
@ -0,0 +1,44 @@
|
|||||||
|
From 6438c249c4fed92cf6e5fb492d19f4c4f516ff6f Mon Sep 17 00:00:00 2001
|
||||||
|
From: NeilBrown <neilb@suse.com>
|
||||||
|
Date: Fri, 4 Aug 2017 15:30:02 +1000
|
||||||
|
Subject: [PATCH] super1: only set clustered flag when bitmap is present
|
||||||
|
Patch-mainline: mdadm-4.0
|
||||||
|
References: bsc#1047314
|
||||||
|
|
||||||
|
If no bitmap is present, then the test
|
||||||
|
|
||||||
|
if (__le32_to_cpu(bsb->nodes) > 1)
|
||||||
|
|
||||||
|
accesses uninitialised memory. So move that test inside
|
||||||
|
a test for a bitmap being present.
|
||||||
|
|
||||||
|
Note by Coly Li: this patch is modified for SLE12-SP3.
|
||||||
|
|
||||||
|
Signed-off-by: NeilBrown <neilb@suse.com>
|
||||||
|
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
||||||
|
Signed-off-by: Coly Li <colyli@suse.de>
|
||||||
|
---
|
||||||
|
super1.c | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
Index: mdadm-4.0/super1.c
|
||||||
|
===================================================================
|
||||||
|
--- mdadm-4.0.orig/super1.c
|
||||||
|
+++ mdadm-4.0/super1.c
|
||||||
|
@@ -950,14 +950,14 @@ static void getinfo_super1(struct supert
|
||||||
|
info->array.state =
|
||||||
|
(__le64_to_cpu(sb->resync_offset) == MaxSector)
|
||||||
|
? 1 : 0;
|
||||||
|
- if (__le32_to_cpu(bsb->nodes) > 1)
|
||||||
|
- info->array.state |= (1 << MD_SB_CLUSTERED);
|
||||||
|
|
||||||
|
super_offset = __le64_to_cpu(sb->super_offset);
|
||||||
|
info->data_offset = __le64_to_cpu(sb->data_offset);
|
||||||
|
info->component_size = __le64_to_cpu(sb->size);
|
||||||
|
if (sb->feature_map & __le32_to_cpu(MD_FEATURE_BITMAP_OFFSET)) {
|
||||||
|
info->bitmap_offset = (int32_t)__le32_to_cpu(sb->bitmap_offset);
|
||||||
|
+ if (__le32_to_cpu(bsb->nodes) > 1)
|
||||||
|
+ info->array.state |= (1 << MD_SB_CLUSTERED);
|
||||||
|
} else if (sb->feature_map & __le32_to_cpu(MD_FEATURE_PPL)) {
|
||||||
|
info->ppl_offset = __le16_to_cpu(sb->ppl.offset);
|
||||||
|
info->ppl_size = __le16_to_cpu(sb->ppl.size);
|
@ -1,3 +1,86 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Aug 21 16:44:54 UTC 2017 - colyli@suse.com
|
||||||
|
|
||||||
|
- SLE15 continues to use mdadm-4.0, synchronize mdadm package from
|
||||||
|
SLE12-SP3 to SLE15, re-order all patches.
|
||||||
|
|
||||||
|
- Rename the following patches, they are deleted and re-add in next
|
||||||
|
part of patches
|
||||||
|
0001-Generic-support-for-consistency-policy-and-PPL.patch
|
||||||
|
0002-Detail-show-consistency-policy.patch
|
||||||
|
0002-The-mdcheck-script-now-adds-messages-to-the-system.patch
|
||||||
|
0003-imsm-PPL-support.patch
|
||||||
|
0004-super1-PPL-support.patch
|
||||||
|
0005-Add-ppl-and-no-ppl-options-for-update.patch
|
||||||
|
0006-Grow-support-consistency-policy-change.patch
|
||||||
|
0007-udev-md-raid-assembly.rules-Skip-non-ready-devices.patch
|
||||||
|
0008-Retry-HOT_REMOVE_DISK-a-few-times.patch
|
||||||
|
0009-Introduce-sys_hot_remove_disk.patch
|
||||||
|
0010-Add-force-flag-to-hot_remove_disk.patch
|
||||||
|
0011-Detail-handle-non-existent-arrays-better.patch
|
||||||
|
|
||||||
|
- Synchronize patches from mdadm of SLE12-SP3, the above renamed
|
||||||
|
patches are re-add here,
|
||||||
|
0001-Makefile-Fix-date-to-be-output-in-ISO-format.patch
|
||||||
|
0002-imsm-fix-missing-error-message-during-migration.patch
|
||||||
|
0003-Fix-oddity-where-mdadm-did-not-recognise-a-relative-.patch
|
||||||
|
0004-mdadm-check-the-nodes-when-operate-clustered-array.patch
|
||||||
|
0005-examine-tidy-up-some-code.patch
|
||||||
|
0006-mdadm-add-man-page-for-symlinks.patch
|
||||||
|
0007-mdadm-add-checking-clustered-bitmap-in-assemble-mode.patch
|
||||||
|
0008-mdadm-Add-Wimplicit-fallthrough-0-in-Makefile.patch
|
||||||
|
0009-mdadm-Specify-enough-length-when-write-to-buffer.patch
|
||||||
|
0010-mdadm-it-doesn-t-make-sense-to-set-bitmap-twice.patch
|
||||||
|
0011-mdadm-Monitor-Fix-NULL-pointer-dereference-when-stat.patch
|
||||||
|
0012-Replace-snprintf-with-strncpy-at-some-places-to-avoi.patch
|
||||||
|
0013-mdadm-Forced-type-conversion-to-avoid-truncation.patch
|
||||||
|
0014-super1-ignore-failfast-flag-for-setting-device-role.patch
|
||||||
|
0015-mdadm-bitmap-fixed-typos-in-comments-of-bitmap.h.patch
|
||||||
|
0016-udev-md-raid-assembly.rules-Skip-non-ready-devices.patch
|
||||||
|
0017-Retry-HOT_REMOVE_DISK-a-few-times.patch
|
||||||
|
0018-mdadm-Build-check-the-level-parameter-when-build-new.patch
|
||||||
|
0019-Introduce-sys_hot_remove_disk.patch
|
||||||
|
0020-Add-force-flag-to-hot_remove_disk.patch
|
||||||
|
0021-Detail-handle-non-existent-arrays-better.patch
|
||||||
|
0022-Generic-support-for-consistency-policy-and-PPL.patch
|
||||||
|
0023-Detail-show-consistency-policy.patch
|
||||||
|
0024-imsm-PPL-support.patch
|
||||||
|
0025-super1-PPL-support.patch
|
||||||
|
0026-Add-ppl-and-no-ppl-options-for-update.patch
|
||||||
|
0027-Grow-support-consistency-policy-change.patch
|
||||||
|
0028-mdadm.h-struct-mdinfo-reorganize-ppl-elements-for-be.patch
|
||||||
|
0029-super1-replace-hard-coded-values-with-bit-definition.patch
|
||||||
|
0030-mdadm-Clean-up-some-ugly-multiple-actions-on-single-.patch
|
||||||
|
0031-mdadm-Fixup-a-number-of-whitespace-inconsistency-cas.patch
|
||||||
|
0032-util-Cosmetic-changes.patch
|
||||||
|
0033-Grow-Fixup-a-pile-of-cosmetic-issues.patch
|
||||||
|
0034-Grow-Remove-unnecessary-optimization.patch
|
||||||
|
0035-Grow-Do-not-shadow-an-existing-variable.patch
|
||||||
|
0036-imsm-use-rounded-size-for-metadata-initialization.patch
|
||||||
|
0037-mdadm.c-fix-compile-error-switch-condition-has-boole.patch
|
||||||
|
0038-Create-Fixup-bad-placement-of-logical-in-multi-line-.patch
|
||||||
|
0039-Create-Fixup-various-whitespace-issues.patch
|
||||||
|
0040-mdadm.c-fix-compile-warning-mdfd-is-uninitialized.patch
|
||||||
|
0041-mdopen-use-parameters-new_array-to-create-arrays-whe.patch
|
||||||
|
0042-mdadm-manpage-update-manpage-for-readonly-parameter.patch
|
||||||
|
0043-mdadm-manpage-clustered-arrays-don-t-support-array-s.patch
|
||||||
|
0044-maps-Terminate-modes-map-correctly.patch
|
||||||
|
0045-Grow_continue_command-ensure-content-is-properly-ini.patch
|
||||||
|
0046-systemd-mdadm-last-resort-use-ConditionPathExists-in.patch
|
||||||
|
0047-Detail-ensure-export-names-are-acceptable-as-shell-v.patch
|
||||||
|
0048-Grow-set-component-size-prior-to-array-size.patch
|
||||||
|
0049-Grow-don-t-allow-to-enable-PPL-when-reshape-is-in-pr.patch
|
||||||
|
0050-Grow-don-t-allow-array-geometry-change-with-ppl-enab.patch
|
||||||
|
0051-IMSM-Correct-examine-output-for-4k-disks.patch
|
||||||
|
0052-imsm-allow-drives-in-a-container-regardless-of-secto.patch
|
||||||
|
0053-imsm-allocate-buffer-to-support-maximum-sector-size.patch
|
||||||
|
0054-imsm-don-t-allow-disks-with-different-sector-size-in.patch
|
||||||
|
0055-Allow-more-spare-selection-criteria.patch
|
||||||
|
0056-Add-sector-size-as-spare-selection-criterion.patch
|
||||||
|
0057-super1-fix-sb-max_dev-when-adding-a-new-disk-in-line.patch
|
||||||
|
0058-super1-only-set-clustered-flag-when-bitmap-is-presen.patch
|
||||||
|
1000-The-mdcheck-script-now-adds-messages-to-the-system.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Mar 24 04:10:22 UTC 2017 - nfbrown@suse.com
|
Fri Mar 24 04:10:22 UTC 2017 - nfbrown@suse.com
|
||||||
|
|
||||||
|
120
mdadm.spec
120
mdadm.spec
@ -39,18 +39,65 @@ Source1: Software-RAID.HOWTO.tar.bz2
|
|||||||
Source2: sysconfig.mdadm
|
Source2: sysconfig.mdadm
|
||||||
Source3: cron.d.mdadm
|
Source3: cron.d.mdadm
|
||||||
Source7: mdadm.cron
|
Source7: mdadm.cron
|
||||||
Patch0: 0002-The-mdcheck-script-now-adds-messages-to-the-system.patch
|
Patch1: 0001-Makefile-Fix-date-to-be-output-in-ISO-format.patch
|
||||||
Patch1: 0001-Generic-support-for-consistency-policy-and-PPL.patch
|
Patch2: 0002-imsm-fix-missing-error-message-during-migration.patch
|
||||||
Patch2: 0002-Detail-show-consistency-policy.patch
|
Patch3: 0003-Fix-oddity-where-mdadm-did-not-recognise-a-relative-.patch
|
||||||
Patch3: 0003-imsm-PPL-support.patch
|
Patch4: 0004-mdadm-check-the-nodes-when-operate-clustered-array.patch
|
||||||
Patch4: 0004-super1-PPL-support.patch
|
Patch5: 0005-examine-tidy-up-some-code.patch
|
||||||
Patch5: 0005-Add-ppl-and-no-ppl-options-for-update.patch
|
Patch6: 0006-mdadm-add-man-page-for-symlinks.patch
|
||||||
Patch6: 0006-Grow-support-consistency-policy-change.patch
|
Patch7: 0007-mdadm-add-checking-clustered-bitmap-in-assemble-mode.patch
|
||||||
Patch7: 0007-udev-md-raid-assembly.rules-Skip-non-ready-devices.patch
|
Patch8: 0008-mdadm-Add-Wimplicit-fallthrough-0-in-Makefile.patch
|
||||||
Patch8: 0008-Retry-HOT_REMOVE_DISK-a-few-times.patch
|
Patch9: 0009-mdadm-Specify-enough-length-when-write-to-buffer.patch
|
||||||
Patch9: 0009-Introduce-sys_hot_remove_disk.patch
|
Patch10: 0010-mdadm-it-doesn-t-make-sense-to-set-bitmap-twice.patch
|
||||||
Patch10: 0010-Add-force-flag-to-hot_remove_disk.patch
|
Patch11: 0011-mdadm-Monitor-Fix-NULL-pointer-dereference-when-stat.patch
|
||||||
Patch11: 0011-Detail-handle-non-existent-arrays-better.patch
|
Patch12: 0012-Replace-snprintf-with-strncpy-at-some-places-to-avoi.patch
|
||||||
|
Patch13: 0013-mdadm-Forced-type-conversion-to-avoid-truncation.patch
|
||||||
|
Patch14: 0014-super1-ignore-failfast-flag-for-setting-device-role.patch
|
||||||
|
Patch15: 0015-mdadm-bitmap-fixed-typos-in-comments-of-bitmap.h.patch
|
||||||
|
Patch16: 0016-udev-md-raid-assembly.rules-Skip-non-ready-devices.patch
|
||||||
|
Patch17: 0017-Retry-HOT_REMOVE_DISK-a-few-times.patch
|
||||||
|
Patch18: 0018-mdadm-Build-check-the-level-parameter-when-build-new.patch
|
||||||
|
Patch19: 0019-Introduce-sys_hot_remove_disk.patch
|
||||||
|
Patch20: 0020-Add-force-flag-to-hot_remove_disk.patch
|
||||||
|
Patch21: 0021-Detail-handle-non-existent-arrays-better.patch
|
||||||
|
Patch22: 0022-Generic-support-for-consistency-policy-and-PPL.patch
|
||||||
|
Patch23: 0023-Detail-show-consistency-policy.patch
|
||||||
|
Patch24: 0024-imsm-PPL-support.patch
|
||||||
|
Patch25: 0025-super1-PPL-support.patch
|
||||||
|
Patch26: 0026-Add-ppl-and-no-ppl-options-for-update.patch
|
||||||
|
Patch27: 0027-Grow-support-consistency-policy-change.patch
|
||||||
|
Patch28: 0028-mdadm.h-struct-mdinfo-reorganize-ppl-elements-for-be.patch
|
||||||
|
Patch29: 0029-super1-replace-hard-coded-values-with-bit-definition.patch
|
||||||
|
Patch30: 0030-mdadm-Clean-up-some-ugly-multiple-actions-on-single-.patch
|
||||||
|
Patch31: 0031-mdadm-Fixup-a-number-of-whitespace-inconsistency-cas.patch
|
||||||
|
Patch32: 0032-util-Cosmetic-changes.patch
|
||||||
|
Patch33: 0033-Grow-Fixup-a-pile-of-cosmetic-issues.patch
|
||||||
|
Patch34: 0034-Grow-Remove-unnecessary-optimization.patch
|
||||||
|
Patch35: 0035-Grow-Do-not-shadow-an-existing-variable.patch
|
||||||
|
Patch36: 0036-imsm-use-rounded-size-for-metadata-initialization.patch
|
||||||
|
Patch37: 0037-mdadm.c-fix-compile-error-switch-condition-has-boole.patch
|
||||||
|
Patch38: 0038-Create-Fixup-bad-placement-of-logical-in-multi-line-.patch
|
||||||
|
Patch39: 0039-Create-Fixup-various-whitespace-issues.patch
|
||||||
|
Patch40: 0040-mdadm.c-fix-compile-warning-mdfd-is-uninitialized.patch
|
||||||
|
Patch41: 0041-mdopen-use-parameters-new_array-to-create-arrays-whe.patch
|
||||||
|
Patch42: 0042-mdadm-manpage-update-manpage-for-readonly-parameter.patch
|
||||||
|
Patch43: 0043-mdadm-manpage-clustered-arrays-don-t-support-array-s.patch
|
||||||
|
Patch44: 0044-maps-Terminate-modes-map-correctly.patch
|
||||||
|
Patch45: 0045-Grow_continue_command-ensure-content-is-properly-ini.patch
|
||||||
|
Patch46: 0046-systemd-mdadm-last-resort-use-ConditionPathExists-in.patch
|
||||||
|
Patch47: 0047-Detail-ensure-export-names-are-acceptable-as-shell-v.patch
|
||||||
|
Patch48: 0048-Grow-set-component-size-prior-to-array-size.patch
|
||||||
|
Patch49: 0049-Grow-don-t-allow-to-enable-PPL-when-reshape-is-in-pr.patch
|
||||||
|
Patch50: 0050-Grow-don-t-allow-array-geometry-change-with-ppl-enab.patch
|
||||||
|
Patch51: 0051-IMSM-Correct-examine-output-for-4k-disks.patch
|
||||||
|
Patch52: 0052-imsm-allow-drives-in-a-container-regardless-of-secto.patch
|
||||||
|
Patch53: 0053-imsm-allocate-buffer-to-support-maximum-sector-size.patch
|
||||||
|
Patch54: 0054-imsm-don-t-allow-disks-with-different-sector-size-in.patch
|
||||||
|
Patch55: 0055-Allow-more-spare-selection-criteria.patch
|
||||||
|
Patch56: 0056-Add-sector-size-as-spare-selection-criterion.patch
|
||||||
|
Patch57: 0057-super1-fix-sb-max_dev-when-adding-a-new-disk-in-line.patch
|
||||||
|
Patch58: 0058-super1-only-set-clustered-flag-when-bitmap-is-presen.patch
|
||||||
|
Patch1000: 1000-The-mdcheck-script-now-adds-messages-to-the-system.patch
|
||||||
|
|
||||||
%define _udevdir %(pkg-config --variable=udevdir udev)
|
%define _udevdir %(pkg-config --variable=udevdir udev)
|
||||||
%define _systemdshutdowndir %{_unitdir}/../system-shutdown
|
%define _systemdshutdowndir %{_unitdir}/../system-shutdown
|
||||||
@ -62,7 +109,6 @@ programs but with a very different interface.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -a1
|
%setup -q -a1
|
||||||
%patch0 -p1
|
|
||||||
%patch1 -p1
|
%patch1 -p1
|
||||||
%patch2 -p1
|
%patch2 -p1
|
||||||
%patch3 -p1
|
%patch3 -p1
|
||||||
@ -74,6 +120,54 @@ programs but with a very different interface.
|
|||||||
%patch9 -p1
|
%patch9 -p1
|
||||||
%patch10 -p1
|
%patch10 -p1
|
||||||
%patch11 -p1
|
%patch11 -p1
|
||||||
|
%patch12 -p1
|
||||||
|
%patch13 -p1
|
||||||
|
%patch14 -p1
|
||||||
|
%patch15 -p1
|
||||||
|
%patch16 -p1
|
||||||
|
%patch17 -p1
|
||||||
|
%patch18 -p1
|
||||||
|
%patch19 -p1
|
||||||
|
%patch20 -p1
|
||||||
|
%patch21 -p1
|
||||||
|
%patch22 -p1
|
||||||
|
%patch23 -p1
|
||||||
|
%patch24 -p1
|
||||||
|
%patch25 -p1
|
||||||
|
%patch26 -p1
|
||||||
|
%patch27 -p1
|
||||||
|
%patch28 -p1
|
||||||
|
%patch29 -p1
|
||||||
|
%patch30 -p1
|
||||||
|
%patch31 -p1
|
||||||
|
%patch32 -p1
|
||||||
|
%patch33 -p1
|
||||||
|
%patch34 -p1
|
||||||
|
%patch35 -p1
|
||||||
|
%patch36 -p1
|
||||||
|
%patch37 -p1
|
||||||
|
%patch38 -p1
|
||||||
|
%patch39 -p1
|
||||||
|
%patch40 -p1
|
||||||
|
%patch41 -p1
|
||||||
|
%patch42 -p1
|
||||||
|
%patch43 -p1
|
||||||
|
%patch44 -p1
|
||||||
|
%patch45 -p1
|
||||||
|
%patch46 -p1
|
||||||
|
%patch47 -p1
|
||||||
|
%patch48 -p1
|
||||||
|
%patch49 -p1
|
||||||
|
%patch50 -p1
|
||||||
|
%patch51 -p1
|
||||||
|
%patch52 -p1
|
||||||
|
%patch53 -p1
|
||||||
|
%patch54 -p1
|
||||||
|
%patch55 -p1
|
||||||
|
%patch56 -p1
|
||||||
|
%patch57 -p1
|
||||||
|
%patch58 -p1
|
||||||
|
%patch1000 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
make %{?_smp_mflags} CC="%__cc" CXFLAGS="$RPM_OPT_FLAGS -Wno-error" SUSE=yes
|
make %{?_smp_mflags} CC="%__cc" CXFLAGS="$RPM_OPT_FLAGS -Wno-error" SUSE=yes
|
||||||
|
Loading…
Reference in New Issue
Block a user