Accepting request 658682 from Base:System
- Update mdadm code base to mdadm-4.1 (FATE#325869, bsc#1111960) - Assorted bug-fixes, minor improvements, and code cleanup - Add PPL support (alternate change-journalling model) (forwarded request 658654 from colyli) OBS-URL: https://build.opensuse.org/request/show/658682 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/mdadm?expand=0&rev=116
This commit is contained in:
commit
cc1bf93349
77
0001-Document-PART-POLICY-lines.patch
Normal file
77
0001-Document-PART-POLICY-lines.patch
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
From 6b6112842030309c297a521918d1a2e982426fa3 Mon Sep 17 00:00:00 2001
|
||||||
|
From: NeilBrown <neilb@suse.com>
|
||||||
|
Date: Fri, 9 Nov 2018 17:12:33 +1100
|
||||||
|
Subject: [PATCH 1/5] Document PART-POLICY lines
|
||||||
|
|
||||||
|
PART-POLICY has been accepted in mdadm.conf since the same
|
||||||
|
time that POLICY was accepted, but it was never documented.
|
||||||
|
So add the missing documentation.
|
||||||
|
|
||||||
|
Also fix a bug which would have stopped it from working if
|
||||||
|
anyone had ever tried to use it.
|
||||||
|
|
||||||
|
Signed-off-by: NeilBrown <neilb@suse.com>
|
||||||
|
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
||||||
|
---
|
||||||
|
mdadm.conf.5 | 24 +++++++++++++++++++++++-
|
||||||
|
policy.c | 2 +-
|
||||||
|
2 files changed, 24 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/mdadm.conf.5 b/mdadm.conf.5
|
||||||
|
index 18512cb0ec7e..47c962ab2071 100644
|
||||||
|
--- a/mdadm.conf.5
|
||||||
|
+++ b/mdadm.conf.5
|
||||||
|
@@ -501,7 +501,7 @@ To update hot plug configuration it is necessary to execute
|
||||||
|
.B mdadm \-\-udev\-rules
|
||||||
|
command after changing the config file
|
||||||
|
|
||||||
|
-Key words used in the
|
||||||
|
+Keywords used in the
|
||||||
|
.I POLICY
|
||||||
|
line and supported values are:
|
||||||
|
|
||||||
|
@@ -565,6 +565,28 @@ be automatically added to that array (or it's container)
|
||||||
|
as above and the disk will become a spare in remaining cases
|
||||||
|
.RE
|
||||||
|
|
||||||
|
+.TP
|
||||||
|
+.B PART-POLICY
|
||||||
|
+This is similar to
|
||||||
|
+.B POLICY
|
||||||
|
+and accepts the same keyword assignments. It allows a consistent set
|
||||||
|
+of policies to applied to each of the partitions of a device.
|
||||||
|
+
|
||||||
|
+A
|
||||||
|
+.B PART-POLICY
|
||||||
|
+line should set
|
||||||
|
+.I type=disk
|
||||||
|
+and identify the path to one or more disk devices. Each partition on
|
||||||
|
+these disks will be treated according to the
|
||||||
|
+.I action=
|
||||||
|
+setting from this line. If a
|
||||||
|
+.I domain
|
||||||
|
+is set in the line, then the domain associated with each patition will
|
||||||
|
+be based on the domain, but with
|
||||||
|
+.RB \(dq -part N\(dq
|
||||||
|
+appended, when N is the partition number for the partition that was
|
||||||
|
+found.
|
||||||
|
+
|
||||||
|
.SH EXAMPLE
|
||||||
|
DEVICE /dev/sd[bcdjkl]1
|
||||||
|
.br
|
||||||
|
diff --git a/policy.c b/policy.c
|
||||||
|
index c0d18a7eca5b..258f39317951 100644
|
||||||
|
--- a/policy.c
|
||||||
|
+++ b/policy.c
|
||||||
|
@@ -300,7 +300,7 @@ static int path_has_part(char *path, char **part)
|
||||||
|
l--;
|
||||||
|
if (l < 5 || strncmp(path+l-5, "-part", 5) != 0)
|
||||||
|
return 0;
|
||||||
|
- *part = path+l-4;
|
||||||
|
+ *part = path+l-5;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.14.0.rc0.dirty
|
||||||
|
|
@ -1,30 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
30
0001-Makefile-install-mdadm_env.sh-to-usr-lib-mdadm.patch
Normal file
30
0001-Makefile-install-mdadm_env.sh-to-usr-lib-mdadm.patch
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
From 6e79d4bd229e5db4e435917daf4c57cd79db9265 Mon Sep 17 00:00:00 2001
|
||||||
|
From: colyli <colyli@suse.coly>
|
||||||
|
Date: Wed, 17 Oct 2018 11:08:39 +0800
|
||||||
|
Subject: [PATCH] Makefile: install mdadm_env.sh to /usr/lib/mdadm
|
||||||
|
|
||||||
|
Current Makefile installs mdadm_env.sh to /usr/libexec/mdadm but calls it
|
||||||
|
from /usr/lib/mdadm. This patch changes the installation directory to
|
||||||
|
/usr/lib/mdadm to make things working.
|
||||||
|
|
||||||
|
Signed-off-by: Coly Li <colyli@suse.de>
|
||||||
|
---
|
||||||
|
Makefile | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/Makefile b/Makefile
|
||||||
|
index 2767ac6..c0aaece 100644
|
||||||
|
--- a/Makefile
|
||||||
|
+++ b/Makefile
|
||||||
|
@@ -89,7 +89,7 @@ MDMON_DIR = $(RUN_DIR)
|
||||||
|
# place for autoreplace cookies
|
||||||
|
FAILED_SLOTS_DIR = $(RUN_DIR)/failed-slots
|
||||||
|
SYSTEMD_DIR=/lib/systemd/system
|
||||||
|
-LIB_DIR=/usr/libexec/mdadm
|
||||||
|
+LIB_DIR=/usr/lib/mdadm
|
||||||
|
|
||||||
|
COROSYNC:=$(shell [ -d /usr/include/corosync ] || echo -DNO_COROSYNC)
|
||||||
|
DLM:=$(shell [ -f /usr/include/libdlm.h ] || echo -DNO_DLM)
|
||||||
|
--
|
||||||
|
2.19.0
|
||||||
|
|
@ -1,34 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
334
0002-policy-support-devices-with-multiple-paths.patch
Normal file
334
0002-policy-support-devices-with-multiple-paths.patch
Normal file
@ -0,0 +1,334 @@
|
|||||||
|
From cd72f9d114da206baa01fd56ff2d8ffcc08f3239 Mon Sep 17 00:00:00 2001
|
||||||
|
From: NeilBrown <neilb@suse.com>
|
||||||
|
Date: Fri, 9 Nov 2018 17:12:33 +1100
|
||||||
|
Subject: [PATCH 2/5] policy: support devices with multiple paths.
|
||||||
|
|
||||||
|
As new releases of Linux some time change the name of
|
||||||
|
a path, some distros keep "legacy" names as well. This
|
||||||
|
is useful, but confuses mdadm which assumes each device has
|
||||||
|
precisely one path.
|
||||||
|
|
||||||
|
So change this assumption: allow a disk to have several
|
||||||
|
paths, and allow any to match when looking for a policy
|
||||||
|
which matches a disk.
|
||||||
|
|
||||||
|
Reported-and-tested-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com>
|
||||||
|
Signed-off-by: NeilBrown <neilb@suse.com>
|
||||||
|
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
||||||
|
---
|
||||||
|
Incremental.c | 5 +-
|
||||||
|
mdadm.h | 2 +-
|
||||||
|
policy.c | 163 ++++++++++++++++++++++++++++++++--------------------------
|
||||||
|
3 files changed, 95 insertions(+), 75 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/Incremental.c b/Incremental.c
|
||||||
|
index a4ff7d4bd22d..d4d3c353560d 100644
|
||||||
|
--- a/Incremental.c
|
||||||
|
+++ b/Incremental.c
|
||||||
|
@@ -1080,6 +1080,7 @@ static int partition_try_spare(char *devname, int *dfdp, struct dev_policy *pol,
|
||||||
|
struct supertype *st2 = NULL;
|
||||||
|
char *devname = NULL;
|
||||||
|
unsigned long long devsectors;
|
||||||
|
+ char *pathlist[2];
|
||||||
|
|
||||||
|
if (de->d_ino == 0 || de->d_name[0] == '.' ||
|
||||||
|
(de->d_type != DT_LNK && de->d_type != DT_UNKNOWN))
|
||||||
|
@@ -1094,7 +1095,9 @@ static int partition_try_spare(char *devname, int *dfdp, struct dev_policy *pol,
|
||||||
|
/* This is a partition - skip it */
|
||||||
|
goto next;
|
||||||
|
|
||||||
|
- pol2 = path_policy(de->d_name, type_disk);
|
||||||
|
+ pathlist[0] = de->d_name;
|
||||||
|
+ pathlist[1] = NULL;
|
||||||
|
+ pol2 = path_policy(pathlist, type_disk);
|
||||||
|
|
||||||
|
domain_merge(&domlist, pol2, st ? st->ss->name : NULL);
|
||||||
|
if (domain_test(domlist, pol, st ? st->ss->name : NULL) != 1)
|
||||||
|
diff --git a/mdadm.h b/mdadm.h
|
||||||
|
index 387e681aa4ed..705bd9b53b3a 100644
|
||||||
|
--- a/mdadm.h
|
||||||
|
+++ b/mdadm.h
|
||||||
|
@@ -1247,7 +1247,7 @@ extern void policyline(char *line, char *type);
|
||||||
|
extern void policy_add(char *type, ...);
|
||||||
|
extern void policy_free(void);
|
||||||
|
|
||||||
|
-extern struct dev_policy *path_policy(char *path, char *type);
|
||||||
|
+extern struct dev_policy *path_policy(char **paths, char *type);
|
||||||
|
extern struct dev_policy *disk_policy(struct mdinfo *disk);
|
||||||
|
extern struct dev_policy *devid_policy(int devid);
|
||||||
|
extern void dev_policy_free(struct dev_policy *p);
|
||||||
|
diff --git a/policy.c b/policy.c
|
||||||
|
index 258f39317951..fa67d5594c04 100644
|
||||||
|
--- a/policy.c
|
||||||
|
+++ b/policy.c
|
||||||
|
@@ -189,15 +189,17 @@ struct dev_policy *pol_find(struct dev_policy *pol, char *name)
|
||||||
|
return pol;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static char *disk_path(struct mdinfo *disk)
|
||||||
|
+static char **disk_paths(struct mdinfo *disk)
|
||||||
|
{
|
||||||
|
struct stat stb;
|
||||||
|
int prefix_len;
|
||||||
|
DIR *by_path;
|
||||||
|
char symlink[PATH_MAX] = "/dev/disk/by-path/";
|
||||||
|
- char nm[PATH_MAX];
|
||||||
|
+ char **paths;
|
||||||
|
+ int cnt = 0;
|
||||||
|
struct dirent *ent;
|
||||||
|
- int rv;
|
||||||
|
+
|
||||||
|
+ paths = xmalloc(sizeof(*paths) * (cnt+1));
|
||||||
|
|
||||||
|
by_path = opendir(symlink);
|
||||||
|
if (by_path) {
|
||||||
|
@@ -214,22 +216,13 @@ static char *disk_path(struct mdinfo *disk)
|
||||||
|
continue;
|
||||||
|
if (stb.st_rdev != makedev(disk->disk.major, disk->disk.minor))
|
||||||
|
continue;
|
||||||
|
- closedir(by_path);
|
||||||
|
- return xstrdup(ent->d_name);
|
||||||
|
+ paths[cnt++] = xstrdup(ent->d_name);
|
||||||
|
+ paths = xrealloc(paths, sizeof(*paths) * (cnt+1));
|
||||||
|
}
|
||||||
|
closedir(by_path);
|
||||||
|
}
|
||||||
|
- /* A NULL path isn't really acceptable - use the devname.. */
|
||||||
|
- sprintf(symlink, "/sys/dev/block/%d:%d", disk->disk.major, disk->disk.minor);
|
||||||
|
- rv = readlink(symlink, nm, sizeof(nm)-1);
|
||||||
|
- if (rv > 0) {
|
||||||
|
- char *dname;
|
||||||
|
- nm[rv] = 0;
|
||||||
|
- dname = strrchr(nm, '/');
|
||||||
|
- if (dname)
|
||||||
|
- return xstrdup(dname + 1);
|
||||||
|
- }
|
||||||
|
- return xstrdup("unknown");
|
||||||
|
+ paths[cnt] = NULL;
|
||||||
|
+ return paths;
|
||||||
|
}
|
||||||
|
|
||||||
|
char type_part[] = "part";
|
||||||
|
@@ -246,18 +239,53 @@ static char *disk_type(struct mdinfo *disk)
|
||||||
|
return type_disk;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int pol_match(struct rule *rule, char *path, char *type)
|
||||||
|
+static int path_has_part(char *path, char **part)
|
||||||
|
+{
|
||||||
|
+ /* check if path ends with "-partNN" and
|
||||||
|
+ * if it does, place a pointer to "-pathNN"
|
||||||
|
+ * in 'part'.
|
||||||
|
+ */
|
||||||
|
+ int l;
|
||||||
|
+ if (!path)
|
||||||
|
+ return 0;
|
||||||
|
+ l = strlen(path);
|
||||||
|
+ while (l > 1 && isdigit(path[l-1]))
|
||||||
|
+ l--;
|
||||||
|
+ if (l < 5 || strncmp(path+l-5, "-part", 5) != 0)
|
||||||
|
+ return 0;
|
||||||
|
+ *part = path+l-5;
|
||||||
|
+ return 1;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int pol_match(struct rule *rule, char **paths, char *type, char **part)
|
||||||
|
{
|
||||||
|
- /* check if this rule matches on path and type */
|
||||||
|
+ /* Check if this rule matches on any path and type.
|
||||||
|
+ * If 'part' is not NULL, then 'path' must end in -partN, which
|
||||||
|
+ * we ignore for matching, and return in *part on success.
|
||||||
|
+ */
|
||||||
|
int pathok = 0; /* 0 == no path, 1 == match, -1 == no match yet */
|
||||||
|
int typeok = 0;
|
||||||
|
|
||||||
|
- while (rule) {
|
||||||
|
+ for (; rule; rule = rule->next) {
|
||||||
|
if (rule->name == rule_path) {
|
||||||
|
+ char *p;
|
||||||
|
+ int i;
|
||||||
|
if (pathok == 0)
|
||||||
|
pathok = -1;
|
||||||
|
- if (path && fnmatch(rule->value, path, 0) == 0)
|
||||||
|
- pathok = 1;
|
||||||
|
+ if (!paths)
|
||||||
|
+ continue;
|
||||||
|
+ for (i = 0; paths[i]; i++) {
|
||||||
|
+ if (part) {
|
||||||
|
+ if (!path_has_part(paths[i], &p))
|
||||||
|
+ continue;
|
||||||
|
+ *p = '\0';
|
||||||
|
+ *part = p+1;
|
||||||
|
+ }
|
||||||
|
+ if (fnmatch(rule->value, paths[i], 0) == 0)
|
||||||
|
+ pathok = 1;
|
||||||
|
+ if (part)
|
||||||
|
+ *p = '-';
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
if (rule->name == rule_type) {
|
||||||
|
if (typeok == 0)
|
||||||
|
@@ -265,7 +293,6 @@ static int pol_match(struct rule *rule, char *path, char *type)
|
||||||
|
if (type && strcmp(rule->value, type) == 0)
|
||||||
|
typeok = 1;
|
||||||
|
}
|
||||||
|
- rule = rule->next;
|
||||||
|
}
|
||||||
|
return pathok >= 0 && typeok >= 0;
|
||||||
|
}
|
||||||
|
@@ -286,24 +313,6 @@ static void pol_merge(struct dev_policy **pol, struct rule *rule)
|
||||||
|
pol_new(pol, r->name, r->value, metadata);
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int path_has_part(char *path, char **part)
|
||||||
|
-{
|
||||||
|
- /* check if path ends with "-partNN" and
|
||||||
|
- * if it does, place a pointer to "-pathNN"
|
||||||
|
- * in 'part'.
|
||||||
|
- */
|
||||||
|
- int l;
|
||||||
|
- if (!path)
|
||||||
|
- return 0;
|
||||||
|
- l = strlen(path);
|
||||||
|
- while (l > 1 && isdigit(path[l-1]))
|
||||||
|
- l--;
|
||||||
|
- if (l < 5 || strncmp(path+l-5, "-part", 5) != 0)
|
||||||
|
- return 0;
|
||||||
|
- *part = path+l-5;
|
||||||
|
- return 1;
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
static void pol_merge_part(struct dev_policy **pol, struct rule *rule, char *part)
|
||||||
|
{
|
||||||
|
/* copy any name assignments from rule into pol, appending
|
||||||
|
@@ -352,7 +361,7 @@ static int config_rules_has_path = 0;
|
||||||
|
* path_policy() gathers policy information for the
|
||||||
|
* disk described in the given a 'path' and a 'type'.
|
||||||
|
*/
|
||||||
|
-struct dev_policy *path_policy(char *path, char *type)
|
||||||
|
+struct dev_policy *path_policy(char **paths, char *type)
|
||||||
|
{
|
||||||
|
struct pol_rule *rules;
|
||||||
|
struct dev_policy *pol = NULL;
|
||||||
|
@@ -361,27 +370,24 @@ struct dev_policy *path_policy(char *path, char *type)
|
||||||
|
rules = config_rules;
|
||||||
|
|
||||||
|
while (rules) {
|
||||||
|
- char *part;
|
||||||
|
+ char *part = NULL;
|
||||||
|
if (rules->type == rule_policy)
|
||||||
|
- if (pol_match(rules->rule, path, type))
|
||||||
|
+ if (pol_match(rules->rule, paths, type, NULL))
|
||||||
|
pol_merge(&pol, rules->rule);
|
||||||
|
if (rules->type == rule_part && strcmp(type, type_part) == 0)
|
||||||
|
- if (path_has_part(path, &part)) {
|
||||||
|
- *part = 0;
|
||||||
|
- if (pol_match(rules->rule, path, type_disk))
|
||||||
|
- pol_merge_part(&pol, rules->rule, part+1);
|
||||||
|
- *part = '-';
|
||||||
|
- }
|
||||||
|
+ if (pol_match(rules->rule, paths, type_disk, &part))
|
||||||
|
+ pol_merge_part(&pol, rules->rule, part);
|
||||||
|
rules = rules->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Now add any metadata-specific internal knowledge
|
||||||
|
* about this path
|
||||||
|
*/
|
||||||
|
- for (i=0; path && superlist[i]; i++)
|
||||||
|
+ for (i=0; paths[0] && superlist[i]; i++)
|
||||||
|
if (superlist[i]->get_disk_controller_domain) {
|
||||||
|
const char *d =
|
||||||
|
- superlist[i]->get_disk_controller_domain(path);
|
||||||
|
+ superlist[i]->get_disk_controller_domain(
|
||||||
|
+ paths[0]);
|
||||||
|
if (d)
|
||||||
|
pol_new(&pol, pol_domain, d, superlist[i]->name);
|
||||||
|
}
|
||||||
|
@@ -400,22 +406,34 @@ void pol_add(struct dev_policy **pol,
|
||||||
|
pol_dedup(*pol);
|
||||||
|
}
|
||||||
|
|
||||||
|
+static void free_paths(char **paths)
|
||||||
|
+{
|
||||||
|
+ int i;
|
||||||
|
+
|
||||||
|
+ if (!paths)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ for (i = 0; paths[i]; i++)
|
||||||
|
+ free(paths[i]);
|
||||||
|
+ free(paths);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/*
|
||||||
|
* disk_policy() gathers policy information for the
|
||||||
|
* disk described in the given mdinfo (disk.{major,minor}).
|
||||||
|
*/
|
||||||
|
struct dev_policy *disk_policy(struct mdinfo *disk)
|
||||||
|
{
|
||||||
|
- char *path = NULL;
|
||||||
|
+ char **paths = NULL;
|
||||||
|
char *type = disk_type(disk);
|
||||||
|
struct dev_policy *pol = NULL;
|
||||||
|
|
||||||
|
if (config_rules_has_path)
|
||||||
|
- path = disk_path(disk);
|
||||||
|
+ paths = disk_paths(disk);
|
||||||
|
|
||||||
|
- pol = path_policy(path, type);
|
||||||
|
+ pol = path_policy(paths, type);
|
||||||
|
|
||||||
|
- free(path);
|
||||||
|
+ free_paths(paths);
|
||||||
|
return pol;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -756,27 +774,26 @@ int policy_check_path(struct mdinfo *disk, struct map_ent *array)
|
||||||
|
{
|
||||||
|
char path[PATH_MAX];
|
||||||
|
FILE *f = NULL;
|
||||||
|
- char *id_path = disk_path(disk);
|
||||||
|
- int rv;
|
||||||
|
+ char **id_paths = disk_paths(disk);
|
||||||
|
+ int i;
|
||||||
|
+ int rv = 0;
|
||||||
|
|
||||||
|
- if (!id_path)
|
||||||
|
- return 0;
|
||||||
|
+ for (i = 0; id_paths[i]; i++) {
|
||||||
|
+ snprintf(path, PATH_MAX, FAILED_SLOTS_DIR "/%s", id_paths[i]);
|
||||||
|
+ f = fopen(path, "r");
|
||||||
|
+ if (!f)
|
||||||
|
+ continue;
|
||||||
|
|
||||||
|
- snprintf(path, PATH_MAX, FAILED_SLOTS_DIR "/%s", id_path);
|
||||||
|
- f = fopen(path, "r");
|
||||||
|
- if (!f) {
|
||||||
|
- free(id_path);
|
||||||
|
- return 0;
|
||||||
|
+ rv = fscanf(f, " %s %x:%x:%x:%x\n",
|
||||||
|
+ array->metadata,
|
||||||
|
+ array->uuid,
|
||||||
|
+ array->uuid+1,
|
||||||
|
+ array->uuid+2,
|
||||||
|
+ array->uuid+3);
|
||||||
|
+ fclose(f);
|
||||||
|
+ break;
|
||||||
|
}
|
||||||
|
-
|
||||||
|
- rv = fscanf(f, " %s %x:%x:%x:%x\n",
|
||||||
|
- array->metadata,
|
||||||
|
- array->uuid,
|
||||||
|
- array->uuid+1,
|
||||||
|
- array->uuid+2,
|
||||||
|
- array->uuid+3);
|
||||||
|
- fclose(f);
|
||||||
|
- free(id_path);
|
||||||
|
+ free_paths(id_paths);
|
||||||
|
return rv == 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.14.0.rc0.dirty
|
||||||
|
|
@ -1,43 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
137
0003-mdcheck-add-systemd-unit-files-to-run-mdcheck.patch
Normal file
137
0003-mdcheck-add-systemd-unit-files-to-run-mdcheck.patch
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
From 4199d3c629c14866505923d19fa50017ee92d2e1 Mon Sep 17 00:00:00 2001
|
||||||
|
From: NeilBrown <neilb@suse.com>
|
||||||
|
Date: Wed, 5 Dec 2018 16:35:00 +1100
|
||||||
|
Subject: [PATCH 3/5] mdcheck: add systemd unit files to run mdcheck.
|
||||||
|
|
||||||
|
Having the mdcheck script is not use if is never run.
|
||||||
|
This patch adds systemd unit files so that it can easily
|
||||||
|
be run on the first Sunday of each month for 6 hours,
|
||||||
|
then on every subsequent morning until the check is
|
||||||
|
finished.
|
||||||
|
|
||||||
|
The units still need to be enabled with
|
||||||
|
systemctl enable mdcheck_start.timer
|
||||||
|
|
||||||
|
The timer will only actually be started when an array
|
||||||
|
which might need it becomes active.
|
||||||
|
|
||||||
|
Signed-off-by: NeilBrown <neilb@suse.com>
|
||||||
|
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
||||||
|
---
|
||||||
|
Makefile | 5 ++++-
|
||||||
|
systemd/mdcheck_continue.service | 18 ++++++++++++++++++
|
||||||
|
systemd/mdcheck_continue.timer | 13 +++++++++++++
|
||||||
|
systemd/mdcheck_start.service | 17 +++++++++++++++++
|
||||||
|
systemd/mdcheck_start.timer | 15 +++++++++++++++
|
||||||
|
5 files changed, 67 insertions(+), 1 deletion(-)
|
||||||
|
create mode 100644 systemd/mdcheck_continue.service
|
||||||
|
create mode 100644 systemd/mdcheck_continue.timer
|
||||||
|
create mode 100644 systemd/mdcheck_start.service
|
||||||
|
create mode 100644 systemd/mdcheck_start.timer
|
||||||
|
|
||||||
|
diff --git a/Makefile b/Makefile
|
||||||
|
index 2767ac68396d..afb62cc6e3a6 100644
|
||||||
|
--- a/Makefile
|
||||||
|
+++ b/Makefile
|
||||||
|
@@ -276,7 +276,10 @@ install-udev: udev-md-raid-arrays.rules udev-md-raid-assembly.rules udev-md-raid
|
||||||
|
|
||||||
|
install-systemd: systemd/mdmon@.service
|
||||||
|
@for file in mdmon@.service mdmonitor.service mdadm-last-resort@.timer \
|
||||||
|
- mdadm-last-resort@.service mdadm-grow-continue@.service; \
|
||||||
|
+ mdadm-last-resort@.service mdadm-grow-continue@.service \
|
||||||
|
+ mdcheck_start.timer mdcheck_start.service \
|
||||||
|
+ mdcheck_continue.timer mdcheck_continue.service \
|
||||||
|
+ ; \
|
||||||
|
do sed -e 's,BINDIR,$(BINDIR),g' systemd/$$file > .install.tmp.2 && \
|
||||||
|
$(ECHO) $(INSTALL) -D -m 644 systemd/$$file $(DESTDIR)$(SYSTEMD_DIR)/$$file ; \
|
||||||
|
$(INSTALL) -D -m 644 .install.tmp.2 $(DESTDIR)$(SYSTEMD_DIR)/$$file ; \
|
||||||
|
diff --git a/systemd/mdcheck_continue.service b/systemd/mdcheck_continue.service
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000000..592c60798f82
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/systemd/mdcheck_continue.service
|
||||||
|
@@ -0,0 +1,18 @@
|
||||||
|
+# This file is part of mdadm.
|
||||||
|
+#
|
||||||
|
+# mdadm is free software; you can redistribute it and/or modify it
|
||||||
|
+# under the terms of the GNU General Public License as published by
|
||||||
|
+# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
+# (at your option) any later version.
|
||||||
|
+
|
||||||
|
+[Unit]
|
||||||
|
+Description=MD array scrubbing - continuation
|
||||||
|
+ConditionPathExistsGlob = /var/lib/mdcheck/MD_UUID_*
|
||||||
|
+
|
||||||
|
+[Service]
|
||||||
|
+Type=oneshot
|
||||||
|
+Environment= MDADM_CHECK_DURATION='"6 hours"'
|
||||||
|
+EnvironmentFile=-/run/sysconfig/mdadm
|
||||||
|
+ExecStartPre=-/usr/lib/mdadm/mdadm_env.sh
|
||||||
|
+ExecStart=/usr/share/mdadm/mdcheck --continue --duration $MDADM_CHECK_DURATION
|
||||||
|
+
|
||||||
|
diff --git a/systemd/mdcheck_continue.timer b/systemd/mdcheck_continue.timer
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000000..3ccfd7858a3f
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/systemd/mdcheck_continue.timer
|
||||||
|
@@ -0,0 +1,13 @@
|
||||||
|
+# This file is part of mdadm.
|
||||||
|
+#
|
||||||
|
+# mdadm is free software; you can redistribute it and/or modify it
|
||||||
|
+# under the terms of the GNU General Public License as published by
|
||||||
|
+# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
+# (at your option) any later version.
|
||||||
|
+
|
||||||
|
+[Unit]
|
||||||
|
+Description=MD array scrubbing - continuation
|
||||||
|
+
|
||||||
|
+[Timer]
|
||||||
|
+OnCalendar= 1:05:00
|
||||||
|
+
|
||||||
|
diff --git a/systemd/mdcheck_start.service b/systemd/mdcheck_start.service
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000000..812141bb5c9a
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/systemd/mdcheck_start.service
|
||||||
|
@@ -0,0 +1,17 @@
|
||||||
|
+# This file is part of mdadm.
|
||||||
|
+#
|
||||||
|
+# mdadm is free software; you can redistribute it and/or modify it
|
||||||
|
+# under the terms of the GNU General Public License as published by
|
||||||
|
+# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
+# (at your option) any later version.
|
||||||
|
+
|
||||||
|
+[Unit]
|
||||||
|
+Description=MD array scrubbing
|
||||||
|
+Wants=mdcheck_continue.timer
|
||||||
|
+
|
||||||
|
+[Service]
|
||||||
|
+Type=oneshot
|
||||||
|
+Environment= MDADM_CHECK_DURATION='"6 hours"'
|
||||||
|
+EnvironmentFile=-/run/sysconfig/mdadm
|
||||||
|
+ExecStartPre=-/usr/lib/mdadm/mdadm_env.sh
|
||||||
|
+ExecStart=/usr/share/mdadm/mdcheck --duration $MDADM_CHECK_DURATION
|
||||||
|
diff --git a/systemd/mdcheck_start.timer b/systemd/mdcheck_start.timer
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000000..64807362d649
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/systemd/mdcheck_start.timer
|
||||||
|
@@ -0,0 +1,15 @@
|
||||||
|
+# This file is part of mdadm.
|
||||||
|
+#
|
||||||
|
+# mdadm is free software; you can redistribute it and/or modify it
|
||||||
|
+# under the terms of the GNU General Public License as published by
|
||||||
|
+# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
+# (at your option) any later version.
|
||||||
|
+
|
||||||
|
+[Unit]
|
||||||
|
+Description=MD array scrubbing
|
||||||
|
+
|
||||||
|
+[Timer]
|
||||||
|
+OnCalendar=Sun *-*-1..7 1:00:00
|
||||||
|
+
|
||||||
|
+[Install]
|
||||||
|
+WantedBy= mdmonitor.service
|
||||||
|
--
|
||||||
|
2.14.0.rc0.dirty
|
||||||
|
|
@ -0,0 +1,82 @@
|
|||||||
|
From 7cd7e91ab3de5aa75dc963cb08b0618c1885cf0d Mon Sep 17 00:00:00 2001
|
||||||
|
From: NeilBrown <neilb@suse.com>
|
||||||
|
Date: Wed, 5 Dec 2018 16:35:00 +1100
|
||||||
|
Subject: [PATCH 4/5] Monitor: add system timer to run --oneshot periodically
|
||||||
|
|
||||||
|
"mdadm --monitor --oneshot" can be used to get a warning
|
||||||
|
if there are any degraded arrays. It can be helpful to get
|
||||||
|
this warning periodically while the condition persists.
|
||||||
|
|
||||||
|
This patch add a systemd service and timer which can
|
||||||
|
be enabled with
|
||||||
|
systemctl enable mdmonitor-oneshot.service
|
||||||
|
|
||||||
|
and will then provide daily warnings.
|
||||||
|
|
||||||
|
Signed-off-by: NeilBrown <neilb@suse.com>
|
||||||
|
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
||||||
|
---
|
||||||
|
Makefile | 1 +
|
||||||
|
systemd/mdmonitor-oneshot.service | 15 +++++++++++++++
|
||||||
|
systemd/mdmonitor-oneshot.timer | 15 +++++++++++++++
|
||||||
|
3 files changed, 31 insertions(+)
|
||||||
|
create mode 100644 systemd/mdmonitor-oneshot.service
|
||||||
|
create mode 100644 systemd/mdmonitor-oneshot.timer
|
||||||
|
|
||||||
|
diff --git a/Makefile b/Makefile
|
||||||
|
index afb62cc6e3a6..dfe00b0a0be8 100644
|
||||||
|
--- a/Makefile
|
||||||
|
+++ b/Makefile
|
||||||
|
@@ -279,6 +279,7 @@ install-systemd: systemd/mdmon@.service
|
||||||
|
mdadm-last-resort@.service mdadm-grow-continue@.service \
|
||||||
|
mdcheck_start.timer mdcheck_start.service \
|
||||||
|
mdcheck_continue.timer mdcheck_continue.service \
|
||||||
|
+ mdmonitor-oneshot.timer mdmonitor-oneshot.service \
|
||||||
|
; \
|
||||||
|
do sed -e 's,BINDIR,$(BINDIR),g' systemd/$$file > .install.tmp.2 && \
|
||||||
|
$(ECHO) $(INSTALL) -D -m 644 systemd/$$file $(DESTDIR)$(SYSTEMD_DIR)/$$file ; \
|
||||||
|
diff --git a/systemd/mdmonitor-oneshot.service b/systemd/mdmonitor-oneshot.service
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000000..fd469b12cc78
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/systemd/mdmonitor-oneshot.service
|
||||||
|
@@ -0,0 +1,15 @@
|
||||||
|
+# This file is part of mdadm.
|
||||||
|
+#
|
||||||
|
+# mdadm is free software; you can redistribute it and/or modify it
|
||||||
|
+# under the terms of the GNU General Public License as published by
|
||||||
|
+# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
+# (at your option) any later version.
|
||||||
|
+
|
||||||
|
+[Unit]
|
||||||
|
+Description=Reminder for degraded MD arrays
|
||||||
|
+
|
||||||
|
+[Service]
|
||||||
|
+Environment= MDADM_MONITOR_ARGS=--scan
|
||||||
|
+EnvironmentFile=-/run/sysconfig/mdadm
|
||||||
|
+ExecStartPre=-/usr/lib/mdadm/mdadm_env.sh
|
||||||
|
+ExecStart=BINDIR/mdadm --monitor --oneshot $MDADM_MONITOR_ARGS
|
||||||
|
diff --git a/systemd/mdmonitor-oneshot.timer b/systemd/mdmonitor-oneshot.timer
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000000..cb54bdaa8897
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/systemd/mdmonitor-oneshot.timer
|
||||||
|
@@ -0,0 +1,15 @@
|
||||||
|
+# This file is part of mdadm.
|
||||||
|
+#
|
||||||
|
+# mdadm is free software; you can redistribute it and/or modify it
|
||||||
|
+# under the terms of the GNU General Public License as published by
|
||||||
|
+# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
+# (at your option) any later version.
|
||||||
|
+
|
||||||
|
+[Unit]
|
||||||
|
+Description=Reminder for degraded MD arrays
|
||||||
|
+
|
||||||
|
+[Timer]
|
||||||
|
+OnCalendar= 2:00:00
|
||||||
|
+
|
||||||
|
+[Install]
|
||||||
|
+WantedBy= mdmonitor.service
|
||||||
|
--
|
||||||
|
2.14.0.rc0.dirty
|
||||||
|
|
@ -1,54 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
@ -1,146 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
@ -0,0 +1,83 @@
|
|||||||
|
From d7a1fda2769ba272d89de6caeab35d52b73a9c3c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com>
|
||||||
|
Date: Wed, 17 Oct 2018 12:11:41 +0200
|
||||||
|
Subject: [PATCH 5/5] imsm: update metadata correctly while raid10 double
|
||||||
|
degradation
|
||||||
|
|
||||||
|
Mdmon calls end_migration() when map state changes from normal to
|
||||||
|
degraded. It is not valid because in raid 10 double degradation case
|
||||||
|
mdmon breaks checkpointing but array is still rebuilding.
|
||||||
|
In this case mdmon has to mark map as degraded and continues marking
|
||||||
|
recovery checkpoint in metadata. Migration can be finished only if newly
|
||||||
|
failed device is a rebuilding device.
|
||||||
|
|
||||||
|
Add catching double degraded to degraded transition. Migration is
|
||||||
|
finished but map state doesn't change, array is still degraded.
|
||||||
|
|
||||||
|
Update failed_disk_num correctly. If double degradation
|
||||||
|
happens rebuild will start on the lowest slot, but this variable points
|
||||||
|
to the first failed slot. If second fail happens while rebuild this
|
||||||
|
variable shouldn't be updated until rebuild is not finished.
|
||||||
|
|
||||||
|
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com>
|
||||||
|
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
||||||
|
---
|
||||||
|
super-intel.c | 25 +++++++++++++++++++------
|
||||||
|
1 file changed, 19 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/super-intel.c b/super-intel.c
|
||||||
|
index 6438987b778c..d2035ccd8270 100644
|
||||||
|
--- a/super-intel.c
|
||||||
|
+++ b/super-intel.c
|
||||||
|
@@ -8136,7 +8136,8 @@ static int mark_failure(struct intel_super *super,
|
||||||
|
set_imsm_ord_tbl_ent(map2, slot2,
|
||||||
|
idx | IMSM_ORD_REBUILD);
|
||||||
|
}
|
||||||
|
- if (map->failed_disk_num == 0xff)
|
||||||
|
+ if (map->failed_disk_num == 0xff ||
|
||||||
|
+ (!is_rebuilding(dev) && map->failed_disk_num > slot))
|
||||||
|
map->failed_disk_num = slot;
|
||||||
|
|
||||||
|
clear_disk_badblocks(super->bbm_log, ord_to_idx(ord));
|
||||||
|
@@ -8558,13 +8559,25 @@ static void imsm_set_disk(struct active_array *a, int n, int state)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (is_rebuilding(dev)) {
|
||||||
|
- dprintf_cont("while rebuilding.");
|
||||||
|
+ dprintf_cont("while rebuilding ");
|
||||||
|
if (map->map_state != map_state) {
|
||||||
|
- dprintf_cont(" Map state change");
|
||||||
|
- end_migration(dev, super, map_state);
|
||||||
|
+ dprintf_cont("map state change ");
|
||||||
|
+ if (n == map->failed_disk_num) {
|
||||||
|
+ dprintf_cont("end migration");
|
||||||
|
+ end_migration(dev, super, map_state);
|
||||||
|
+ } else {
|
||||||
|
+ dprintf_cont("raid10 double degradation, map state change");
|
||||||
|
+ map->map_state = map_state;
|
||||||
|
+ }
|
||||||
|
super->updates_pending++;
|
||||||
|
- } else if (!rebuild_done) {
|
||||||
|
+ } else if (!rebuild_done)
|
||||||
|
break;
|
||||||
|
+ else if (n == map->failed_disk_num) {
|
||||||
|
+ /* r10 double degraded to degraded transition */
|
||||||
|
+ dprintf_cont("raid10 double degradation end migration");
|
||||||
|
+ end_migration(dev, super, map_state);
|
||||||
|
+ a->last_checkpoint = 0;
|
||||||
|
+ super->updates_pending++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* check if recovery is really finished */
|
||||||
|
@@ -8575,7 +8588,7 @@ static void imsm_set_disk(struct active_array *a, int n, int state)
|
||||||
|
}
|
||||||
|
if (recovery_not_finished) {
|
||||||
|
dprintf_cont("\n");
|
||||||
|
- dprintf("Rebuild has not finished yet, state not changed");
|
||||||
|
+ dprintf_cont("Rebuild has not finished yet, map state changes only if raid10 double degradation happens");
|
||||||
|
if (a->last_checkpoint < mdi->recovery_start) {
|
||||||
|
a->last_checkpoint =
|
||||||
|
mdi->recovery_start;
|
||||||
|
--
|
||||||
|
2.14.0.rc0.dirty
|
||||||
|
|
34
0006-Grow-avoid-overflow-in-compute_backup_blocks.patch
Normal file
34
0006-Grow-avoid-overflow-in-compute_backup_blocks.patch
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
From 085df42259cba7863cd6ebe5cd0d8492ac5b869e Mon Sep 17 00:00:00 2001
|
||||||
|
From: NeilBrown <neilb@suse.com>
|
||||||
|
Date: Thu, 6 Dec 2018 10:35:41 +1100
|
||||||
|
Subject: [PATCH] Grow: avoid overflow in compute_backup_blocks()
|
||||||
|
|
||||||
|
With a chunk size of 16Meg and data drive count of 8,
|
||||||
|
this calculate can easily overflow the 'int' type that
|
||||||
|
is used for the multiplications.
|
||||||
|
So force it to use "long" instead.
|
||||||
|
|
||||||
|
Reported-and-tested-by: Ed Spiridonov <edo.rus@gmail.com>
|
||||||
|
Signed-off-by: NeilBrown <neilb@suse.com>
|
||||||
|
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
||||||
|
---
|
||||||
|
Grow.c | 3 ++-
|
||||||
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/Grow.c b/Grow.c
|
||||||
|
index 4436a4d6bd4c..76f82c075e38 100644
|
||||||
|
--- a/Grow.c
|
||||||
|
+++ b/Grow.c
|
||||||
|
@@ -1196,7 +1196,8 @@ unsigned long compute_backup_blocks(int nchunk, int ochunk,
|
||||||
|
/* Find GCD */
|
||||||
|
a = GCD(a, b);
|
||||||
|
/* LCM == product / GCD */
|
||||||
|
- blocks = (ochunk/512) * (nchunk/512) * odata * ndata / a;
|
||||||
|
+ blocks = (unsigned long)(ochunk/512) * (unsigned long)(nchunk/512) *
|
||||||
|
+ odata * ndata / a;
|
||||||
|
|
||||||
|
return blocks;
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.14.0.rc0.dirty
|
||||||
|
|
@ -1,49 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
30
0007-Grow-report-correct-new-chunk-size.patch
Normal file
30
0007-Grow-report-correct-new-chunk-size.patch
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
From 76d505dec6c9f92564553596fc8350324be82463 Mon Sep 17 00:00:00 2001
|
||||||
|
From: NeilBrown <neilb@suse.com>
|
||||||
|
Date: Thu, 6 Dec 2018 10:36:28 +1100
|
||||||
|
Subject: [PATCH] Grow: report correct new chunk size.
|
||||||
|
|
||||||
|
When using "--grow --chunk=" to change chunk
|
||||||
|
size, the old chunksize is reported instead of the new.
|
||||||
|
|
||||||
|
Signed-off-by: NeilBrown <neilb@suse.com>
|
||||||
|
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
||||||
|
---
|
||||||
|
Grow.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/Grow.c b/Grow.c
|
||||||
|
index 76f82c075e38..363b209d14a3 100644
|
||||||
|
--- a/Grow.c
|
||||||
|
+++ b/Grow.c
|
||||||
|
@@ -3286,7 +3286,7 @@ static int reshape_array(char *container, int fd, char *devname,
|
||||||
|
goto release;
|
||||||
|
} else if (verbose >= 0)
|
||||||
|
printf("chunk size for %s set to %d\n",
|
||||||
|
- devname, array.chunk_size);
|
||||||
|
+ devname, info->new_chunk);
|
||||||
|
}
|
||||||
|
unfreeze(st);
|
||||||
|
return 0;
|
||||||
|
--
|
||||||
|
2.14.0.rc0.dirty
|
||||||
|
|
@ -1,35 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
29
0008-policy.c-prevent-NULL-pointer-referencing.patch
Normal file
29
0008-policy.c-prevent-NULL-pointer-referencing.patch
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
From 179cab343006df996f0a85a542b40e44db0c2e2f Mon Sep 17 00:00:00 2001
|
||||||
|
From: Gioh Kim <gi-oh.kim@cloud.ionos.com>
|
||||||
|
Date: Fri, 7 Dec 2018 12:04:44 +0100
|
||||||
|
Subject: [PATCH] policy.c: prevent NULL pointer referencing
|
||||||
|
|
||||||
|
paths could be NULL and paths[0] should be followed by NULL pointer
|
||||||
|
checking.
|
||||||
|
|
||||||
|
Signed-off-by: Gioh Kim <gi-oh.kim@cloud.ionos.com>
|
||||||
|
---
|
||||||
|
policy.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/policy.c b/policy.c
|
||||||
|
index fa67d5594c04..e3a0671f3a3a 100644
|
||||||
|
--- a/policy.c
|
||||||
|
+++ b/policy.c
|
||||||
|
@@ -383,7 +383,7 @@ struct dev_policy *path_policy(char **paths, char *type)
|
||||||
|
/* Now add any metadata-specific internal knowledge
|
||||||
|
* about this path
|
||||||
|
*/
|
||||||
|
- for (i=0; paths[0] && superlist[i]; i++)
|
||||||
|
+ for (i=0; paths && paths[0] && superlist[i]; i++)
|
||||||
|
if (superlist[i]->get_disk_controller_domain) {
|
||||||
|
const char *d =
|
||||||
|
superlist[i]->get_disk_controller_domain(
|
||||||
|
--
|
||||||
|
2.14.0.rc0.dirty
|
||||||
|
|
@ -1,74 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
@ -1,47 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
@ -1,58 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
@ -1,47 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
|||||||
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,39 +0,0 @@
|
|||||||
From 3a77acd7170199adc690332ded37c41f067c720e Mon Sep 17 00:00:00 2001
|
|
||||||
From: Hannes Reinecke <hare@suse.de>
|
|
||||||
Date: Mon, 27 Mar 2017 11:15:44 +1100
|
|
||||||
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
|
|
||||||
handled by multipathing) it should not be considered for
|
|
||||||
md/RAID auto-assembly. Doing so can cause incorrect results
|
|
||||||
such as causing multipath to fail during startup.
|
|
||||||
|
|
||||||
There is a convention that the udev environment variable
|
|
||||||
SYSTEMD_READY be set to zero for such devices. So change
|
|
||||||
the mdadm rules to ignore devices with SYSTEMD_READY==0.
|
|
||||||
|
|
||||||
Signed-off-by: Hannes Reinecke <hare@suse.de>
|
|
||||||
Signed-off-by: NeilBrown <neilb@suse.com>
|
|
||||||
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
---
|
|
||||||
udev-md-raid-assembly.rules | 3 +++
|
|
||||||
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
|
|
||||||
+++ b/udev-md-raid-assembly.rules
|
|
||||||
@@ -7,6 +7,9 @@ ENV{ANACONDA}=="?*", GOTO="md_inc_end"
|
|
||||||
|
|
||||||
SUBSYSTEM!="block", GOTO="md_inc_end"
|
|
||||||
|
|
||||||
+# skip non-initialized devices
|
|
||||||
+ENV{SYSTEMD_READY}=="0", GOTO="md_inc_end"
|
|
||||||
+
|
|
||||||
# handle potential components of arrays (the ones supported by md)
|
|
||||||
ENV{ID_FS_TYPE}=="linux_raid_member", GOTO="md_inc"
|
|
||||||
|
|
||||||
--
|
|
||||||
2.10.2
|
|
||||||
|
|
@ -1,118 +0,0 @@
|
|||||||
From 2dd271fe7041c2f7036939cf6917c0578b92fefe Mon Sep 17 00:00:00 2001
|
|
||||||
From: NeilBrown <neilb@suse.com>
|
|
||||||
Date: Mon, 27 Mar 2017 12:50:16 +1100
|
|
||||||
Subject: [PATCH] Retry HOT_REMOVE_DISK a few times.
|
|
||||||
References: bsc#808647
|
|
||||||
|
|
||||||
HOT_REMOVE_DISK can fail with EBUSY if there are outstanding
|
|
||||||
IO request that have not completed yet. It can sometimes
|
|
||||||
be helpful to wait a little while for these to complete.
|
|
||||||
|
|
||||||
We already do this in impose_level() when reshaping a device,
|
|
||||||
but not in Manage.c in response to an explicit --remove request.
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
Signed-off-by: NeilBrown <neilb@suse.com>
|
|
||||||
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
---
|
|
||||||
Grow.c | 9 +--------
|
|
||||||
Manage.c | 4 ++--
|
|
||||||
mdadm.h | 1 +
|
|
||||||
util.c | 18 ++++++++++++++++++
|
|
||||||
4 files changed, 22 insertions(+), 10 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Grow.c b/Grow.c
|
|
||||||
index 455c5f9..218a706 100755
|
|
||||||
--- a/Grow.c
|
|
||||||
+++ b/Grow.c
|
|
||||||
@@ -2736,7 +2736,6 @@ static int impose_level(int fd, int level, char *devname, int verbose)
|
|
||||||
for (d = 0, found = 0;
|
|
||||||
d < MAX_DISKS && found < array.nr_disks;
|
|
||||||
d++) {
|
|
||||||
- int cnt;
|
|
||||||
mdu_disk_info_t disk;
|
|
||||||
disk.number = d;
|
|
||||||
if (ioctl(fd, GET_DISK_INFO, &disk) < 0)
|
|
||||||
@@ -2750,13 +2749,7 @@ static int impose_level(int fd, int level, char *devname, int verbose)
|
|
||||||
continue;
|
|
||||||
ioctl(fd, SET_DISK_FAULTY,
|
|
||||||
makedev(disk.major, disk.minor));
|
|
||||||
- cnt = 5;
|
|
||||||
- while (ioctl(fd, HOT_REMOVE_DISK,
|
|
||||||
- makedev(disk.major, disk.minor)) < 0
|
|
||||||
- && errno == EBUSY
|
|
||||||
- && cnt--) {
|
|
||||||
- usleep(10000);
|
|
||||||
- }
|
|
||||||
+ hot_remove_disk(fd, makedev(disk.major, disk.minor));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
c = map_num(pers, level);
|
|
||||||
diff --git a/Manage.c b/Manage.c
|
|
||||||
index 5c3d2b9..9139f96 100644
|
|
||||||
--- a/Manage.c
|
|
||||||
+++ b/Manage.c
|
|
||||||
@@ -1183,7 +1183,7 @@ int Manage_remove(struct supertype *tst, int fd, struct mddev_dev *dv,
|
|
||||||
else
|
|
||||||
err = 0;
|
|
||||||
} else {
|
|
||||||
- err = ioctl(fd, HOT_REMOVE_DISK, rdev);
|
|
||||||
+ err = hot_remove_disk(fd, rdev);
|
|
||||||
if (err && errno == ENODEV) {
|
|
||||||
/* Old kernels rejected this if no personality
|
|
||||||
* is registered */
|
|
||||||
@@ -1607,7 +1607,7 @@ int Manage_subdevs(char *devname, int fd,
|
|
||||||
|
|
||||||
if (dv->disposition == 'F')
|
|
||||||
/* Need to remove first */
|
|
||||||
- ioctl(fd, HOT_REMOVE_DISK, rdev);
|
|
||||||
+ hot_remove_disk(fd, rdev);
|
|
||||||
/* Make sure it isn't in use (in 2.6 or later) */
|
|
||||||
tfd = dev_open(dv->devname, O_RDONLY|O_EXCL);
|
|
||||||
if (tfd >= 0) {
|
|
||||||
diff --git a/mdadm.h b/mdadm.h
|
|
||||||
index 91fd9eb..5bcfb86 100644
|
|
||||||
--- a/mdadm.h
|
|
||||||
+++ b/mdadm.h
|
|
||||||
@@ -1476,6 +1476,7 @@ extern int add_disk(int mdfd, struct supertype *st,
|
|
||||||
struct mdinfo *sra, struct mdinfo *info);
|
|
||||||
extern int remove_disk(int mdfd, struct supertype *st,
|
|
||||||
struct mdinfo *sra, struct mdinfo *info);
|
|
||||||
+extern int hot_remove_disk(int mdfd, unsigned long dev);
|
|
||||||
extern int set_array_info(int mdfd, struct supertype *st, struct mdinfo *info);
|
|
||||||
unsigned long long min_recovery_start(struct mdinfo *array);
|
|
||||||
|
|
||||||
diff --git a/util.c b/util.c
|
|
||||||
index 32bd909..d09a7e2 100644
|
|
||||||
--- a/util.c
|
|
||||||
+++ b/util.c
|
|
||||||
@@ -1795,6 +1795,24 @@ int remove_disk(int mdfd, struct supertype *st,
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
+int hot_remove_disk(int mdfd, unsigned long dev)
|
|
||||||
+{
|
|
||||||
+ int cnt = 5;
|
|
||||||
+ int ret;
|
|
||||||
+
|
|
||||||
+ /* HOT_REMOVE_DISK can fail with EBUSY if there are
|
|
||||||
+ * outstanding IO requests to the device.
|
|
||||||
+ * In this case, it can be helpful to wait a little while,
|
|
||||||
+ * up to half a second, for that IO to flush.
|
|
||||||
+ */
|
|
||||||
+ while ((ret = ioctl(mdfd, HOT_REMOVE_DISK, dev)) == -1 &&
|
|
||||||
+ errno == EBUSY &&
|
|
||||||
+ cnt-- > 0)
|
|
||||||
+ usleep(10000);
|
|
||||||
+
|
|
||||||
+ return ret;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
int set_array_info(int mdfd, struct supertype *st, struct mdinfo *info)
|
|
||||||
{
|
|
||||||
/* Initialise kernel's knowledge of array.
|
|
||||||
--
|
|
||||||
2.10.2
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
|||||||
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,75 +0,0 @@
|
|||||||
From fdd015696c2e2a6b234a92af564aea44b62e6a0d Mon Sep 17 00:00:00 2001
|
|
||||||
From: NeilBrown <neilb@suse.com>
|
|
||||||
Date: Mon, 27 Mar 2017 14:36:56 +1100
|
|
||||||
Subject: [PATCH] Introduce sys_hot_remove_disk()
|
|
||||||
References: bsc#974154
|
|
||||||
|
|
||||||
The new hot_remove_disk() will retry HOT_REMOVE_DISK
|
|
||||||
several times in the face of EBUSY.
|
|
||||||
However we sometimes remove a device by writing "remove" to the
|
|
||||||
"state" attributed. This should be retried as well.
|
|
||||||
So introduce sys_hot_remove_disk() to repeat this action a few times.
|
|
||||||
|
|
||||||
Signed-off-by: NeilBrown <neilb@suse.com>
|
|
||||||
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
---
|
|
||||||
Manage.c | 6 +-----
|
|
||||||
mdadm.h | 1 +
|
|
||||||
util.c | 12 ++++++++++++
|
|
||||||
3 files changed, 14 insertions(+), 5 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Manage.c b/Manage.c
|
|
||||||
index 9139f96..edf5798 100644
|
|
||||||
--- a/Manage.c
|
|
||||||
+++ b/Manage.c
|
|
||||||
@@ -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
|
|
||||||
* the major:minor number
|
|
||||||
*/
|
|
||||||
- int n = write(sysfd, "remove", 6);
|
|
||||||
- if (n != 6)
|
|
||||||
- err = -1;
|
|
||||||
- else
|
|
||||||
- err = 0;
|
|
||||||
+ err = sys_hot_remove_disk(sysfd);
|
|
||||||
} else {
|
|
||||||
err = hot_remove_disk(fd, rdev);
|
|
||||||
if (err && errno == ENODEV) {
|
|
||||||
diff --git a/mdadm.h b/mdadm.h
|
|
||||||
index 5bcfb86..b855d24 100644
|
|
||||||
--- a/mdadm.h
|
|
||||||
+++ b/mdadm.h
|
|
||||||
@@ -1477,6 +1477,7 @@ extern int add_disk(int mdfd, struct supertype *st,
|
|
||||||
extern int remove_disk(int mdfd, struct supertype *st,
|
|
||||||
struct mdinfo *sra, struct mdinfo *info);
|
|
||||||
extern int hot_remove_disk(int mdfd, unsigned long dev);
|
|
||||||
+extern int sys_hot_remove_disk(int statefd);
|
|
||||||
extern int set_array_info(int mdfd, struct supertype *st, struct mdinfo *info);
|
|
||||||
unsigned long long min_recovery_start(struct mdinfo *array);
|
|
||||||
|
|
||||||
diff --git a/util.c b/util.c
|
|
||||||
index d09a7e2..b718531 100644
|
|
||||||
--- a/util.c
|
|
||||||
+++ b/util.c
|
|
||||||
@@ -1813,6 +1813,18 @@ int hot_remove_disk(int mdfd, unsigned long dev)
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
+int sys_hot_remove_disk(int statefd)
|
|
||||||
+{
|
|
||||||
+ int cnt = 5;
|
|
||||||
+ int ret;
|
|
||||||
+
|
|
||||||
+ while ((ret = write(statefd, "remove", 6)) == -1 &&
|
|
||||||
+ errno == EBUSY &&
|
|
||||||
+ cnt-- > 0)
|
|
||||||
+ usleep(10000);
|
|
||||||
+ return ret == 6 ? 0 : -1;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
int set_array_info(int mdfd, struct supertype *st, struct mdinfo *info)
|
|
||||||
{
|
|
||||||
/* Initialise kernel's knowledge of array.
|
|
||||||
--
|
|
||||||
2.10.2
|
|
||||||
|
|
@ -1,137 +0,0 @@
|
|||||||
From 1ab9ed2afb7ca50c4f922a0b85c4e6631becde02 Mon Sep 17 00:00:00 2001
|
|
||||||
From: NeilBrown <neilb@suse.com>
|
|
||||||
Date: Mon, 27 Mar 2017 14:36:56 +1100
|
|
||||||
Subject: [PATCH] Add 'force' flag to *hot_remove_disk().
|
|
||||||
References: bsc#808647
|
|
||||||
|
|
||||||
In rare circumstances, the short period that *hot_remove_disk()
|
|
||||||
waits isn't long enough to IO to complete. This particularly happens
|
|
||||||
when a device is failing and many retries are still happening.
|
|
||||||
|
|
||||||
We don't want to increase the normal wait time for "mdadm --remove"
|
|
||||||
as that might be use just to test if a device is active or not, and a
|
|
||||||
delay would be problematic.
|
|
||||||
So allow "--force" to mean that mdadm should try extra hard for a
|
|
||||||
--remove to complete, waiting up to 5 seconds.
|
|
||||||
|
|
||||||
Note that this patch fixes a comment which claim the previous
|
|
||||||
wait time was half a second, where it was really 50msec.
|
|
||||||
|
|
||||||
Signed-off-by: NeilBrown <neilb@suse.com>
|
|
||||||
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
---
|
|
||||||
Grow.c | 2 +-
|
|
||||||
Manage.c | 10 +++++-----
|
|
||||||
mdadm.h | 4 ++--
|
|
||||||
util.c | 10 +++++-----
|
|
||||||
4 files changed, 13 insertions(+), 13 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Grow.c b/Grow.c
|
|
||||||
index 218a706..e22661c 100755
|
|
||||||
--- a/Grow.c
|
|
||||||
+++ b/Grow.c
|
|
||||||
@@ -2749,7 +2749,7 @@ static int impose_level(int fd, int level, char *devname, int verbose)
|
|
||||||
continue;
|
|
||||||
ioctl(fd, SET_DISK_FAULTY,
|
|
||||||
makedev(disk.major, disk.minor));
|
|
||||||
- hot_remove_disk(fd, makedev(disk.major, disk.minor));
|
|
||||||
+ hot_remove_disk(fd, makedev(disk.major, disk.minor), 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
c = map_num(pers, level);
|
|
||||||
diff --git a/Manage.c b/Manage.c
|
|
||||||
index edf5798..55218d9 100644
|
|
||||||
--- a/Manage.c
|
|
||||||
+++ b/Manage.c
|
|
||||||
@@ -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 sysfd, unsigned long rdev, int verbose, char *devname)
|
|
||||||
+ int sysfd, unsigned long rdev, int force, int verbose, char *devname)
|
|
||||||
{
|
|
||||||
int lfd = -1;
|
|
||||||
int err;
|
|
||||||
@@ -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
|
|
||||||
* the major:minor number
|
|
||||||
*/
|
|
||||||
- err = sys_hot_remove_disk(sysfd);
|
|
||||||
+ err = sys_hot_remove_disk(sysfd, force);
|
|
||||||
} else {
|
|
||||||
- err = hot_remove_disk(fd, rdev);
|
|
||||||
+ err = hot_remove_disk(fd, rdev, force);
|
|
||||||
if (err && errno == ENODEV) {
|
|
||||||
/* Old kernels rejected this if no personality
|
|
||||||
* is registered */
|
|
||||||
@@ -1603,7 +1603,7 @@ int Manage_subdevs(char *devname, int fd,
|
|
||||||
|
|
||||||
if (dv->disposition == 'F')
|
|
||||||
/* Need to remove first */
|
|
||||||
- hot_remove_disk(fd, rdev);
|
|
||||||
+ hot_remove_disk(fd, rdev, force);
|
|
||||||
/* Make sure it isn't in use (in 2.6 or later) */
|
|
||||||
tfd = dev_open(dv->devname, O_RDONLY|O_EXCL);
|
|
||||||
if (tfd >= 0) {
|
|
||||||
@@ -1645,7 +1645,7 @@ int Manage_subdevs(char *devname, int fd,
|
|
||||||
rv = -1;
|
|
||||||
} else
|
|
||||||
rv = Manage_remove(tst, fd, dv, sysfd,
|
|
||||||
- rdev, verbose,
|
|
||||||
+ rdev, verbose, force,
|
|
||||||
devname);
|
|
||||||
if (sysfd >= 0)
|
|
||||||
close(sysfd);
|
|
||||||
diff --git a/mdadm.h b/mdadm.h
|
|
||||||
index b855d24..cebc0c0 100644
|
|
||||||
--- a/mdadm.h
|
|
||||||
+++ b/mdadm.h
|
|
||||||
@@ -1476,8 +1476,8 @@ extern int add_disk(int mdfd, struct supertype *st,
|
|
||||||
struct mdinfo *sra, struct mdinfo *info);
|
|
||||||
extern int remove_disk(int mdfd, struct supertype *st,
|
|
||||||
struct mdinfo *sra, struct mdinfo *info);
|
|
||||||
-extern int hot_remove_disk(int mdfd, unsigned long dev);
|
|
||||||
-extern int sys_hot_remove_disk(int statefd);
|
|
||||||
+extern int hot_remove_disk(int mdfd, unsigned long dev, int force);
|
|
||||||
+extern int sys_hot_remove_disk(int statefd, int force);
|
|
||||||
extern int set_array_info(int mdfd, struct supertype *st, struct mdinfo *info);
|
|
||||||
unsigned long long min_recovery_start(struct mdinfo *array);
|
|
||||||
|
|
||||||
diff --git a/util.c b/util.c
|
|
||||||
index b718531..683c869 100644
|
|
||||||
--- a/util.c
|
|
||||||
+++ b/util.c
|
|
||||||
@@ -1795,15 +1795,15 @@ int remove_disk(int mdfd, struct supertype *st,
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
-int hot_remove_disk(int mdfd, unsigned long dev)
|
|
||||||
+int hot_remove_disk(int mdfd, unsigned long dev, int force)
|
|
||||||
{
|
|
||||||
- int cnt = 5;
|
|
||||||
+ int cnt = force ? 500 : 5;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
/* HOT_REMOVE_DISK can fail with EBUSY if there are
|
|
||||||
* outstanding IO requests to the device.
|
|
||||||
* In this case, it can be helpful to wait a little while,
|
|
||||||
- * up to half a second, for that IO to flush.
|
|
||||||
+ * up to 5 seconds if 'force' is set, or 50 msec if not.
|
|
||||||
*/
|
|
||||||
while ((ret = ioctl(mdfd, HOT_REMOVE_DISK, dev)) == -1 &&
|
|
||||||
errno == EBUSY &&
|
|
||||||
@@ -1813,9 +1813,9 @@ int hot_remove_disk(int mdfd, unsigned long dev)
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
-int sys_hot_remove_disk(int statefd)
|
|
||||||
+int sys_hot_remove_disk(int statefd, int force)
|
|
||||||
{
|
|
||||||
- int cnt = 5;
|
|
||||||
+ int cnt = force ? 500 : 5;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
while ((ret = write(statefd, "remove", 6)) == -1 &&
|
|
||||||
--
|
|
||||||
2.10.2
|
|
||||||
|
|
@ -1,45 +0,0 @@
|
|||||||
From b4decd517d90098bc2d17d3eddfe858d8b903920 Mon Sep 17 00:00:00 2001
|
|
||||||
From: NeilBrown <neilb@suse.com>
|
|
||||||
Date: Mon, 27 Mar 2017 14:36:56 +1100
|
|
||||||
Subject: [PATCH] Detail: handle non-existent arrays better.
|
|
||||||
References: bsc#966773
|
|
||||||
|
|
||||||
If you call "mdadm --detail" with a device file for an array which
|
|
||||||
doesn't exist, such as by
|
|
||||||
mknod /dev/md57 b 9 57
|
|
||||||
mdadm --detail /dev/md57
|
|
||||||
|
|
||||||
you get an unhelpful message about and inactive RAID0, and return
|
|
||||||
status is '0'. This is confusing.
|
|
||||||
|
|
||||||
So catch this possibility and print a more useful message, and
|
|
||||||
return a non-zero status.
|
|
||||||
|
|
||||||
Signed-off-by: NeilBrown <neilb@suse.com>
|
|
||||||
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
---
|
|
||||||
Detail.c | 8 ++++++++
|
|
||||||
1 file changed, 8 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/Detail.c b/Detail.c
|
|
||||||
index cb33794..3d92855 100644
|
|
||||||
--- a/Detail.c
|
|
||||||
+++ b/Detail.c
|
|
||||||
@@ -110,6 +110,14 @@ int Detail(char *dev, struct context *c)
|
|
||||||
if (ioctl(fd, GET_ARRAY_INFO, &array) == 0) {
|
|
||||||
inactive = 0;
|
|
||||||
} else if (errno == ENODEV && sra) {
|
|
||||||
+ if (sra->array.major_version == -1 &&
|
|
||||||
+ sra->array.minor_version == -1 &&
|
|
||||||
+ sra->devs == NULL) {
|
|
||||||
+ pr_err("Array associated with md device %s does not exist.\n", dev);
|
|
||||||
+ close(fd);
|
|
||||||
+ sysfs_free(sra);
|
|
||||||
+ return rv;
|
|
||||||
+ }
|
|
||||||
array = sra->array;
|
|
||||||
inactive = 1;
|
|
||||||
} else {
|
|
||||||
--
|
|
||||||
2.10.2
|
|
||||||
|
|
@ -1,657 +0,0 @@
|
|||||||
From 5308f11727b889965efe5ac0e854d197c2b51f6d Mon Sep 17 00:00:00 2001
|
|
||||||
From: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|
||||||
Date: Wed, 29 Mar 2017 11:54:15 +0200
|
|
||||||
Subject: [PATCH] Generic support for --consistency-policy and PPL
|
|
||||||
References: FATE#321941
|
|
||||||
|
|
||||||
Add a new parameter to mdadm: --consistency-policy=. It determines how
|
|
||||||
the array maintains consistency in case of unexpected shutdown. This
|
|
||||||
maps to the md sysfs attribute 'consistency_policy'. It can be used to
|
|
||||||
create a raid5 array using PPL. Add the necessary plumbing to pass this
|
|
||||||
option to metadata handlers. The write journal and bitmap
|
|
||||||
functionalities are treated as different policies, which are implicitly
|
|
||||||
selected when using --write-journal or --bitmap options.
|
|
||||||
|
|
||||||
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|
||||||
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
---
|
|
||||||
Create.c | 18 ++++++++++++++----
|
|
||||||
Kill.c | 2 +-
|
|
||||||
ReadMe.c | 51 +++++++++++++++++++++++++++------------------------
|
|
||||||
maps.c | 10 ++++++++++
|
|
||||||
mdadm.8.in | 40 +++++++++++++++++++++++++++++++++++++---
|
|
||||||
mdadm.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
|
|
||||||
mdadm.h | 21 ++++++++++++++++++---
|
|
||||||
super-ddf.c | 6 +++---
|
|
||||||
super-gpt.c | 2 +-
|
|
||||||
super-intel.c | 16 ++++++++--------
|
|
||||||
super-mbr.c | 2 +-
|
|
||||||
super0.c | 8 ++++----
|
|
||||||
super1.c | 6 +++---
|
|
||||||
sysfs.c | 11 +++++++++++
|
|
||||||
14 files changed, 190 insertions(+), 58 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Create.c b/Create.c
|
|
||||||
index 2721884..4080bf6 100644
|
|
||||||
--- a/Create.c
|
|
||||||
+++ b/Create.c
|
|
||||||
@@ -259,7 +259,8 @@ int Create(struct supertype *st, char *mddev,
|
|
||||||
if (st && ! st->ss->validate_geometry(st, s->level, s->layout, s->raiddisks,
|
|
||||||
&s->chunk, s->size*2,
|
|
||||||
data_offset, NULL,
|
|
||||||
- &newsize, c->verbose>=0))
|
|
||||||
+ &newsize, s->consistency_policy,
|
|
||||||
+ c->verbose>=0))
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
if (s->chunk && s->chunk != UnSet) {
|
|
||||||
@@ -358,7 +359,8 @@ int Create(struct supertype *st, char *mddev,
|
|
||||||
st, s->level, s->layout, s->raiddisks,
|
|
||||||
&s->chunk, s->size*2,
|
|
||||||
dv->data_offset, dname,
|
|
||||||
- &freesize, c->verbose > 0)) {
|
|
||||||
+ &freesize, s->consistency_policy,
|
|
||||||
+ c->verbose > 0)) {
|
|
||||||
case -1: /* Not valid, message printed, and not
|
|
||||||
* worth checking any further */
|
|
||||||
exit(2);
|
|
||||||
@@ -395,6 +397,7 @@ int Create(struct supertype *st, char *mddev,
|
|
||||||
&s->chunk, s->size*2,
|
|
||||||
dv->data_offset,
|
|
||||||
dname, &freesize,
|
|
||||||
+ s->consistency_policy,
|
|
||||||
c->verbose >= 0)) {
|
|
||||||
|
|
||||||
pr_err("%s is not suitable for this array.\n",
|
|
||||||
@@ -501,7 +504,8 @@ int Create(struct supertype *st, char *mddev,
|
|
||||||
s->raiddisks,
|
|
||||||
&s->chunk, minsize*2,
|
|
||||||
data_offset,
|
|
||||||
- NULL, NULL, 0)) {
|
|
||||||
+ NULL, NULL,
|
|
||||||
+ s->consistency_policy, 0)) {
|
|
||||||
pr_err("devices too large for RAID level %d\n", s->level);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
@@ -528,6 +532,12 @@ int Create(struct supertype *st, char *mddev,
|
|
||||||
if (s->bitmap_file && strcmp(s->bitmap_file, "none") == 0)
|
|
||||||
s->bitmap_file = NULL;
|
|
||||||
|
|
||||||
+ if (s->consistency_policy == CONSISTENCY_POLICY_PPL &&
|
|
||||||
+ !st->ss->write_init_ppl) {
|
|
||||||
+ pr_err("%s metadata does not support PPL\n", st->ss->name);
|
|
||||||
+ return 1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
if (!have_container && s->level > 0 && ((maxsize-s->size)*100 > maxsize)) {
|
|
||||||
if (c->runstop != 1 || c->verbose >= 0)
|
|
||||||
pr_err("largest drive (%s) exceeds size (%lluK) by more than 1%%\n",
|
|
||||||
@@ -720,7 +730,7 @@ int Create(struct supertype *st, char *mddev,
|
|
||||||
name += 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
- if (!st->ss->init_super(st, &info.array, s->size, name, c->homehost, uuid,
|
|
||||||
+ if (!st->ss->init_super(st, &info.array, s, name, c->homehost, uuid,
|
|
||||||
data_offset))
|
|
||||||
goto abort_locked;
|
|
||||||
|
|
||||||
diff --git a/Kill.c b/Kill.c
|
|
||||||
index f2fdb85..ff52561 100644
|
|
||||||
--- a/Kill.c
|
|
||||||
+++ b/Kill.c
|
|
||||||
@@ -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);
|
|
||||||
if (rv == 0 || (force && rv >= 2)) {
|
|
||||||
st->ss->free_super(st);
|
|
||||||
- st->ss->init_super(st, NULL, 0, "", NULL, NULL,
|
|
||||||
+ st->ss->init_super(st, NULL, NULL, "", NULL, NULL,
|
|
||||||
INVALID_SECTORS);
|
|
||||||
if (st->ss->store_super(st, fd)) {
|
|
||||||
if (verbose >= 0)
|
|
||||||
diff --git a/ReadMe.c b/ReadMe.c
|
|
||||||
index 50d3807..fc04c2c 100644
|
|
||||||
--- a/ReadMe.c
|
|
||||||
+++ b/ReadMe.c
|
|
||||||
@@ -78,11 +78,11 @@ char Version[] = "mdadm - v" VERSION " - " VERS_DATE "\n";
|
|
||||||
* found, it is started.
|
|
||||||
*/
|
|
||||||
|
|
||||||
-char short_options[]="-ABCDEFGIQhVXYWZ:vqbc:i:l:p:m:n:x:u:c:d:z:U:N:sarfRSow1tye:";
|
|
||||||
+char short_options[]="-ABCDEFGIQhVXYWZ:vqbc:i:l:p:m:n:x:u:c:d:z:U:N:sarfRSow1tye:k:";
|
|
||||||
char short_bitmap_options[]=
|
|
||||||
- "-ABCDEFGIQhVXYWZ:vqb:c:i:l:p:m:n:x:u:c:d:z:U:N:sarfRSow1tye:";
|
|
||||||
+ "-ABCDEFGIQhVXYWZ:vqb:c:i:l:p:m:n:x:u:c:d:z:U:N:sarfRSow1tye:k:";
|
|
||||||
char short_bitmap_auto_options[]=
|
|
||||||
- "-ABCDEFGIQhVXYWZ:vqb:c:i:l:p:m:n:x:u:c:d:z:U:N:sa:rfRSow1tye:";
|
|
||||||
+ "-ABCDEFGIQhVXYWZ:vqb:c:i:l:p:m:n:x:u:c:d:z:U:N:sa:rfRSow1tye:k:";
|
|
||||||
|
|
||||||
struct option long_options[] = {
|
|
||||||
{"manage", 0, 0, ManageOpt},
|
|
||||||
@@ -148,6 +148,7 @@ struct option long_options[] = {
|
|
||||||
{"nodes",1, 0, Nodes}, /* also for --assemble */
|
|
||||||
{"home-cluster",1, 0, ClusterName},
|
|
||||||
{"write-journal",1, 0, WriteJournal},
|
|
||||||
+ {"consistency-policy", 1, 0, 'k'},
|
|
||||||
|
|
||||||
/* For assemble */
|
|
||||||
{"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
|
|
||||||
+++ b/maps.c
|
|
||||||
@@ -129,6 +129,16 @@ mapping_t faultylayout[] = {
|
|
||||||
{ NULL, 0}
|
|
||||||
};
|
|
||||||
|
|
||||||
+mapping_t consistency_policies[] = {
|
|
||||||
+ { "unknown", CONSISTENCY_POLICY_UNKNOWN},
|
|
||||||
+ { "none", CONSISTENCY_POLICY_NONE},
|
|
||||||
+ { "resync", CONSISTENCY_POLICY_RESYNC},
|
|
||||||
+ { "bitmap", CONSISTENCY_POLICY_BITMAP},
|
|
||||||
+ { "journal", CONSISTENCY_POLICY_JOURNAL},
|
|
||||||
+ { "ppl", CONSISTENCY_POLICY_PPL},
|
|
||||||
+ { NULL, 0}
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
char *map_num(mapping_t *map, int num)
|
|
||||||
{
|
|
||||||
while (map->name) {
|
|
||||||
diff --git a/mdadm.8.in b/mdadm.8.in
|
|
||||||
index df1d460..cad5db5 100644
|
|
||||||
--- a/mdadm.8.in
|
|
||||||
+++ b/mdadm.8.in
|
|
||||||
@@ -724,7 +724,9 @@ When creating an array on devices which are 100G or larger,
|
|
||||||
.I mdadm
|
|
||||||
automatically adds an internal bitmap as it will usually be
|
|
||||||
beneficial. This can be suppressed with
|
|
||||||
-.B "\-\-bitmap=none".
|
|
||||||
+.B "\-\-bitmap=none"
|
|
||||||
+or by selecting a different consistency policy with
|
|
||||||
+.BR \-\-consistency\-policy .
|
|
||||||
|
|
||||||
.TP
|
|
||||||
.BR \-\-bitmap\-chunk=
|
|
||||||
@@ -1020,6 +1022,36 @@ should be a SSD with reasonable lifetime.
|
|
||||||
Auto creation of symlinks in /dev to /dev/md, option --symlinks must
|
|
||||||
be 'no' or 'yes' and work with --create and --build.
|
|
||||||
|
|
||||||
+.TP
|
|
||||||
+.BR \-k ", " \-\-consistency\-policy=
|
|
||||||
+Specify how the array maintains consistency in case of unexpected shutdown.
|
|
||||||
+Only relevant for RAID levels with redundancy.
|
|
||||||
+Currently supported options are:
|
|
||||||
+.RS
|
|
||||||
+
|
|
||||||
+.TP
|
|
||||||
+.B resync
|
|
||||||
+Full resync is performed and all redundancy is regenerated when the array is
|
|
||||||
+started after unclean shutdown.
|
|
||||||
+
|
|
||||||
+.TP
|
|
||||||
+.B bitmap
|
|
||||||
+Resync assisted by a write-intent bitmap. Implicitly selected when using
|
|
||||||
+.BR \-\-bitmap .
|
|
||||||
+
|
|
||||||
+.TP
|
|
||||||
+.B journal
|
|
||||||
+For RAID levels 4/5/6, journal device is used to log transactions and replay
|
|
||||||
+after unclean shutdown. Implicitly selected when using
|
|
||||||
+.BR \-\-write\-journal .
|
|
||||||
+
|
|
||||||
+.TP
|
|
||||||
+.B ppl
|
|
||||||
+For RAID5 only, Partial Parity Log is used to close the write hole and
|
|
||||||
+eliminate resync. PPL is stored in the metadata region of RAID member drives,
|
|
||||||
+no additional journal drive is needed.
|
|
||||||
+.RE
|
|
||||||
+
|
|
||||||
|
|
||||||
.SH For assemble:
|
|
||||||
|
|
||||||
@@ -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
|
|
||||||
requested with the
|
|
||||||
.B \-\-bitmap
|
|
||||||
-option. In any case space for a bitmap will be reserved so that one
|
|
||||||
-can be added layer with
|
|
||||||
+option or a different consistency policy is selected with the
|
|
||||||
+.B \-\-consistency\-policy
|
|
||||||
+option. In any case space for a bitmap will be reserved so that one
|
|
||||||
+can be added later with
|
|
||||||
.BR "\-\-grow \-\-bitmap=internal" .
|
|
||||||
|
|
||||||
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
|
|
||||||
+++ b/mdadm.c
|
|
||||||
@@ -78,6 +78,7 @@ int main(int argc, char *argv[])
|
|
||||||
.level = UnSet,
|
|
||||||
.layout = UnSet,
|
|
||||||
.bitmap_chunk = UnSet,
|
|
||||||
+ .consistency_policy = UnSet,
|
|
||||||
};
|
|
||||||
|
|
||||||
char sys_hostname[256];
|
|
||||||
@@ -1215,6 +1216,16 @@ int main(int argc, char *argv[])
|
|
||||||
|
|
||||||
s.journaldisks = 1;
|
|
||||||
continue;
|
|
||||||
+ case O(CREATE, 'k'):
|
|
||||||
+ s.consistency_policy = map_name(consistency_policies,
|
|
||||||
+ optarg);
|
|
||||||
+ if (s.consistency_policy == UnSet ||
|
|
||||||
+ s.consistency_policy < CONSISTENCY_POLICY_RESYNC) {
|
|
||||||
+ pr_err("Invalid consistency policy: %s\n",
|
|
||||||
+ optarg);
|
|
||||||
+ exit(2);
|
|
||||||
+ }
|
|
||||||
+ continue;
|
|
||||||
}
|
|
||||||
/* We have now processed all the valid options. Anything else is
|
|
||||||
* an error
|
|
||||||
@@ -1242,9 +1253,47 @@ int main(int argc, char *argv[])
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (s.journaldisks && (s.level < 4 || s.level > 6)) {
|
|
||||||
- pr_err("--write-journal is only supported for RAID level 4/5/6.\n");
|
|
||||||
- exit(2);
|
|
||||||
+ if (s.journaldisks) {
|
|
||||||
+ if (s.level < 4 || s.level > 6) {
|
|
||||||
+ pr_err("--write-journal is only supported for RAID level 4/5/6.\n");
|
|
||||||
+ exit(2);
|
|
||||||
+ }
|
|
||||||
+ if (s.consistency_policy != UnSet &&
|
|
||||||
+ s.consistency_policy != CONSISTENCY_POLICY_JOURNAL) {
|
|
||||||
+ pr_err("--write-journal is not supported with consistency policy: %s\n",
|
|
||||||
+ map_num(consistency_policies, s.consistency_policy));
|
|
||||||
+ exit(2);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (mode == CREATE && s.consistency_policy != UnSet) {
|
|
||||||
+ if (s.level <= 0) {
|
|
||||||
+ pr_err("--consistency-policy not meaningful with level %s.\n",
|
|
||||||
+ map_num(pers, s.level));
|
|
||||||
+ exit(2);
|
|
||||||
+ } else if (s.consistency_policy == CONSISTENCY_POLICY_JOURNAL &&
|
|
||||||
+ !s.journaldisks) {
|
|
||||||
+ pr_err("--write-journal is required for consistency policy: %s\n",
|
|
||||||
+ map_num(consistency_policies, s.consistency_policy));
|
|
||||||
+ exit(2);
|
|
||||||
+ } else if (s.consistency_policy == CONSISTENCY_POLICY_PPL &&
|
|
||||||
+ s.level != 5) {
|
|
||||||
+ pr_err("PPL consistency policy is only supported for RAID level 5.\n");
|
|
||||||
+ exit(2);
|
|
||||||
+ } else if (s.consistency_policy == CONSISTENCY_POLICY_BITMAP &&
|
|
||||||
+ (!s.bitmap_file ||
|
|
||||||
+ strcmp(s.bitmap_file, "none") == 0)) {
|
|
||||||
+ pr_err("--bitmap is required for consistency policy: %s\n",
|
|
||||||
+ map_num(consistency_policies, s.consistency_policy));
|
|
||||||
+ exit(2);
|
|
||||||
+ } else if (s.bitmap_file &&
|
|
||||||
+ strcmp(s.bitmap_file, "none") != 0 &&
|
|
||||||
+ s.consistency_policy != CONSISTENCY_POLICY_BITMAP &&
|
|
||||||
+ s.consistency_policy != CONSISTENCY_POLICY_JOURNAL) {
|
|
||||||
+ pr_err("--bitmap is not compatible with consistency policy: %s\n",
|
|
||||||
+ map_num(consistency_policies, s.consistency_policy));
|
|
||||||
+ exit(2);
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!mode && devs_found) {
|
|
||||||
diff --git a/mdadm.h b/mdadm.h
|
|
||||||
index cebc0c0..b52d4d3 100644
|
|
||||||
--- a/mdadm.h
|
|
||||||
+++ b/mdadm.h
|
|
||||||
@@ -279,6 +279,15 @@ struct mdinfo {
|
|
||||||
int journal_device_required;
|
|
||||||
int journal_clean;
|
|
||||||
|
|
||||||
+ enum {
|
|
||||||
+ CONSISTENCY_POLICY_UNKNOWN,
|
|
||||||
+ CONSISTENCY_POLICY_NONE,
|
|
||||||
+ CONSISTENCY_POLICY_RESYNC,
|
|
||||||
+ CONSISTENCY_POLICY_BITMAP,
|
|
||||||
+ CONSISTENCY_POLICY_JOURNAL,
|
|
||||||
+ CONSISTENCY_POLICY_PPL,
|
|
||||||
+ } consistency_policy;
|
|
||||||
+
|
|
||||||
/* During reshape we can sometimes change the data_offset to avoid
|
|
||||||
* over-writing still-valid data. We need to know if there is space.
|
|
||||||
* So getinfo_super will fill in space_before and space_after in sectors.
|
|
||||||
@@ -426,6 +435,7 @@ enum special_options {
|
|
||||||
ClusterName,
|
|
||||||
ClusterConfirm,
|
|
||||||
WriteJournal,
|
|
||||||
+ ConsistencyPolicy,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum prefix_standard {
|
|
||||||
@@ -527,6 +537,7 @@ struct shape {
|
|
||||||
int assume_clean;
|
|
||||||
int write_behind;
|
|
||||||
unsigned long long size;
|
|
||||||
+ int consistency_policy;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* List of device names - wildcards expanded */
|
|
||||||
@@ -618,6 +629,7 @@ enum sysfs_read_flags {
|
|
||||||
GET_STATE = (1 << 23),
|
|
||||||
GET_ERROR = (1 << 24),
|
|
||||||
GET_ARRAY_STATE = (1 << 25),
|
|
||||||
+ GET_CONSISTENCY_POLICY = (1 << 26),
|
|
||||||
};
|
|
||||||
|
|
||||||
/* If fd >= 0, get the array it is open on,
|
|
||||||
@@ -701,7 +713,7 @@ extern int restore_stripes(int *dest, unsigned long long *offsets,
|
|
||||||
|
|
||||||
extern char *map_num(mapping_t *map, int num);
|
|
||||||
extern int map_name(mapping_t *map, char *name);
|
|
||||||
-extern mapping_t r5layout[], r6layout[], pers[], modes[], faultylayout[];
|
|
||||||
+extern mapping_t r5layout[], r6layout[], pers[], modes[], faultylayout[], consistency_policies[];
|
|
||||||
|
|
||||||
extern char *map_dev_preferred(int major, int minor, int create,
|
|
||||||
char *prefer);
|
|
||||||
@@ -863,7 +875,7 @@ extern struct superswitch {
|
|
||||||
* metadata.
|
|
||||||
*/
|
|
||||||
int (*init_super)(struct supertype *st, mdu_array_info_t *info,
|
|
||||||
- unsigned long long size, char *name,
|
|
||||||
+ struct shape *s, char *name,
|
|
||||||
char *homehost, int *uuid,
|
|
||||||
unsigned long long data_offset);
|
|
||||||
|
|
||||||
@@ -961,7 +973,7 @@ extern struct superswitch {
|
|
||||||
int *chunk, unsigned long long size,
|
|
||||||
unsigned long long data_offset,
|
|
||||||
char *subdev, unsigned long long *freesize,
|
|
||||||
- int verbose);
|
|
||||||
+ int consistency_policy, int verbose);
|
|
||||||
|
|
||||||
/* Return a linked list of 'mdinfo' structures for all arrays
|
|
||||||
* in the container. For non-containers, it is like
|
|
||||||
@@ -1059,6 +1071,9 @@ extern struct superswitch {
|
|
||||||
/* validate container after assemble */
|
|
||||||
int (*validate_container)(struct mdinfo *info);
|
|
||||||
|
|
||||||
+ /* write initial empty PPL on device */
|
|
||||||
+ int (*write_init_ppl)(struct supertype *st, struct mdinfo *info, int fd);
|
|
||||||
+
|
|
||||||
/* records new bad block in metadata */
|
|
||||||
int (*record_bad_block)(struct active_array *a, int n,
|
|
||||||
unsigned long long sector, int length);
|
|
||||||
diff --git a/super-ddf.c b/super-ddf.c
|
|
||||||
index 1707ad1..cdd16a4 100644
|
|
||||||
--- a/super-ddf.c
|
|
||||||
+++ b/super-ddf.c
|
|
||||||
@@ -2290,7 +2290,7 @@ static unsigned int find_vde_by_guid(const struct ddf_super *ddf,
|
|
||||||
|
|
||||||
static int init_super_ddf(struct supertype *st,
|
|
||||||
mdu_array_info_t *info,
|
|
||||||
- unsigned long long size, char *name, char *homehost,
|
|
||||||
+ struct shape *s, char *name, char *homehost,
|
|
||||||
int *uuid, unsigned long long data_offset)
|
|
||||||
{
|
|
||||||
/* This is primarily called by Create when creating a new array.
|
|
||||||
@@ -2328,7 +2328,7 @@ static int init_super_ddf(struct supertype *st,
|
|
||||||
struct virtual_disk *vd;
|
|
||||||
|
|
||||||
if (st->sb)
|
|
||||||
- return init_super_ddf_bvd(st, info, size, name, homehost, uuid,
|
|
||||||
+ return init_super_ddf_bvd(st, info, s->size, name, homehost, uuid,
|
|
||||||
data_offset);
|
|
||||||
|
|
||||||
if (posix_memalign((void**)&ddf, 512, sizeof(*ddf)) != 0) {
|
|
||||||
@@ -3347,7 +3347,7 @@ static int validate_geometry_ddf(struct supertype *st,
|
|
||||||
int *chunk, unsigned long long size,
|
|
||||||
unsigned long long data_offset,
|
|
||||||
char *dev, unsigned long long *freesize,
|
|
||||||
- int verbose)
|
|
||||||
+ int consistency_policy, int verbose)
|
|
||||||
{
|
|
||||||
int fd;
|
|
||||||
struct mdinfo *sra;
|
|
||||||
diff --git a/super-gpt.c b/super-gpt.c
|
|
||||||
index 8b080a0..bb38a97 100644
|
|
||||||
--- a/super-gpt.c
|
|
||||||
+++ b/super-gpt.c
|
|
||||||
@@ -205,7 +205,7 @@ static int validate_geometry(struct supertype *st, int level,
|
|
||||||
int *chunk, unsigned long long size,
|
|
||||||
unsigned long long data_offset,
|
|
||||||
char *subdev, unsigned long long *freesize,
|
|
||||||
- int verbose)
|
|
||||||
+ int consistency_policy, int verbose)
|
|
||||||
{
|
|
||||||
pr_err("gpt metadata cannot be used this way\n");
|
|
||||||
return 0;
|
|
||||||
diff --git a/super-intel.c b/super-intel.c
|
|
||||||
index e1618f1..5d0f131 100644
|
|
||||||
--- a/super-intel.c
|
|
||||||
+++ b/super-intel.c
|
|
||||||
@@ -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,
|
|
||||||
- unsigned long long size, char *name,
|
|
||||||
+ struct shape *s, char *name,
|
|
||||||
char *homehost, int *uuid,
|
|
||||||
long long data_offset)
|
|
||||||
{
|
|
||||||
@@ -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);
|
|
||||||
array_blocks = calc_array_size(info->level, info->raid_disks,
|
|
||||||
info->layout, info->chunk_size,
|
|
||||||
- size * 2);
|
|
||||||
+ s->size * 2);
|
|
||||||
/* round array size down to closest MB */
|
|
||||||
array_blocks = (array_blocks >> SECT_PER_MB_SHIFT) << SECT_PER_MB_SHIFT;
|
|
||||||
|
|
||||||
@@ -5264,7 +5264,7 @@ 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, size));
|
|
||||||
+ set_blocks_per_member(map, info_to_blocks_per_member(info, s->size));
|
|
||||||
map->blocks_per_strip = __cpu_to_le16(info_to_blocks_per_strip(info));
|
|
||||||
map->failed_disk_num = ~0;
|
|
||||||
if (info->level > 0)
|
|
||||||
@@ -5292,7 +5292,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 = (size * 2) / info_to_blocks_per_strip(info);
|
|
||||||
+ num_data_stripes = (s->size * 2) / info_to_blocks_per_strip(info);
|
|
||||||
num_data_stripes /= map->num_domains;
|
|
||||||
set_num_data_stripes(map, num_data_stripes);
|
|
||||||
|
|
||||||
@@ -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,
|
|
||||||
- unsigned long long size, char *name,
|
|
||||||
+ struct shape *s, char *name,
|
|
||||||
char *homehost, int *uuid,
|
|
||||||
unsigned long long data_offset)
|
|
||||||
{
|
|
||||||
@@ -5337,7 +5337,7 @@ static int init_super_imsm(struct supertype *st, mdu_array_info_t *info,
|
|
||||||
}
|
|
||||||
|
|
||||||
if (st->sb)
|
|
||||||
- return init_super_imsm_volume(st, info, size, name, homehost, uuid,
|
|
||||||
+ return init_super_imsm_volume(st, info, s, name, homehost, uuid,
|
|
||||||
data_offset);
|
|
||||||
|
|
||||||
if (info)
|
|
||||||
@@ -6914,7 +6914,7 @@ static int validate_geometry_imsm(struct supertype *st, int level, int layout,
|
|
||||||
int raiddisks, int *chunk, unsigned long long size,
|
|
||||||
unsigned long long data_offset,
|
|
||||||
char *dev, unsigned long long *freesize,
|
|
||||||
- int verbose)
|
|
||||||
+ int consistency_policy, int verbose)
|
|
||||||
{
|
|
||||||
int fd, cfd;
|
|
||||||
struct mdinfo *sra;
|
|
||||||
@@ -10953,7 +10953,7 @@ enum imsm_reshape_type imsm_analyze_change(struct supertype *st,
|
|
||||||
geo->raid_disks + devNumChange,
|
|
||||||
&chunk,
|
|
||||||
geo->size, INVALID_SECTORS,
|
|
||||||
- 0, 0, 1))
|
|
||||||
+ 0, 0, info.consistency_policy, 1))
|
|
||||||
change = -1;
|
|
||||||
|
|
||||||
if (check_devs) {
|
|
||||||
diff --git a/super-mbr.c b/super-mbr.c
|
|
||||||
index f5e4cea..1bbe57a 100644
|
|
||||||
--- a/super-mbr.c
|
|
||||||
+++ b/super-mbr.c
|
|
||||||
@@ -193,7 +193,7 @@ static int validate_geometry(struct supertype *st, int level,
|
|
||||||
int *chunk, unsigned long long size,
|
|
||||||
unsigned long long data_offset,
|
|
||||||
char *subdev, unsigned long long *freesize,
|
|
||||||
- int verbose)
|
|
||||||
+ int consistency_policy, int verbose)
|
|
||||||
{
|
|
||||||
pr_err("mbr metadata cannot be used this way\n");
|
|
||||||
return 0;
|
|
||||||
diff --git a/super0.c b/super0.c
|
|
||||||
index f5b4507..7a555e3 100644
|
|
||||||
--- a/super0.c
|
|
||||||
+++ b/super0.c
|
|
||||||
@@ -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
|
|
||||||
*/
|
|
||||||
static int init_super0(struct supertype *st, mdu_array_info_t *info,
|
|
||||||
- unsigned long long size, char *ignored_name,
|
|
||||||
+ struct shape *s, char *ignored_name,
|
|
||||||
char *homehost, int *uuid,
|
|
||||||
unsigned long long data_offset)
|
|
||||||
{
|
|
||||||
@@ -764,8 +764,8 @@ static int init_super0(struct supertype *st, mdu_array_info_t *info,
|
|
||||||
sb->gvalid_words = 0; /* ignored */
|
|
||||||
sb->ctime = time(0);
|
|
||||||
sb->level = info->level;
|
|
||||||
- sb->size = size;
|
|
||||||
- if (size != (unsigned long long)sb->size)
|
|
||||||
+ sb->size = s->size;
|
|
||||||
+ if (s->size != (unsigned long long)sb->size)
|
|
||||||
return 0;
|
|
||||||
sb->nr_disks = info->nr_disks;
|
|
||||||
sb->raid_disks = info->raid_disks;
|
|
||||||
@@ -1267,7 +1267,7 @@ static int validate_geometry0(struct supertype *st, int level,
|
|
||||||
int *chunk, unsigned long long size,
|
|
||||||
unsigned long long data_offset,
|
|
||||||
char *subdev, unsigned long long *freesize,
|
|
||||||
- int verbose)
|
|
||||||
+ int consistency_policy, int verbose)
|
|
||||||
{
|
|
||||||
unsigned long long ldsize;
|
|
||||||
int fd;
|
|
||||||
diff --git a/super1.c b/super1.c
|
|
||||||
index f3520ac..4a0f041 100644
|
|
||||||
--- a/super1.c
|
|
||||||
+++ b/super1.c
|
|
||||||
@@ -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,
|
|
||||||
- unsigned long long size, char *name, char *homehost,
|
|
||||||
+ struct shape *s, char *name, char *homehost,
|
|
||||||
int *uuid, unsigned long long data_offset)
|
|
||||||
{
|
|
||||||
struct mdp_superblock_1 *sb;
|
|
||||||
@@ -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->level = __cpu_to_le32(info->level);
|
|
||||||
sb->layout = __cpu_to_le32(info->layout);
|
|
||||||
- sb->size = __cpu_to_le64(size*2ULL);
|
|
||||||
+ sb->size = __cpu_to_le64(s->size*2ULL);
|
|
||||||
sb->chunksize = __cpu_to_le32(info->chunk_size>>9);
|
|
||||||
sb->raid_disks = __cpu_to_le32(info->raid_disks);
|
|
||||||
|
|
||||||
@@ -2487,7 +2487,7 @@ static int validate_geometry1(struct supertype *st, int level,
|
|
||||||
int *chunk, unsigned long long size,
|
|
||||||
unsigned long long data_offset,
|
|
||||||
char *subdev, unsigned long long *freesize,
|
|
||||||
- int verbose)
|
|
||||||
+ int consistency_policy, int verbose)
|
|
||||||
{
|
|
||||||
unsigned long long ldsize, devsize;
|
|
||||||
int bmspace;
|
|
||||||
diff --git a/sysfs.c b/sysfs.c
|
|
||||||
index b0657a0..53589a7 100644
|
|
||||||
--- a/sysfs.c
|
|
||||||
+++ b/sysfs.c
|
|
||||||
@@ -242,6 +242,17 @@ struct mdinfo *sysfs_read(int fd, char *devnm, unsigned long options)
|
|
||||||
} else
|
|
||||||
sra->sysfs_array_state[0] = 0;
|
|
||||||
|
|
||||||
+ if (options & GET_CONSISTENCY_POLICY) {
|
|
||||||
+ strcpy(base, "consistency_policy");
|
|
||||||
+ if (load_sys(fname, buf, sizeof(buf))) {
|
|
||||||
+ sra->consistency_policy = CONSISTENCY_POLICY_UNKNOWN;
|
|
||||||
+ } else {
|
|
||||||
+ sra->consistency_policy = map_name(consistency_policies, buf);
|
|
||||||
+ if (sra->consistency_policy == UnSet)
|
|
||||||
+ sra->consistency_policy = CONSISTENCY_POLICY_UNKNOWN;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
if (! (options & GET_DEVS))
|
|
||||||
return sra;
|
|
||||||
|
|
||||||
--
|
|
||||||
2.10.2
|
|
||||||
|
|
@ -1,332 +0,0 @@
|
|||||||
From 65884368cd42d79b567f12d3e84adc7009e12d72 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|
||||||
Date: Wed, 29 Mar 2017 11:54:16 +0200
|
|
||||||
Subject: [PATCH] Detail: show consistency policy
|
|
||||||
References: FATE#321941
|
|
||||||
|
|
||||||
Show the currently enabled consistency policy in the output from
|
|
||||||
--detail. Add 3 spaces to all existing items in Detail output to align
|
|
||||||
with "Consistency Policy : ".
|
|
||||||
|
|
||||||
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|
||||||
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
---
|
|
||||||
Detail.c | 90 +++++++++++++++++++++++++++++++++++------------------------
|
|
||||||
super-ddf.c | 6 ++--
|
|
||||||
super-intel.c | 2 +-
|
|
||||||
super0.c | 4 +--
|
|
||||||
super1.c | 9 +++---
|
|
||||||
5 files changed, 65 insertions(+), 46 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Detail.c b/Detail.c
|
|
||||||
index 3d92855..136875b 100644
|
|
||||||
--- a/Detail.c
|
|
||||||
+++ b/Detail.c
|
|
||||||
@@ -402,24 +402,25 @@ int Detail(char *dev, struct context *c)
|
|
||||||
printf("%s:\n", dev);
|
|
||||||
|
|
||||||
if (container)
|
|
||||||
- printf(" Container : %s, member %s\n", container, member);
|
|
||||||
+ printf(" Container : %s, member %s\n", container,
|
|
||||||
+ member);
|
|
||||||
else {
|
|
||||||
if (sra && sra->array.major_version < 0)
|
|
||||||
- printf(" Version : %s\n", sra->text_version);
|
|
||||||
+ printf(" Version : %s\n", sra->text_version);
|
|
||||||
else
|
|
||||||
- printf(" Version : %d.%d\n",
|
|
||||||
+ printf(" Version : %d.%d\n",
|
|
||||||
array.major_version, array.minor_version);
|
|
||||||
}
|
|
||||||
|
|
||||||
atime = array.ctime;
|
|
||||||
if (atime)
|
|
||||||
- printf(" Creation Time : %.24s\n", ctime(&atime));
|
|
||||||
+ printf(" Creation Time : %.24s\n", ctime(&atime));
|
|
||||||
if (array.raid_disks == 0 && external)
|
|
||||||
str = "container";
|
|
||||||
if (str)
|
|
||||||
- printf(" Raid Level : %s\n", str);
|
|
||||||
+ printf(" Raid Level : %s\n", str);
|
|
||||||
if (larray_size)
|
|
||||||
- printf(" Array Size : %llu%s\n", (larray_size>>10),
|
|
||||||
+ printf(" Array Size : %llu%s\n", (larray_size>>10),
|
|
||||||
human_size(larray_size));
|
|
||||||
if (array.level >= 1) {
|
|
||||||
if (sra)
|
|
||||||
@@ -428,38 +429,38 @@ int Detail(char *dev, struct context *c)
|
|
||||||
(larray_size >= 0xFFFFFFFFULL|| array.size == 0)) {
|
|
||||||
unsigned long long dsize = get_component_size(fd);
|
|
||||||
if (dsize > 0)
|
|
||||||
- printf(" Used Dev Size : %llu%s\n",
|
|
||||||
+ printf(" Used Dev Size : %llu%s\n",
|
|
||||||
dsize/2,
|
|
||||||
human_size((long long)dsize<<9));
|
|
||||||
else
|
|
||||||
- printf(" Used Dev Size : unknown\n");
|
|
||||||
+ printf(" Used Dev Size : unknown\n");
|
|
||||||
} else
|
|
||||||
- printf(" Used Dev Size : %lu%s\n",
|
|
||||||
+ printf(" Used Dev Size : %lu%s\n",
|
|
||||||
(unsigned long)array.size,
|
|
||||||
human_size((unsigned long long)array.size<<10));
|
|
||||||
}
|
|
||||||
if (array.raid_disks)
|
|
||||||
- printf(" Raid Devices : %d\n", array.raid_disks);
|
|
||||||
- printf(" Total Devices : %d\n", array.nr_disks);
|
|
||||||
+ printf(" Raid Devices : %d\n", array.raid_disks);
|
|
||||||
+ printf(" Total Devices : %d\n", array.nr_disks);
|
|
||||||
if (!container &&
|
|
||||||
((sra == NULL && array.major_version == 0) ||
|
|
||||||
(sra && sra->array.major_version == 0)))
|
|
||||||
- printf("Preferred Minor : %d\n", array.md_minor);
|
|
||||||
+ printf(" Preferred Minor : %d\n", array.md_minor);
|
|
||||||
if (sra == NULL || sra->array.major_version >= 0)
|
|
||||||
- printf(" Persistence : Superblock is %spersistent\n",
|
|
||||||
+ printf(" Persistence : Superblock is %spersistent\n",
|
|
||||||
array.not_persistent?"not ":"");
|
|
||||||
printf("\n");
|
|
||||||
/* Only try GET_BITMAP_FILE for 0.90.01 and later */
|
|
||||||
if (vers >= 9001 &&
|
|
||||||
ioctl(fd, GET_BITMAP_FILE, &bmf) == 0 &&
|
|
||||||
bmf.pathname[0]) {
|
|
||||||
- printf(" Intent Bitmap : %s\n", bmf.pathname);
|
|
||||||
+ printf(" Intent Bitmap : %s\n", bmf.pathname);
|
|
||||||
printf("\n");
|
|
||||||
} else if (array.state & (1<<MD_SB_BITMAP_PRESENT))
|
|
||||||
- printf(" Intent Bitmap : Internal\n\n");
|
|
||||||
+ printf(" Intent Bitmap : Internal\n\n");
|
|
||||||
atime = array.utime;
|
|
||||||
if (atime)
|
|
||||||
- printf(" Update Time : %.24s\n", ctime(&atime));
|
|
||||||
+ printf(" Update Time : %.24s\n", ctime(&atime));
|
|
||||||
if (array.raid_disks) {
|
|
||||||
static char *sync_action[] = {
|
|
||||||
", recovering", ", resyncing",
|
|
||||||
@@ -473,7 +474,7 @@ int Detail(char *dev, struct context *c)
|
|
||||||
else
|
|
||||||
st = ", degraded";
|
|
||||||
|
|
||||||
- printf(" State : %s%s%s%s%s%s \n",
|
|
||||||
+ printf(" State : %s%s%s%s%s%s \n",
|
|
||||||
(array.state&(1<<MD_SB_CLEAN))?"clean":"active", st,
|
|
||||||
(!e || (e->percent < 0 && e->percent != RESYNC_PENDING &&
|
|
||||||
e->percent != RESYNC_DELAYED)) ? "" : sync_action[e->resync],
|
|
||||||
@@ -481,27 +482,27 @@ int Detail(char *dev, struct context *c)
|
|
||||||
(e && e->percent == RESYNC_DELAYED) ? " (DELAYED)": "",
|
|
||||||
(e && e->percent == RESYNC_PENDING) ? " (PENDING)": "");
|
|
||||||
} else if (inactive) {
|
|
||||||
- printf(" State : inactive\n");
|
|
||||||
+ printf(" State : inactive\n");
|
|
||||||
}
|
|
||||||
if (array.raid_disks)
|
|
||||||
- printf(" Active Devices : %d\n", array.active_disks);
|
|
||||||
+ printf(" Active Devices : %d\n", array.active_disks);
|
|
||||||
if (array.working_disks > 0)
|
|
||||||
- printf("Working Devices : %d\n", array.working_disks);
|
|
||||||
+ printf(" Working Devices : %d\n", array.working_disks);
|
|
||||||
if (array.raid_disks) {
|
|
||||||
- printf(" Failed Devices : %d\n", array.failed_disks);
|
|
||||||
- printf(" Spare Devices : %d\n", array.spare_disks);
|
|
||||||
+ printf(" Failed Devices : %d\n", array.failed_disks);
|
|
||||||
+ printf(" Spare Devices : %d\n", array.spare_disks);
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
if (array.level == 5) {
|
|
||||||
str = map_num(r5layout, array.layout);
|
|
||||||
- printf(" Layout : %s\n", str?str:"-unknown-");
|
|
||||||
+ printf(" Layout : %s\n", str?str:"-unknown-");
|
|
||||||
}
|
|
||||||
if (array.level == 6) {
|
|
||||||
str = map_num(r6layout, array.layout);
|
|
||||||
- printf(" Layout : %s\n", str?str:"-unknown-");
|
|
||||||
+ printf(" Layout : %s\n", str?str:"-unknown-");
|
|
||||||
}
|
|
||||||
if (array.level == 10) {
|
|
||||||
- printf(" Layout :");
|
|
||||||
+ printf(" Layout :");
|
|
||||||
print_r10_layout(array.layout);
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
@@ -512,20 +513,35 @@ int Detail(char *dev, struct context *c)
|
|
||||||
case 10:
|
|
||||||
case 6:
|
|
||||||
if (array.chunk_size)
|
|
||||||
- printf(" Chunk Size : %dK\n\n",
|
|
||||||
+ printf(" Chunk Size : %dK\n\n",
|
|
||||||
array.chunk_size/1024);
|
|
||||||
break;
|
|
||||||
case -1:
|
|
||||||
- printf(" Rounding : %dK\n\n", array.chunk_size/1024);
|
|
||||||
+ printf(" Rounding : %dK\n\n",
|
|
||||||
+ array.chunk_size/1024);
|
|
||||||
break;
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ if (array.raid_disks) {
|
|
||||||
+ struct mdinfo *mdi = sysfs_read(fd, NULL,
|
|
||||||
+ GET_CONSISTENCY_POLICY);
|
|
||||||
+ if (mdi) {
|
|
||||||
+ char *policy = map_num(consistency_policies,
|
|
||||||
+ mdi->consistency_policy);
|
|
||||||
+ sysfs_free(mdi);
|
|
||||||
+ if (policy)
|
|
||||||
+ printf("Consistency Policy : %s\n\n",
|
|
||||||
+ policy);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
if (e && e->percent >= 0) {
|
|
||||||
static char *sync_action[] = {
|
|
||||||
"Rebuild", "Resync",
|
|
||||||
"Reshape", "Check"};
|
|
||||||
- printf(" %7s Status : %d%% complete\n", sync_action[e->resync], e->percent);
|
|
||||||
+ printf(" %7s Status : %d%% complete\n",
|
|
||||||
+ sync_action[e->resync], e->percent);
|
|
||||||
is_rebuilding = 1;
|
|
||||||
}
|
|
||||||
free_mdstat(ms);
|
|
||||||
@@ -533,39 +549,41 @@ int Detail(char *dev, struct context *c)
|
|
||||||
if ((st && st->sb) && (info && info->reshape_active)) {
|
|
||||||
#if 0
|
|
||||||
This is pretty boring
|
|
||||||
- printf(" Reshape pos'n : %llu%s\n", (unsigned long long) info->reshape_progress<<9,
|
|
||||||
+ printf(" Reshape pos'n : %llu%s\n",
|
|
||||||
+ (unsigned long long) info->reshape_progress<<9,
|
|
||||||
human_size((unsigned long long)info->reshape_progress<<9));
|
|
||||||
#endif
|
|
||||||
if (info->delta_disks != 0)
|
|
||||||
- printf(" Delta Devices : %d, (%d->%d)\n",
|
|
||||||
+ printf(" Delta Devices : %d, (%d->%d)\n",
|
|
||||||
info->delta_disks,
|
|
||||||
array.raid_disks - info->delta_disks,
|
|
||||||
array.raid_disks);
|
|
||||||
if (info->new_level != array.level) {
|
|
||||||
str = map_num(pers, info->new_level);
|
|
||||||
- printf(" New Level : %s\n", str?str:"-unknown-");
|
|
||||||
+ printf(" New Level : %s\n", str?str:"-unknown-");
|
|
||||||
}
|
|
||||||
if (info->new_level != array.level ||
|
|
||||||
info->new_layout != array.layout) {
|
|
||||||
if (info->new_level == 5) {
|
|
||||||
str = map_num(r5layout, info->new_layout);
|
|
||||||
- printf(" New Layout : %s\n",
|
|
||||||
+ printf(" New Layout : %s\n",
|
|
||||||
str?str:"-unknown-");
|
|
||||||
}
|
|
||||||
if (info->new_level == 6) {
|
|
||||||
str = map_num(r6layout, info->new_layout);
|
|
||||||
- printf(" New Layout : %s\n",
|
|
||||||
+ printf(" New Layout : %s\n",
|
|
||||||
str?str:"-unknown-");
|
|
||||||
}
|
|
||||||
if (info->new_level == 10) {
|
|
||||||
- printf(" New Layout : near=%d, %s=%d\n",
|
|
||||||
+ printf(" New Layout : near=%d, %s=%d\n",
|
|
||||||
info->new_layout&255,
|
|
||||||
(info->new_layout&0x10000)?"offset":"far",
|
|
||||||
(info->new_layout>>8)&255);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (info->new_chunk != array.chunk_size)
|
|
||||||
- printf(" New Chunksize : %dK\n", info->new_chunk/1024);
|
|
||||||
+ printf(" New Chunksize : %dK\n",
|
|
||||||
+ info->new_chunk/1024);
|
|
||||||
printf("\n");
|
|
||||||
} else if (e && e->percent >= 0)
|
|
||||||
printf("\n");
|
|
||||||
@@ -580,7 +598,7 @@ This is pretty boring
|
|
||||||
DIR *dir = opendir("/sys/block");
|
|
||||||
struct dirent *de;
|
|
||||||
|
|
||||||
- printf(" Member Arrays :");
|
|
||||||
+ printf(" Member Arrays :");
|
|
||||||
|
|
||||||
while (dir && (de = readdir(dir)) != NULL) {
|
|
||||||
char path[287];
|
|
||||||
diff --git a/super-ddf.c b/super-ddf.c
|
|
||||||
index cdd16a4..c6037c1 100644
|
|
||||||
--- a/super-ddf.c
|
|
||||||
+++ b/super-ddf.c
|
|
||||||
@@ -1742,10 +1742,10 @@ static void detail_super_ddf(struct supertype *st, char *homehost)
|
|
||||||
struct ddf_super *sb = st->sb;
|
|
||||||
int cnt = be16_to_cpu(sb->virt->populated_vdes);
|
|
||||||
|
|
||||||
- printf(" Container GUID : "); print_guid(sb->anchor.guid, 1);
|
|
||||||
+ printf(" Container GUID : "); print_guid(sb->anchor.guid, 1);
|
|
||||||
printf("\n");
|
|
||||||
- printf(" Seq : %08x\n", be32_to_cpu(sb->active->seq));
|
|
||||||
- printf(" Virtual Disks : %d\n", cnt);
|
|
||||||
+ printf(" Seq : %08x\n", be32_to_cpu(sb->active->seq));
|
|
||||||
+ printf(" Virtual Disks : %d\n", cnt);
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
diff --git a/super-intel.c b/super-intel.c
|
|
||||||
index 5d0f131..2d92c8e 100644
|
|
||||||
--- a/super-intel.c
|
|
||||||
+++ b/super-intel.c
|
|
||||||
@@ -1987,7 +1987,7 @@ static void detail_super_imsm(struct supertype *st, char *homehost)
|
|
||||||
|
|
||||||
getinfo_super_imsm(st, &info, NULL);
|
|
||||||
fname_from_uuid(st, &info, nbuf, ':');
|
|
||||||
- printf("\n UUID : %s\n", nbuf + 5);
|
|
||||||
+ printf("\n UUID : %s\n", nbuf + 5);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void brief_detail_super_imsm(struct supertype *st)
|
|
||||||
diff --git a/super0.c b/super0.c
|
|
||||||
index 7a555e3..10d9c40 100644
|
|
||||||
--- a/super0.c
|
|
||||||
+++ b/super0.c
|
|
||||||
@@ -353,7 +353,7 @@ err:
|
|
||||||
static void detail_super0(struct supertype *st, char *homehost)
|
|
||||||
{
|
|
||||||
mdp_super_t *sb = st->sb;
|
|
||||||
- printf(" UUID : ");
|
|
||||||
+ printf(" UUID : ");
|
|
||||||
if (sb->minor_version >= 90)
|
|
||||||
printf("%08x:%08x:%08x:%08x", sb->set_uuid0, sb->set_uuid1,
|
|
||||||
sb->set_uuid2, sb->set_uuid3);
|
|
||||||
@@ -367,7 +367,7 @@ static void detail_super0(struct supertype *st, char *homehost)
|
|
||||||
if (memcmp(&sb->set_uuid2, hash, 8)==0)
|
|
||||||
printf(" (local to host %s)", homehost);
|
|
||||||
}
|
|
||||||
- printf("\n Events : %d.%d\n\n", sb->events_hi, sb->events_lo);
|
|
||||||
+ printf("\n Events : %d.%d\n\n", sb->events_hi, sb->events_lo);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void brief_detail_super0(struct supertype *st)
|
|
||||||
diff --git a/super1.c b/super1.c
|
|
||||||
index 4a0f041..8df17a1 100644
|
|
||||||
--- a/super1.c
|
|
||||||
+++ b/super1.c
|
|
||||||
@@ -780,19 +780,20 @@ static void detail_super1(struct supertype *st, char *homehost)
|
|
||||||
int i;
|
|
||||||
int l = homehost ? strlen(homehost) : 0;
|
|
||||||
|
|
||||||
- printf(" Name : %.32s", sb->set_name);
|
|
||||||
+ printf(" Name : %.32s", sb->set_name);
|
|
||||||
if (l > 0 && l < 32 &&
|
|
||||||
sb->set_name[l] == ':' &&
|
|
||||||
strncmp(sb->set_name, homehost, l) == 0)
|
|
||||||
printf(" (local to host %s)", homehost);
|
|
||||||
if (bms->nodes > 0 && (__le32_to_cpu(sb->feature_map) & MD_FEATURE_BITMAP_OFFSET))
|
|
||||||
- printf("\n Cluster Name : %-64s", bms->cluster_name);
|
|
||||||
- printf("\n UUID : ");
|
|
||||||
+ printf("\n Cluster Name : %-64s", bms->cluster_name);
|
|
||||||
+ printf("\n UUID : ");
|
|
||||||
for (i=0; i<16; i++) {
|
|
||||||
if ((i&3)==0 && i != 0) printf(":");
|
|
||||||
printf("%02x", sb->set_uuid[i]);
|
|
||||||
}
|
|
||||||
- printf("\n Events : %llu\n\n", (unsigned long long)__le64_to_cpu(sb->events));
|
|
||||||
+ printf("\n Events : %llu\n\n",
|
|
||||||
+ (unsigned long long)__le64_to_cpu(sb->events));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void brief_detail_super1(struct supertype *st)
|
|
||||||
--
|
|
||||||
2.10.2
|
|
||||||
|
|
@ -1,649 +0,0 @@
|
|||||||
From 2432ce9b3235f34d00ef6c28ef6b624a32b85530 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|
||||||
Date: Wed, 29 Mar 2017 11:54:17 +0200
|
|
||||||
Subject: [PATCH] imsm: PPL support
|
|
||||||
References: FATE#321941
|
|
||||||
|
|
||||||
|
|
||||||
Enable creating and assembling IMSM raid5 arrays with PPL. Update the
|
|
||||||
IMSM metadata format to include new fields used for PPL.
|
|
||||||
|
|
||||||
Add structures for PPL metadata. They are used also by super1 and shared
|
|
||||||
with the kernel, so put them in md_p.h.
|
|
||||||
|
|
||||||
Write the initial empty PPL header when creating an array. When
|
|
||||||
assembling an array with PPL, validate the PPL header and in case it is
|
|
||||||
not correct allow to overwrite it if --force was provided.
|
|
||||||
|
|
||||||
Write the PPL location and size for a device to the new rdev sysfs
|
|
||||||
attributes 'ppl_sector' and 'ppl_size'. Enable PPL in the kernel by
|
|
||||||
writing to 'consistency_policy' before the array is activated.
|
|
||||||
|
|
||||||
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|
||||||
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
---
|
|
||||||
Assemble.c | 49 +++++++++++
|
|
||||||
Makefile | 5 +-
|
|
||||||
md_p.h | 25 ++++++
|
|
||||||
mdadm.h | 6 ++
|
|
||||||
super-intel.c | 274 +++++++++++++++++++++++++++++++++++++++++++++++++++++-----
|
|
||||||
sysfs.c | 14 +++
|
|
||||||
6 files changed, 349 insertions(+), 24 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Assemble.c b/Assemble.c
|
|
||||||
index 3da0903..8e55b49 100644
|
|
||||||
--- a/Assemble.c
|
|
||||||
+++ b/Assemble.c
|
|
||||||
@@ -1942,6 +1942,55 @@ int assemble_container_content(struct supertype *st, int mdfd,
|
|
||||||
map_update(NULL, fd2devnm(mdfd), content->text_version,
|
|
||||||
content->uuid, chosen_name);
|
|
||||||
|
|
||||||
+ if (content->consistency_policy == CONSISTENCY_POLICY_PPL &&
|
|
||||||
+ st->ss->validate_ppl) {
|
|
||||||
+ content->array.state |= 1;
|
|
||||||
+ err = 0;
|
|
||||||
+
|
|
||||||
+ for (dev = content->devs; dev; dev = dev->next) {
|
|
||||||
+ int dfd;
|
|
||||||
+ char *devpath;
|
|
||||||
+ int ret;
|
|
||||||
+
|
|
||||||
+ ret = st->ss->validate_ppl(st, content, dev);
|
|
||||||
+ if (ret == 0)
|
|
||||||
+ continue;
|
|
||||||
+
|
|
||||||
+ if (ret < 0) {
|
|
||||||
+ err = 1;
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (!c->force) {
|
|
||||||
+ pr_err("%s contains invalid PPL - consider --force or --update-subarray with --update=no-ppl\n",
|
|
||||||
+ chosen_name);
|
|
||||||
+ content->array.state &= ~1;
|
|
||||||
+ avail[dev->disk.raid_disk] = 0;
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /* have --force - overwrite the invalid ppl */
|
|
||||||
+ devpath = map_dev(dev->disk.major, dev->disk.minor, 0);
|
|
||||||
+ dfd = dev_open(devpath, O_RDWR);
|
|
||||||
+ if (dfd < 0) {
|
|
||||||
+ pr_err("Failed to open %s\n", devpath);
|
|
||||||
+ err = 1;
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ err = st->ss->write_init_ppl(st, content, dfd);
|
|
||||||
+ close(dfd);
|
|
||||||
+
|
|
||||||
+ if (err)
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (err) {
|
|
||||||
+ free(avail);
|
|
||||||
+ return err;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
if (enough(content->array.level, content->array.raid_disks,
|
|
||||||
content->array.layout, content->array.state & 1, avail) == 0) {
|
|
||||||
if (c->export && result)
|
|
||||||
diff --git a/Makefile b/Makefile
|
|
||||||
index d1a6ac4..5ff6cc0 100644
|
|
||||||
--- a/Makefile
|
|
||||||
+++ b/Makefile
|
|
||||||
@@ -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 \
|
|
||||||
super-mbr.o super-gpt.o \
|
|
||||||
super-ddf.o sha1.o crc32.o msg.o bitmap.o xmalloc.o \
|
|
||||||
- platform-intel.o probe_roms.o
|
|
||||||
+ platform-intel.o probe_roms.o crc32c.o
|
|
||||||
|
|
||||||
MON_SRCS = $(patsubst %.o,%.c,$(MON_OBJS))
|
|
||||||
|
|
||||||
@@ -161,7 +161,8 @@ STATICOBJS = pwgr.o
|
|
||||||
ASSEMBLE_SRCS := mdassemble.c Assemble.c Manage.c config.c policy.c dlink.c util.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 \
|
|
||||||
- platform-intel.c probe_roms.c sysfs.c super-mbr.c super-gpt.c mapfile.c
|
|
||||||
+ platform-intel.c probe_roms.c sysfs.c super-mbr.c super-gpt.c mapfile.c \
|
|
||||||
+ crc32c.c
|
|
||||||
ASSEMBLE_AUTO_SRCS := mdopen.c
|
|
||||||
ASSEMBLE_FLAGS:= $(CFLAGS) -DMDASSEMBLE
|
|
||||||
ifdef MDASSEMBLE_AUTO
|
|
||||||
diff --git a/md_p.h b/md_p.h
|
|
||||||
index dc9fec1..358a28c 100644
|
|
||||||
--- a/md_p.h
|
|
||||||
+++ b/md_p.h
|
|
||||||
@@ -267,4 +267,29 @@ struct r5l_meta_block {
|
|
||||||
#define R5LOG_VERSION 0x1
|
|
||||||
#define R5LOG_MAGIC 0x6433c509
|
|
||||||
|
|
||||||
+struct ppl_header_entry {
|
|
||||||
+ __u64 data_sector; /* raid sector of the new data */
|
|
||||||
+ __u32 pp_size; /* length of partial parity */
|
|
||||||
+ __u32 data_size; /* length of data */
|
|
||||||
+ __u32 parity_disk; /* member disk containing parity */
|
|
||||||
+ __u32 checksum; /* checksum of this entry's partial parity */
|
|
||||||
+} __attribute__ ((__packed__));
|
|
||||||
+
|
|
||||||
+#define PPL_HEADER_SIZE 4096
|
|
||||||
+#define PPL_HDR_RESERVED 512
|
|
||||||
+#define PPL_HDR_ENTRY_SPACE \
|
|
||||||
+ (PPL_HEADER_SIZE - PPL_HDR_RESERVED - 4 * sizeof(__u32) - sizeof(__u64))
|
|
||||||
+#define PPL_HDR_MAX_ENTRIES \
|
|
||||||
+ (PPL_HDR_ENTRY_SPACE / sizeof(struct ppl_header_entry))
|
|
||||||
+
|
|
||||||
+struct ppl_header {
|
|
||||||
+ __u8 reserved[PPL_HDR_RESERVED];/* reserved space, fill with 0xff */
|
|
||||||
+ __u32 signature; /* signature (family number of volume) */
|
|
||||||
+ __u32 padding; /* zero pad */
|
|
||||||
+ __u64 generation; /* generation number of the header */
|
|
||||||
+ __u32 entries_count; /* number of entries in entry array */
|
|
||||||
+ __u32 checksum; /* checksum of the header */
|
|
||||||
+ struct ppl_header_entry entries[PPL_HDR_MAX_ENTRIES];
|
|
||||||
+} __attribute__ ((__packed__));
|
|
||||||
+
|
|
||||||
#endif
|
|
||||||
diff --git a/mdadm.h b/mdadm.h
|
|
||||||
index b52d4d3..d222cc3 100644
|
|
||||||
--- a/mdadm.h
|
|
||||||
+++ b/mdadm.h
|
|
||||||
@@ -300,6 +300,8 @@ struct mdinfo {
|
|
||||||
#define MaxSector (~0ULL) /* resync/recovery complete position */
|
|
||||||
};
|
|
||||||
long bitmap_offset; /* 0 == none, 1 == a file */
|
|
||||||
+ unsigned int ppl_size;
|
|
||||||
+ 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;
|
|
||||||
@@ -1074,6 +1076,10 @@ extern struct superswitch {
|
|
||||||
/* write initial empty PPL on device */
|
|
||||||
int (*write_init_ppl)(struct supertype *st, struct mdinfo *info, int fd);
|
|
||||||
|
|
||||||
+ /* validate ppl before assemble */
|
|
||||||
+ int (*validate_ppl)(struct supertype *st, struct mdinfo *info,
|
|
||||||
+ struct mdinfo *disk);
|
|
||||||
+
|
|
||||||
/* records new bad block in metadata */
|
|
||||||
int (*record_bad_block)(struct active_array *a, int n,
|
|
||||||
unsigned long long sector, int length);
|
|
||||||
diff --git a/super-intel.c b/super-intel.c
|
|
||||||
index 2d92c8e..87fec8b 100644
|
|
||||||
--- a/super-intel.c
|
|
||||||
+++ b/super-intel.c
|
|
||||||
@@ -102,6 +102,7 @@ struct imsm_disk {
|
|
||||||
#define SPARE_DISK __cpu_to_le32(0x01) /* Spare */
|
|
||||||
#define CONFIGURED_DISK __cpu_to_le32(0x02) /* Member of some RaidDev */
|
|
||||||
#define FAILED_DISK __cpu_to_le32(0x04) /* Permanent failure */
|
|
||||||
+#define JOURNAL_DISK __cpu_to_le32(0x2000000) /* Device marked as Journaling Drive */
|
|
||||||
__u32 status; /* 0xF0 - 0xF3 */
|
|
||||||
__u32 owner_cfg_num; /* which config 0,1,2... owns this disk */
|
|
||||||
__u32 total_blocks_hi; /* 0xF4 - 0xF5 total blocks hi */
|
|
||||||
@@ -155,6 +156,9 @@ struct imsm_vol {
|
|
||||||
#define MIGR_STATE_CHANGE 4
|
|
||||||
#define MIGR_REPAIR 5
|
|
||||||
__u8 migr_type; /* Initializing, Rebuilding, ... */
|
|
||||||
+#define RAIDVOL_CLEAN 0
|
|
||||||
+#define RAIDVOL_DIRTY 1
|
|
||||||
+#define RAIDVOL_DSRECORD_VALID 2
|
|
||||||
__u8 dirty;
|
|
||||||
__u8 fs_state; /* fast-sync state for CnG (0xff == disabled) */
|
|
||||||
__u16 verify_errors; /* number of mismatches */
|
|
||||||
@@ -190,7 +194,24 @@ struct imsm_dev {
|
|
||||||
__u16 cache_policy;
|
|
||||||
__u8 cng_state;
|
|
||||||
__u8 cng_sub_state;
|
|
||||||
-#define IMSM_DEV_FILLERS 10
|
|
||||||
+ __u16 my_vol_raid_dev_num; /* Used in Unique volume Id for this RaidDev */
|
|
||||||
+
|
|
||||||
+ /* NVM_EN */
|
|
||||||
+ __u8 nv_cache_mode;
|
|
||||||
+ __u8 nv_cache_flags;
|
|
||||||
+
|
|
||||||
+ /* Unique Volume Id of the NvCache Volume associated with this volume */
|
|
||||||
+ __u32 nvc_vol_orig_family_num;
|
|
||||||
+ __u16 nvc_vol_raid_dev_num;
|
|
||||||
+
|
|
||||||
+#define RWH_OFF 0
|
|
||||||
+#define RWH_DISTRIBUTED 1
|
|
||||||
+#define RWH_JOURNALING_DRIVE 2
|
|
||||||
+ __u8 rwh_policy; /* Raid Write Hole Policy */
|
|
||||||
+ __u8 jd_serial[MAX_RAID_SERIAL_LEN]; /* Journal Drive serial number */
|
|
||||||
+ __u8 filler1;
|
|
||||||
+
|
|
||||||
+#define IMSM_DEV_FILLERS 3
|
|
||||||
__u32 filler[IMSM_DEV_FILLERS];
|
|
||||||
struct imsm_vol vol;
|
|
||||||
} __attribute__ ((packed));
|
|
||||||
@@ -257,6 +278,9 @@ static char *map_state_str[] = { "normal", "uninitialized", "degraded", "failed"
|
|
||||||
#define UNIT_SRC_IN_CP_AREA 1 /* Source data for curr_migr_unit has
|
|
||||||
* already been migrated and must
|
|
||||||
* be recovered from checkpoint area */
|
|
||||||
+
|
|
||||||
+#define PPL_ENTRY_SPACE (128 * 1024) /* Size of the PPL, without the header */
|
|
||||||
+
|
|
||||||
struct migr_record {
|
|
||||||
__u32 rec_status; /* Status used to determine how to restart
|
|
||||||
* migration in case it aborts
|
|
||||||
@@ -1288,6 +1312,11 @@ static int is_failed(struct imsm_disk *disk)
|
|
||||||
return (disk->status & FAILED_DISK) == FAILED_DISK;
|
|
||||||
}
|
|
||||||
|
|
||||||
+static int is_journal(struct imsm_disk *disk)
|
|
||||||
+{
|
|
||||||
+ return (disk->status & JOURNAL_DISK) == JOURNAL_DISK;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
/* 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
|
|
||||||
@@ -1477,7 +1506,17 @@ static void print_imsm_dev(struct intel_super *super,
|
|
||||||
blocks_per_migr_unit(super, dev));
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
- printf(" Dirty State : %s\n", dev->vol.dirty ? "dirty" : "clean");
|
|
||||||
+ printf(" Dirty State : %s\n", (dev->vol.dirty & RAIDVOL_DIRTY) ?
|
|
||||||
+ "dirty" : "clean");
|
|
||||||
+ printf(" RWH Policy : ");
|
|
||||||
+ if (dev->rwh_policy == RWH_OFF)
|
|
||||||
+ printf("off\n");
|
|
||||||
+ else if (dev->rwh_policy == RWH_DISTRIBUTED)
|
|
||||||
+ printf("PPL distributed\n");
|
|
||||||
+ else if (dev->rwh_policy == RWH_JOURNALING_DRIVE)
|
|
||||||
+ printf("PPL journaling drive\n");
|
|
||||||
+ else
|
|
||||||
+ printf("<unknown:%d>\n", dev->rwh_policy);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void print_imsm_disk(struct imsm_disk *disk,
|
|
||||||
@@ -1496,9 +1535,10 @@ static void print_imsm_disk(struct imsm_disk *disk,
|
|
||||||
printf(" Disk%02d Serial : %s\n", index, str);
|
|
||||||
else
|
|
||||||
printf(" Disk Serial : %s\n", str);
|
|
||||||
- printf(" State :%s%s%s\n", is_spare(disk) ? " spare" : "",
|
|
||||||
- is_configured(disk) ? " active" : "",
|
|
||||||
- is_failed(disk) ? " failed" : "");
|
|
||||||
+ printf(" State :%s%s%s%s\n", is_spare(disk) ? " spare" : "",
|
|
||||||
+ is_configured(disk) ? " active" : "",
|
|
||||||
+ is_failed(disk) ? " failed" : "",
|
|
||||||
+ is_journal(disk) ? " journal" : "");
|
|
||||||
printf(" Id : %08x\n", __le32_to_cpu(disk->scsi_id));
|
|
||||||
sz = total_blocks(disk) - reserved;
|
|
||||||
printf(" Usable Size : %llu%s\n",
|
|
||||||
@@ -3114,6 +3154,15 @@ static unsigned long long imsm_component_size_aligment_check(int level,
|
|
||||||
return component_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
+static unsigned long long get_ppl_sector(struct intel_super *super, int dev_idx)
|
|
||||||
+{
|
|
||||||
+ struct imsm_dev *dev = get_imsm_dev(super, dev_idx);
|
|
||||||
+ struct imsm_map *map = get_imsm_map(dev, MAP_0);
|
|
||||||
+
|
|
||||||
+ return pba_of_lba0(map) +
|
|
||||||
+ (num_data_stripes(map) * map->blocks_per_strip);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info, char *dmap)
|
|
||||||
{
|
|
||||||
struct intel_super *super = st->sb;
|
|
||||||
@@ -3140,7 +3189,7 @@ static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info,
|
|
||||||
info->array.utime = 0;
|
|
||||||
info->array.chunk_size =
|
|
||||||
__le16_to_cpu(map_to_analyse->blocks_per_strip) << 9;
|
|
||||||
- info->array.state = !dev->vol.dirty;
|
|
||||||
+ info->array.state = !(dev->vol.dirty & RAIDVOL_DIRTY);
|
|
||||||
info->custom_array_size = __le32_to_cpu(dev->size_high);
|
|
||||||
info->custom_array_size <<= 32;
|
|
||||||
info->custom_array_size |= __le32_to_cpu(dev->size_low);
|
|
||||||
@@ -3221,10 +3270,20 @@ static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info,
|
|
||||||
memset(info->uuid, 0, sizeof(info->uuid));
|
|
||||||
info->recovery_start = MaxSector;
|
|
||||||
|
|
||||||
+ if (info->array.level == 5 && dev->rwh_policy == RWH_DISTRIBUTED) {
|
|
||||||
+ info->consistency_policy = CONSISTENCY_POLICY_PPL;
|
|
||||||
+ info->ppl_sector = get_ppl_sector(super, super->current_vol);
|
|
||||||
+ info->ppl_size = (PPL_HEADER_SIZE + PPL_ENTRY_SPACE) >> 9;
|
|
||||||
+ } else if (info->array.level <= 0) {
|
|
||||||
+ info->consistency_policy = CONSISTENCY_POLICY_NONE;
|
|
||||||
+ } else {
|
|
||||||
+ info->consistency_policy = CONSISTENCY_POLICY_RESYNC;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
info->reshape_progress = 0;
|
|
||||||
info->resync_start = MaxSector;
|
|
||||||
if ((map_to_analyse->map_state == IMSM_T_STATE_UNINITIALIZED ||
|
|
||||||
- dev->vol.dirty) &&
|
|
||||||
+ !(info->array.state & 1)) &&
|
|
||||||
imsm_reshape_blocks_arrays_changes(super) == 0) {
|
|
||||||
info->resync_start = 0;
|
|
||||||
}
|
|
||||||
@@ -3451,7 +3510,8 @@ static void getinfo_super_imsm(struct supertype *st, struct mdinfo *info, char *
|
|
||||||
* found the 'most fresh' version of the metadata
|
|
||||||
*/
|
|
||||||
info->disk.state |= is_failed(disk) ? (1 << MD_DISK_FAULTY) : 0;
|
|
||||||
- info->disk.state |= is_spare(disk) ? 0 : (1 << MD_DISK_SYNC);
|
|
||||||
+ info->disk.state |= (is_spare(disk) || is_journal(disk)) ?
|
|
||||||
+ 0 : (1 << MD_DISK_SYNC);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* only call uuid_from_super_imsm when this disk is part of a populated container,
|
|
||||||
@@ -3906,7 +3966,7 @@ load_imsm_disk(int fd, struct intel_super *super, char *devname, int keep_fd)
|
|
||||||
*/
|
|
||||||
if (is_failed(&dl->disk))
|
|
||||||
dl->index = -2;
|
|
||||||
- else if (is_spare(&dl->disk))
|
|
||||||
+ else if (is_spare(&dl->disk) || is_journal(&dl->disk))
|
|
||||||
dl->index = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -5303,6 +5363,20 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info,
|
|
||||||
}
|
|
||||||
mpb->num_raid_devs++;
|
|
||||||
|
|
||||||
+ if (s->consistency_policy == UnSet ||
|
|
||||||
+ s->consistency_policy == CONSISTENCY_POLICY_RESYNC ||
|
|
||||||
+ s->consistency_policy == CONSISTENCY_POLICY_NONE) {
|
|
||||||
+ dev->rwh_policy = RWH_OFF;
|
|
||||||
+ } else if (s->consistency_policy == CONSISTENCY_POLICY_PPL) {
|
|
||||||
+ dev->rwh_policy = RWH_DISTRIBUTED;
|
|
||||||
+ } else {
|
|
||||||
+ free(dev);
|
|
||||||
+ free(dv);
|
|
||||||
+ pr_err("imsm does not support consistency policy %s\n",
|
|
||||||
+ map_num(consistency_policies, s->consistency_policy));
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
dv->dev = dev;
|
|
||||||
dv->index = super->current_vol;
|
|
||||||
dv->next = super->devlist;
|
|
||||||
@@ -5927,11 +6001,146 @@ static int mgmt_disk(struct supertype *st)
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
+__u32 crc32c_le(__u32 crc, unsigned char const *p, size_t len);
|
|
||||||
+
|
|
||||||
+static int write_init_ppl_imsm(struct supertype *st, struct mdinfo *info, int fd)
|
|
||||||
+{
|
|
||||||
+ struct intel_super *super = st->sb;
|
|
||||||
+ void *buf;
|
|
||||||
+ struct ppl_header *ppl_hdr;
|
|
||||||
+ int ret;
|
|
||||||
+
|
|
||||||
+ ret = posix_memalign(&buf, 4096, PPL_HEADER_SIZE);
|
|
||||||
+ if (ret) {
|
|
||||||
+ pr_err("Failed to allocate PPL header buffer\n");
|
|
||||||
+ return ret;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ memset(buf, 0, PPL_HEADER_SIZE);
|
|
||||||
+ ppl_hdr = buf;
|
|
||||||
+ memset(ppl_hdr->reserved, 0xff, PPL_HDR_RESERVED);
|
|
||||||
+ ppl_hdr->signature = __cpu_to_le32(super->anchor->orig_family_num);
|
|
||||||
+ ppl_hdr->checksum = __cpu_to_le32(~crc32c_le(~0, buf, PPL_HEADER_SIZE));
|
|
||||||
+
|
|
||||||
+ if (lseek64(fd, info->ppl_sector * 512, SEEK_SET) < 0) {
|
|
||||||
+ ret = errno;
|
|
||||||
+ perror("Failed to seek to PPL header location");
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (!ret && write(fd, buf, PPL_HEADER_SIZE) != PPL_HEADER_SIZE) {
|
|
||||||
+ ret = errno;
|
|
||||||
+ perror("Write PPL header failed");
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (!ret)
|
|
||||||
+ fsync(fd);
|
|
||||||
+
|
|
||||||
+ free(buf);
|
|
||||||
+ return ret;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int validate_ppl_imsm(struct supertype *st, struct mdinfo *info,
|
|
||||||
+ struct mdinfo *disk)
|
|
||||||
+{
|
|
||||||
+ struct intel_super *super = st->sb;
|
|
||||||
+ struct dl *d;
|
|
||||||
+ void *buf;
|
|
||||||
+ int ret = 0;
|
|
||||||
+ struct ppl_header *ppl_hdr;
|
|
||||||
+ __u32 crc;
|
|
||||||
+ struct imsm_dev *dev;
|
|
||||||
+ struct imsm_map *map;
|
|
||||||
+ __u32 idx;
|
|
||||||
+
|
|
||||||
+ if (disk->disk.raid_disk < 0)
|
|
||||||
+ return 0;
|
|
||||||
+
|
|
||||||
+ if (posix_memalign(&buf, 4096, PPL_HEADER_SIZE)) {
|
|
||||||
+ pr_err("Failed to allocate PPL header buffer\n");
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ dev = get_imsm_dev(super, info->container_member);
|
|
||||||
+ map = get_imsm_map(dev, MAP_X);
|
|
||||||
+ idx = get_imsm_disk_idx(dev, disk->disk.raid_disk, MAP_X);
|
|
||||||
+ d = get_imsm_dl_disk(super, idx);
|
|
||||||
+
|
|
||||||
+ if (!d || d->index < 0 || is_failed(&d->disk))
|
|
||||||
+ goto out;
|
|
||||||
+
|
|
||||||
+ if (lseek64(d->fd, info->ppl_sector * 512, SEEK_SET) < 0) {
|
|
||||||
+ perror("Failed to seek to PPL header location");
|
|
||||||
+ ret = -1;
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (read(d->fd, buf, PPL_HEADER_SIZE) != PPL_HEADER_SIZE) {
|
|
||||||
+ perror("Read PPL header failed");
|
|
||||||
+ ret = -1;
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ ppl_hdr = buf;
|
|
||||||
+
|
|
||||||
+ crc = __le32_to_cpu(ppl_hdr->checksum);
|
|
||||||
+ ppl_hdr->checksum = 0;
|
|
||||||
+
|
|
||||||
+ if (crc != ~crc32c_le(~0, buf, PPL_HEADER_SIZE)) {
|
|
||||||
+ dprintf("Wrong PPL header checksum on %s\n",
|
|
||||||
+ d->devname);
|
|
||||||
+ ret = 1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (!ret && (__le32_to_cpu(ppl_hdr->signature) !=
|
|
||||||
+ super->anchor->orig_family_num)) {
|
|
||||||
+ dprintf("Wrong PPL header signature on %s\n",
|
|
||||||
+ d->devname);
|
|
||||||
+ ret = 1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+out:
|
|
||||||
+ free(buf);
|
|
||||||
+
|
|
||||||
+ if (ret == 1 && map->map_state == IMSM_T_STATE_UNINITIALIZED)
|
|
||||||
+ return st->ss->write_init_ppl(st, info, d->fd);
|
|
||||||
+
|
|
||||||
+ return ret;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+#ifndef MDASSEMBLE
|
|
||||||
+
|
|
||||||
+static int write_init_ppl_imsm_all(struct supertype *st, struct mdinfo *info)
|
|
||||||
+{
|
|
||||||
+ struct intel_super *super = st->sb;
|
|
||||||
+ struct dl *d;
|
|
||||||
+ int ret = 0;
|
|
||||||
+
|
|
||||||
+ if (info->consistency_policy != CONSISTENCY_POLICY_PPL ||
|
|
||||||
+ info->array.level != 5)
|
|
||||||
+ return 0;
|
|
||||||
+
|
|
||||||
+ for (d = super->disks; d ; d = d->next) {
|
|
||||||
+ if (d->index < 0 || is_failed(&d->disk))
|
|
||||||
+ continue;
|
|
||||||
+
|
|
||||||
+ ret = st->ss->write_init_ppl(st, info, d->fd);
|
|
||||||
+ if (ret)
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return ret;
|
|
||||||
+}
|
|
||||||
|
|
||||||
static int write_init_super_imsm(struct supertype *st)
|
|
||||||
{
|
|
||||||
struct intel_super *super = st->sb;
|
|
||||||
int current_vol = super->current_vol;
|
|
||||||
+ int rv = 0;
|
|
||||||
+ struct mdinfo info;
|
|
||||||
+
|
|
||||||
+ getinfo_super_imsm(st, &info, NULL);
|
|
||||||
|
|
||||||
/* we are done with current_vol reset it to point st at the container */
|
|
||||||
super->current_vol = -1;
|
|
||||||
@@ -5939,24 +6148,29 @@ static int write_init_super_imsm(struct supertype *st)
|
|
||||||
if (st->update_tail) {
|
|
||||||
/* queue the recently created array / added disk
|
|
||||||
* as a metadata update */
|
|
||||||
- int rv;
|
|
||||||
|
|
||||||
/* determine if we are creating a volume or adding a disk */
|
|
||||||
if (current_vol < 0) {
|
|
||||||
/* in the mgmt (add/remove) disk case we are running
|
|
||||||
* in mdmon context, so don't close fd's
|
|
||||||
*/
|
|
||||||
- return mgmt_disk(st);
|
|
||||||
- } else
|
|
||||||
- rv = create_array(st, current_vol);
|
|
||||||
-
|
|
||||||
- return rv;
|
|
||||||
+ rv = mgmt_disk(st);
|
|
||||||
+ } else {
|
|
||||||
+ rv = write_init_ppl_imsm_all(st, &info);
|
|
||||||
+ if (!rv)
|
|
||||||
+ rv = create_array(st, current_vol);
|
|
||||||
+ }
|
|
||||||
} else {
|
|
||||||
struct dl *d;
|
|
||||||
for (d = super->disks; d; d = d->next)
|
|
||||||
Kill(d->devname, NULL, 0, -1, 1);
|
|
||||||
- return write_super_imsm(st, 1);
|
|
||||||
+ if (current_vol >= 0)
|
|
||||||
+ rv = write_init_ppl_imsm_all(st, &info);
|
|
||||||
+ if (!rv)
|
|
||||||
+ rv = write_super_imsm(st, 1);
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ return rv;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
@@ -7375,7 +7589,8 @@ static struct mdinfo *container_content_imsm(struct supertype *st, char *subarra
|
|
||||||
*
|
|
||||||
* FIXME handle dirty degraded
|
|
||||||
*/
|
|
||||||
- if ((skip || recovery_start == 0) && !dev->vol.dirty)
|
|
||||||
+ if ((skip || recovery_start == 0) &&
|
|
||||||
+ !(dev->vol.dirty & RAIDVOL_DIRTY))
|
|
||||||
this->resync_start = MaxSector;
|
|
||||||
if (skip)
|
|
||||||
continue;
|
|
||||||
@@ -7410,9 +7625,12 @@ static struct mdinfo *container_content_imsm(struct supertype *st, char *subarra
|
|
||||||
info_d->component_size =
|
|
||||||
num_data_stripes(map) *
|
|
||||||
map->blocks_per_strip;
|
|
||||||
+ info_d->ppl_sector = this->ppl_sector;
|
|
||||||
+ info_d->ppl_size = this->ppl_size;
|
|
||||||
} else {
|
|
||||||
info_d->component_size = blocks_per_member(map);
|
|
||||||
}
|
|
||||||
+ info_d->consistency_policy = this->consistency_policy;
|
|
||||||
|
|
||||||
info_d->bb.supported = 1;
|
|
||||||
get_volume_badblocks(super->bbm_log, ord_to_idx(ord),
|
|
||||||
@@ -7928,12 +8146,16 @@ mark_checkpoint:
|
|
||||||
|
|
||||||
skip_mark_checkpoint:
|
|
||||||
/* mark dirty / clean */
|
|
||||||
- if (dev->vol.dirty != !consistent) {
|
|
||||||
+ if (((dev->vol.dirty & RAIDVOL_DIRTY) && consistent) ||
|
|
||||||
+ (!(dev->vol.dirty & RAIDVOL_DIRTY) && !consistent)) {
|
|
||||||
dprintf("imsm: mark '%s'\n", consistent ? "clean" : "dirty");
|
|
||||||
- if (consistent)
|
|
||||||
- dev->vol.dirty = 0;
|
|
||||||
- else
|
|
||||||
- dev->vol.dirty = 1;
|
|
||||||
+ if (consistent) {
|
|
||||||
+ dev->vol.dirty = RAIDVOL_CLEAN;
|
|
||||||
+ } else {
|
|
||||||
+ dev->vol.dirty = RAIDVOL_DIRTY;
|
|
||||||
+ if (dev->rwh_policy == RWH_DISTRIBUTED)
|
|
||||||
+ dev->vol.dirty |= RAIDVOL_DSRECORD_VALID;
|
|
||||||
+ }
|
|
||||||
super->updates_pending++;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -8445,6 +8667,11 @@ static struct mdinfo *imsm_activate_spare(struct active_array *a,
|
|
||||||
di->component_size = a->info.component_size;
|
|
||||||
di->container_member = inst;
|
|
||||||
di->bb.supported = 1;
|
|
||||||
+ if (dev->rwh_policy == RWH_DISTRIBUTED) {
|
|
||||||
+ di->consistency_policy = CONSISTENCY_POLICY_PPL;
|
|
||||||
+ di->ppl_sector = get_ppl_sector(super, inst);
|
|
||||||
+ di->ppl_size = (PPL_HEADER_SIZE + PPL_ENTRY_SPACE) >> 9;
|
|
||||||
+ }
|
|
||||||
super->random = random32();
|
|
||||||
di->next = rv;
|
|
||||||
rv = di;
|
|
||||||
@@ -11600,6 +11827,9 @@ struct superswitch super_imsm = {
|
|
||||||
.container_content = container_content_imsm,
|
|
||||||
.validate_container = validate_container_imsm,
|
|
||||||
|
|
||||||
+ .write_init_ppl = write_init_ppl_imsm,
|
|
||||||
+ .validate_ppl = validate_ppl_imsm,
|
|
||||||
+
|
|
||||||
.external = 1,
|
|
||||||
.name = "imsm",
|
|
||||||
|
|
||||||
diff --git a/sysfs.c b/sysfs.c
|
|
||||||
index 53589a7..2a91ba0 100644
|
|
||||||
--- a/sysfs.c
|
|
||||||
+++ b/sysfs.c
|
|
||||||
@@ -689,6 +689,16 @@ int sysfs_set_array(struct mdinfo *info, int vers)
|
|
||||||
* once the reshape completes.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ if (info->consistency_policy == CONSISTENCY_POLICY_PPL) {
|
|
||||||
+ if (sysfs_set_str(info, NULL, "consistency_policy",
|
|
||||||
+ map_num(consistency_policies,
|
|
||||||
+ info->consistency_policy))) {
|
|
||||||
+ pr_err("This kernel does not support PPL\n");
|
|
||||||
+ return 1;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -720,6 +730,10 @@ int sysfs_add_disk(struct mdinfo *sra, struct mdinfo *sd, int resume)
|
|
||||||
rv = sysfs_set_num(sra, sd, "offset", sd->data_offset);
|
|
||||||
rv |= sysfs_set_num(sra, sd, "size", (sd->component_size+1) / 2);
|
|
||||||
if (sra->array.level != LEVEL_CONTAINER) {
|
|
||||||
+ if (sd->consistency_policy == CONSISTENCY_POLICY_PPL) {
|
|
||||||
+ rv |= sysfs_set_num(sra, sd, "ppl_sector", sd->ppl_sector);
|
|
||||||
+ rv |= sysfs_set_num(sra, sd, "ppl_size", sd->ppl_size);
|
|
||||||
+ }
|
|
||||||
if (sd->recovery_start == MaxSector)
|
|
||||||
/* This can correctly fail if array isn't started,
|
|
||||||
* yet, so just ignore status for now.
|
|
||||||
--
|
|
||||||
2.10.2
|
|
||||||
|
|
@ -1,441 +0,0 @@
|
|||||||
From e97a7cd011345e5dead736de51b33968da49d876 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|
||||||
Date: Wed, 29 Mar 2017 11:54:18 +0200
|
|
||||||
Subject: [PATCH] super1: PPL support
|
|
||||||
References: FATE#321941
|
|
||||||
|
|
||||||
Enable creating and assembling raid5 arrays with PPL for 1.x metadata.
|
|
||||||
|
|
||||||
When creating, reserve enough space for PPL and store its size and
|
|
||||||
location in the superblock and set MD_FEATURE_PPL bit. Write an initial
|
|
||||||
empty header in the PPL area on each device. PPL is stored in the
|
|
||||||
metadata region reserved for internal write-intent bitmap, so don't
|
|
||||||
allow using bitmap and PPL together.
|
|
||||||
|
|
||||||
While at it, fix two endianness issues in write_empty_r5l_meta_block()
|
|
||||||
and write_init_super1().
|
|
||||||
|
|
||||||
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|
||||||
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
---
|
|
||||||
Assemble.c | 3 ++
|
|
||||||
Create.c | 2 +
|
|
||||||
Grow.c | 15 +++++-
|
|
||||||
Incremental.c | 3 ++
|
|
||||||
mdadm.h | 1 +
|
|
||||||
super1.c | 150 +++++++++++++++++++++++++++++++++++++++++++++++++++-------
|
|
||||||
6 files changed, 155 insertions(+), 19 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Assemble.c b/Assemble.c
|
|
||||||
index 8e55b49..c098420 100644
|
|
||||||
--- a/Assemble.c
|
|
||||||
+++ b/Assemble.c
|
|
||||||
@@ -962,6 +962,9 @@ static int start_array(int mdfd,
|
|
||||||
c->readonly = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ if (content->consistency_policy == CONSISTENCY_POLICY_PPL)
|
|
||||||
+ clean = 1;
|
|
||||||
+
|
|
||||||
rv = set_array_info(mdfd, st, content);
|
|
||||||
if (rv && !err_ok) {
|
|
||||||
pr_err("failed to set array info for %s: %s\n",
|
|
||||||
diff --git a/Create.c b/Create.c
|
|
||||||
index 4080bf6..10e7d10 100644
|
|
||||||
--- a/Create.c
|
|
||||||
+++ b/Create.c
|
|
||||||
@@ -524,6 +524,8 @@ int Create(struct supertype *st, char *mddev,
|
|
||||||
if (!s->bitmap_file &&
|
|
||||||
s->level >= 1 &&
|
|
||||||
st->ss->add_internal_bitmap &&
|
|
||||||
+ (s->consistency_policy != CONSISTENCY_POLICY_RESYNC &&
|
|
||||||
+ s->consistency_policy != CONSISTENCY_POLICY_PPL) &&
|
|
||||||
(s->write_behind || s->size > 100*1024*1024ULL)) {
|
|
||||||
if (c->verbose > 0)
|
|
||||||
pr_err("automatically enabling write-intent bitmap on large array\n");
|
|
||||||
diff --git a/Grow.c b/Grow.c
|
|
||||||
index e22661c..a849012 100755
|
|
||||||
--- a/Grow.c
|
|
||||||
+++ b/Grow.c
|
|
||||||
@@ -290,6 +290,7 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s)
|
|
||||||
int major = BITMAP_MAJOR_HI;
|
|
||||||
int vers = md_get_version(fd);
|
|
||||||
unsigned long long bitmapsize, array_size;
|
|
||||||
+ struct mdinfo *mdi;
|
|
||||||
|
|
||||||
if (vers < 9003) {
|
|
||||||
major = BITMAP_MAJOR_HOSTENDIAN;
|
|
||||||
@@ -389,12 +390,23 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s)
|
|
||||||
free(st);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ mdi = sysfs_read(fd, NULL, GET_CONSISTENCY_POLICY);
|
|
||||||
+ if (mdi) {
|
|
||||||
+ if (mdi->consistency_policy == CONSISTENCY_POLICY_PPL) {
|
|
||||||
+ pr_err("Cannot add bitmap to array with PPL\n");
|
|
||||||
+ free(mdi);
|
|
||||||
+ free(st);
|
|
||||||
+ return 1;
|
|
||||||
+ }
|
|
||||||
+ free(mdi);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
if (strcmp(s->bitmap_file, "internal") == 0 ||
|
|
||||||
strcmp(s->bitmap_file, "clustered") == 0) {
|
|
||||||
int rv;
|
|
||||||
int d;
|
|
||||||
int offset_setable = 0;
|
|
||||||
- struct mdinfo *mdi;
|
|
||||||
if (st->ss->add_internal_bitmap == NULL) {
|
|
||||||
pr_err("Internal bitmaps not supported with %s metadata\n", st->ss->name);
|
|
||||||
return 1;
|
|
||||||
@@ -446,6 +458,7 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s)
|
|
||||||
sysfs_init(mdi, fd, NULL);
|
|
||||||
rv = sysfs_set_num_signed(mdi, NULL, "bitmap/location",
|
|
||||||
mdi->bitmap_offset);
|
|
||||||
+ free(mdi);
|
|
||||||
} else {
|
|
||||||
if (strcmp(s->bitmap_file, "clustered") == 0)
|
|
||||||
array.state |= (1 << MD_SB_CLUSTERED);
|
|
||||||
diff --git a/Incremental.c b/Incremental.c
|
|
||||||
index 0f507bb..81afc7e 100644
|
|
||||||
--- a/Incremental.c
|
|
||||||
+++ b/Incremental.c
|
|
||||||
@@ -528,6 +528,9 @@ int Incremental(struct mddev_dev *devlist, struct context *c,
|
|
||||||
|
|
||||||
journal_device_missing = (info.journal_device_required) && (info.journal_clean == 0);
|
|
||||||
|
|
||||||
+ if (info.consistency_policy == CONSISTENCY_POLICY_PPL)
|
|
||||||
+ info.array.state |= 1;
|
|
||||||
+
|
|
||||||
if (enough(info.array.level, info.array.raid_disks,
|
|
||||||
info.array.layout, info.array.state & 1,
|
|
||||||
avail) == 0) {
|
|
||||||
diff --git a/mdadm.h b/mdadm.h
|
|
||||||
index d222cc3..2c7066d 100644
|
|
||||||
--- a/mdadm.h
|
|
||||||
+++ b/mdadm.h
|
|
||||||
@@ -302,6 +302,7 @@ struct mdinfo {
|
|
||||||
long bitmap_offset; /* 0 == none, 1 == a file */
|
|
||||||
unsigned int ppl_size;
|
|
||||||
unsigned long long ppl_sector;
|
|
||||||
+ int ppl_offset;
|
|
||||||
unsigned long safe_mode_delay; /* ms delay to mark clean */
|
|
||||||
int new_level, delta_disks, new_layout, new_chunk;
|
|
||||||
int errors;
|
|
||||||
diff --git a/super1.c b/super1.c
|
|
||||||
index 8df17a1..409b6c3 100644
|
|
||||||
--- a/super1.c
|
|
||||||
+++ b/super1.c
|
|
||||||
@@ -48,10 +48,18 @@ struct mdp_superblock_1 {
|
|
||||||
|
|
||||||
__u32 chunksize; /* in 512byte sectors */
|
|
||||||
__u32 raid_disks;
|
|
||||||
- __u32 bitmap_offset; /* sectors after start of superblock that bitmap starts
|
|
||||||
- * NOTE: signed, so bitmap can be before superblock
|
|
||||||
- * only meaningful of feature_map[0] is set.
|
|
||||||
- */
|
|
||||||
+ union {
|
|
||||||
+ __u32 bitmap_offset; /* sectors after start of superblock that bitmap starts
|
|
||||||
+ * NOTE: signed, so bitmap can be before superblock
|
|
||||||
+ * only meaningful of feature_map[0] is set.
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+ /* only meaningful when feature_map[MD_FEATURE_PPL] is set */
|
|
||||||
+ struct {
|
|
||||||
+ __s16 offset; /* sectors from start of superblock that ppl starts */
|
|
||||||
+ __u16 size; /* ppl size in sectors */
|
|
||||||
+ } ppl;
|
|
||||||
+ };
|
|
||||||
|
|
||||||
/* These are only valid with feature bit '4' */
|
|
||||||
__u32 new_level; /* new level we are reshaping to */
|
|
||||||
@@ -131,6 +139,7 @@ struct misc_dev_info {
|
|
||||||
#define MD_FEATURE_NEW_OFFSET 64 /* new_offset must be honoured */
|
|
||||||
#define MD_FEATURE_BITMAP_VERSIONED 256 /* bitmap version number checked properly */
|
|
||||||
#define MD_FEATURE_JOURNAL 512 /* support write journal */
|
|
||||||
+#define MD_FEATURE_PPL 1024 /* support PPL */
|
|
||||||
#define MD_FEATURE_ALL (MD_FEATURE_BITMAP_OFFSET \
|
|
||||||
|MD_FEATURE_RECOVERY_OFFSET \
|
|
||||||
|MD_FEATURE_RESHAPE_ACTIVE \
|
|
||||||
@@ -140,6 +149,7 @@ struct misc_dev_info {
|
|
||||||
|MD_FEATURE_NEW_OFFSET \
|
|
||||||
|MD_FEATURE_BITMAP_VERSIONED \
|
|
||||||
|MD_FEATURE_JOURNAL \
|
|
||||||
+ |MD_FEATURE_PPL \
|
|
||||||
)
|
|
||||||
|
|
||||||
#ifndef MDASSEMBLE
|
|
||||||
@@ -289,6 +299,11 @@ static int awrite(struct align_fd *afd, void *buf, int len)
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
|
|
||||||
+static inline unsigned int choose_ppl_space(int chunk)
|
|
||||||
+{
|
|
||||||
+ return (PPL_HEADER_SIZE >> 9) + (chunk > 128*2 ? chunk : 128*2);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
#ifndef MDASSEMBLE
|
|
||||||
static void examine_super1(struct supertype *st, char *homehost)
|
|
||||||
{
|
|
||||||
@@ -392,6 +407,10 @@ static void examine_super1(struct supertype *st, char *homehost)
|
|
||||||
if (sb->feature_map & __cpu_to_le32(MD_FEATURE_BITMAP_OFFSET)) {
|
|
||||||
printf("Internal Bitmap : %ld sectors from superblock\n",
|
|
||||||
(long)(int32_t)__le32_to_cpu(sb->bitmap_offset));
|
|
||||||
+ } else if (sb->feature_map & __cpu_to_le32(MD_FEATURE_PPL)) {
|
|
||||||
+ printf(" PPL : %u sectors at offset %d sectors from superblock\n",
|
|
||||||
+ __le16_to_cpu(sb->ppl.size),
|
|
||||||
+ __le16_to_cpu(sb->ppl.offset));
|
|
||||||
}
|
|
||||||
if (sb->feature_map & __cpu_to_le32(MD_FEATURE_RESHAPE_ACTIVE)) {
|
|
||||||
printf(" Reshape pos'n : %llu%s\n", (unsigned long long)__le64_to_cpu(sb->reshape_position)/2,
|
|
||||||
@@ -934,10 +953,16 @@ static void getinfo_super1(struct supertype *st, struct mdinfo *info, char *map)
|
|
||||||
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))
|
|
||||||
+ if (sb->feature_map & __le32_to_cpu(MD_FEATURE_BITMAP_OFFSET)) {
|
|
||||||
info->bitmap_offset = (int32_t)__le32_to_cpu(sb->bitmap_offset);
|
|
||||||
+ } 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);
|
|
||||||
+ info->ppl_sector = super_offset + info->ppl_offset;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
info->disk.major = 0;
|
|
||||||
info->disk.minor = 0;
|
|
||||||
@@ -948,7 +973,6 @@ static void getinfo_super1(struct supertype *st, struct mdinfo *info, char *map)
|
|
||||||
else
|
|
||||||
role = __le16_to_cpu(sb->dev_roles[__le32_to_cpu(sb->dev_number)]);
|
|
||||||
|
|
||||||
- super_offset = __le64_to_cpu(sb->super_offset);
|
|
||||||
if (info->array.level <= 0)
|
|
||||||
data_size = __le64_to_cpu(sb->data_size);
|
|
||||||
else
|
|
||||||
@@ -965,8 +989,8 @@ static void getinfo_super1(struct supertype *st, struct mdinfo *info, char *map)
|
|
||||||
end = bboffset;
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (super_offset + info->bitmap_offset < end)
|
|
||||||
- end = super_offset + info->bitmap_offset;
|
|
||||||
+ if (super_offset + info->bitmap_offset + info->ppl_offset < end)
|
|
||||||
+ end = super_offset + info->bitmap_offset + info->ppl_offset;
|
|
||||||
|
|
||||||
if (info->data_offset + data_size < end)
|
|
||||||
info->space_after = end - data_size - info->data_offset;
|
|
||||||
@@ -982,6 +1006,11 @@ static void getinfo_super1(struct supertype *st, struct mdinfo *info, char *map)
|
|
||||||
bmend += size;
|
|
||||||
if (bmend > earliest)
|
|
||||||
earliest = bmend;
|
|
||||||
+ } else if (info->ppl_offset > 0) {
|
|
||||||
+ unsigned long long pplend = info->ppl_offset +
|
|
||||||
+ info->ppl_size;
|
|
||||||
+ if (pplend > earliest)
|
|
||||||
+ earliest = pplend;
|
|
||||||
}
|
|
||||||
if (sb->bblog_offset && sb->bblog_size) {
|
|
||||||
unsigned long long bbend = super_offset;
|
|
||||||
@@ -1075,8 +1104,20 @@ static void getinfo_super1(struct supertype *st, struct mdinfo *info, char *map)
|
|
||||||
}
|
|
||||||
|
|
||||||
info->array.working_disks = working;
|
|
||||||
- if (sb->feature_map & __le32_to_cpu(MD_FEATURE_JOURNAL))
|
|
||||||
+
|
|
||||||
+ if (sb->feature_map & __le32_to_cpu(MD_FEATURE_JOURNAL)) {
|
|
||||||
info->journal_device_required = 1;
|
|
||||||
+ info->consistency_policy = CONSISTENCY_POLICY_JOURNAL;
|
|
||||||
+ } else if (sb->feature_map & __le32_to_cpu(MD_FEATURE_PPL)) {
|
|
||||||
+ info->consistency_policy = CONSISTENCY_POLICY_PPL;
|
|
||||||
+ } else if (sb->feature_map & __le32_to_cpu(MD_FEATURE_BITMAP_OFFSET)) {
|
|
||||||
+ info->consistency_policy = CONSISTENCY_POLICY_BITMAP;
|
|
||||||
+ } else if (info->array.level <= 0) {
|
|
||||||
+ info->consistency_policy = CONSISTENCY_POLICY_NONE;
|
|
||||||
+ } else {
|
|
||||||
+ info->consistency_policy = CONSISTENCY_POLICY_RESYNC;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
info->journal_clean = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1239,6 +1280,9 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
|
|
||||||
if (sb->feature_map & __cpu_to_le32(MD_FEATURE_BITMAP_OFFSET)) {
|
|
||||||
bitmap_offset = (long)__le32_to_cpu(sb->bitmap_offset);
|
|
||||||
bm_sectors = calc_bitmap_size(bms, 4096) >> 9;
|
|
||||||
+ } else if (sb->feature_map & __cpu_to_le32(MD_FEATURE_PPL)) {
|
|
||||||
+ bitmap_offset = (long)__le16_to_cpu(sb->ppl.offset);
|
|
||||||
+ bm_sectors = (long)__le16_to_cpu(sb->ppl.size);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (sb_offset < data_offset) {
|
|
||||||
@@ -1472,6 +1516,9 @@ static int init_super1(struct supertype *st, mdu_array_info_t *info,
|
|
||||||
|
|
||||||
memset(sb->dev_roles, 0xff, MAX_SB_SIZE - sizeof(struct mdp_superblock_1));
|
|
||||||
|
|
||||||
+ if (s->consistency_policy == CONSISTENCY_POLICY_PPL)
|
|
||||||
+ sb->feature_map |= __cpu_to_le32(MD_FEATURE_PPL);
|
|
||||||
+
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1645,10 +1692,49 @@ static unsigned long choose_bm_space(unsigned long devsize)
|
|
||||||
|
|
||||||
static void free_super1(struct supertype *st);
|
|
||||||
|
|
||||||
-#define META_BLOCK_SIZE 4096
|
|
||||||
+#ifndef MDASSEMBLE
|
|
||||||
+
|
|
||||||
__u32 crc32c_le(__u32 crc, unsigned char const *p, size_t len);
|
|
||||||
|
|
||||||
-#ifndef MDASSEMBLE
|
|
||||||
+static int write_init_ppl1(struct supertype *st, struct mdinfo *info, int fd)
|
|
||||||
+{
|
|
||||||
+ struct mdp_superblock_1 *sb = st->sb;
|
|
||||||
+ void *buf;
|
|
||||||
+ struct ppl_header *ppl_hdr;
|
|
||||||
+ int ret;
|
|
||||||
+
|
|
||||||
+ ret = posix_memalign(&buf, 4096, PPL_HEADER_SIZE);
|
|
||||||
+ if (ret) {
|
|
||||||
+ pr_err("Failed to allocate PPL header buffer\n");
|
|
||||||
+ return ret;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ memset(buf, 0, PPL_HEADER_SIZE);
|
|
||||||
+ ppl_hdr = buf;
|
|
||||||
+ memset(ppl_hdr->reserved, 0xff, PPL_HDR_RESERVED);
|
|
||||||
+ ppl_hdr->signature = __cpu_to_le32(~crc32c_le(~0, sb->set_uuid,
|
|
||||||
+ sizeof(sb->set_uuid)));
|
|
||||||
+ ppl_hdr->checksum = __cpu_to_le32(~crc32c_le(~0, buf, PPL_HEADER_SIZE));
|
|
||||||
+
|
|
||||||
+ if (lseek64(fd, info->ppl_sector * 512, SEEK_SET) < 0) {
|
|
||||||
+ ret = errno;
|
|
||||||
+ perror("Failed to seek to PPL header location");
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (!ret && write(fd, buf, PPL_HEADER_SIZE) != PPL_HEADER_SIZE) {
|
|
||||||
+ ret = errno;
|
|
||||||
+ perror("Write PPL header failed");
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (!ret)
|
|
||||||
+ fsync(fd);
|
|
||||||
+
|
|
||||||
+ free(buf);
|
|
||||||
+ return ret;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+#define META_BLOCK_SIZE 4096
|
|
||||||
+
|
|
||||||
static int write_empty_r5l_meta_block(struct supertype *st, int fd)
|
|
||||||
{
|
|
||||||
struct r5l_meta_block *mb;
|
|
||||||
@@ -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);
|
|
||||||
mb->checksum = crc;
|
|
||||||
|
|
||||||
- if (lseek64(fd, (sb->data_offset) * 512, 0) < 0LL) {
|
|
||||||
+ if (lseek64(fd, __le64_to_cpu(sb->data_offset) * 512, 0) < 0LL) {
|
|
||||||
pr_err("cannot seek to offset of the meta block\n");
|
|
||||||
goto fail_to_write;
|
|
||||||
}
|
|
||||||
@@ -1708,7 +1794,7 @@ static int write_init_super1(struct supertype *st)
|
|
||||||
|
|
||||||
for (di = st->info; di; di = di->next) {
|
|
||||||
if (di->disk.state & (1 << MD_DISK_JOURNAL))
|
|
||||||
- sb->feature_map |= MD_FEATURE_JOURNAL;
|
|
||||||
+ sb->feature_map |= __cpu_to_le32(MD_FEATURE_JOURNAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (di = st->info; di; di = di->next) {
|
|
||||||
@@ -1783,6 +1869,21 @@ static int write_init_super1(struct supertype *st)
|
|
||||||
(((char *)sb) + MAX_SB_SIZE);
|
|
||||||
bm_space = calc_bitmap_size(bms, 4096) >> 9;
|
|
||||||
bm_offset = (long)__le32_to_cpu(sb->bitmap_offset);
|
|
||||||
+ } else if (sb->feature_map & __cpu_to_le32(MD_FEATURE_PPL)) {
|
|
||||||
+ bm_space = choose_ppl_space(__le32_to_cpu(sb->chunksize));
|
|
||||||
+ if (bm_space > UINT16_MAX)
|
|
||||||
+ bm_space = UINT16_MAX;
|
|
||||||
+ if (st->minor_version == 0) {
|
|
||||||
+ bm_offset = -bm_space - 8;
|
|
||||||
+ if (bm_offset < INT16_MIN) {
|
|
||||||
+ bm_offset = INT16_MIN;
|
|
||||||
+ bm_space = -bm_offset - 8;
|
|
||||||
+ }
|
|
||||||
+ } else {
|
|
||||||
+ bm_offset = 8;
|
|
||||||
+ }
|
|
||||||
+ sb->ppl.offset = __cpu_to_le16(bm_offset);
|
|
||||||
+ sb->ppl.size = __cpu_to_le16(bm_space);
|
|
||||||
} else {
|
|
||||||
bm_space = choose_bm_space(array_size);
|
|
||||||
bm_offset = 8;
|
|
||||||
@@ -1854,8 +1955,17 @@ static int write_init_super1(struct supertype *st)
|
|
||||||
goto error_out;
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (rv == 0 && (__le32_to_cpu(sb->feature_map) & 1))
|
|
||||||
+ if (rv == 0 &&
|
|
||||||
+ (__le32_to_cpu(sb->feature_map) & MD_FEATURE_BITMAP_OFFSET)) {
|
|
||||||
rv = st->ss->write_bitmap(st, di->fd, NodeNumUpdate);
|
|
||||||
+ } else if (rv == 0 &&
|
|
||||||
+ (__le32_to_cpu(sb->feature_map) & MD_FEATURE_PPL)) {
|
|
||||||
+ struct mdinfo info;
|
|
||||||
+
|
|
||||||
+ st->ss->getinfo_super(st, &info, NULL);
|
|
||||||
+ rv = st->ss->write_init_ppl(st, &info, di->fd);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
close(di->fd);
|
|
||||||
di->fd = -1;
|
|
||||||
if (rv)
|
|
||||||
@@ -2123,11 +2233,13 @@ static __u64 avail_size1(struct supertype *st, __u64 devsize,
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
#ifndef MDASSEMBLE
|
|
||||||
- if (__le32_to_cpu(super->feature_map)&MD_FEATURE_BITMAP_OFFSET) {
|
|
||||||
+ if (__le32_to_cpu(super->feature_map) & MD_FEATURE_BITMAP_OFFSET) {
|
|
||||||
/* hot-add. allow for actual size of bitmap */
|
|
||||||
struct bitmap_super_s *bsb;
|
|
||||||
bsb = (struct bitmap_super_s *)(((char*)super)+MAX_SB_SIZE);
|
|
||||||
bmspace = calc_bitmap_size(bsb, 4096) >> 9;
|
|
||||||
+ } else if (__le32_to_cpu(super->feature_map) & MD_FEATURE_PPL) {
|
|
||||||
+ bmspace = __le16_to_cpu(super->ppl.size);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
/* Allow space for bad block log */
|
|
||||||
@@ -2530,8 +2642,9 @@ static int validate_geometry1(struct supertype *st, int level,
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
- /* creating: allow suitable space for bitmap */
|
|
||||||
- bmspace = choose_bm_space(devsize);
|
|
||||||
+ /* creating: allow suitable space for bitmap or PPL */
|
|
||||||
+ bmspace = consistency_policy == CONSISTENCY_POLICY_PPL ?
|
|
||||||
+ choose_ppl_space((*chunk)*2) : choose_bm_space(devsize);
|
|
||||||
|
|
||||||
if (data_offset == INVALID_SECTORS)
|
|
||||||
data_offset = st->data_offset;
|
|
||||||
@@ -2566,7 +2679,7 @@ static int validate_geometry1(struct supertype *st, int level,
|
|
||||||
switch(st->minor_version) {
|
|
||||||
case 0: /* metadata at end. Round down and subtract space to reserve */
|
|
||||||
devsize = (devsize & ~(4ULL*2-1));
|
|
||||||
- /* space for metadata, bblog, bitmap */
|
|
||||||
+ /* space for metadata, bblog, bitmap/ppl */
|
|
||||||
devsize -= 8*2 + 8 + bmspace;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
@@ -2642,6 +2755,7 @@ struct superswitch super1 = {
|
|
||||||
.add_to_super = add_to_super1,
|
|
||||||
.examine_badblocks = examine_badblocks_super1,
|
|
||||||
.copy_metadata = copy_metadata1,
|
|
||||||
+ .write_init_ppl = write_init_ppl1,
|
|
||||||
#endif
|
|
||||||
.match_home = match_home1,
|
|
||||||
.uuid_from_super = uuid_from_super1,
|
|
||||||
--
|
|
||||||
2.10.2
|
|
||||||
|
|
@ -1,276 +0,0 @@
|
|||||||
From e6e9dd3f1b255f9921ebc023c1e5b65601a637e2 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|
||||||
Date: Wed, 29 Mar 2017 11:54:19 +0200
|
|
||||||
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
|
|
||||||
for imsm to enable or disable PPL in the metadata.
|
|
||||||
|
|
||||||
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|
||||||
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
---
|
|
||||||
Assemble.c | 6 ++++++
|
|
||||||
mdadm.8.in | 27 ++++++++++++++++++++++++---
|
|
||||||
mdadm.c | 6 +++++-
|
|
||||||
super-intel.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
||||||
super1.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
|
|
||||||
5 files changed, 139 insertions(+), 4 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Assemble.c b/Assemble.c
|
|
||||||
index c098420..6a6a56b 100644
|
|
||||||
--- a/Assemble.c
|
|
||||||
+++ b/Assemble.c
|
|
||||||
@@ -602,6 +602,12 @@ static int load_devices(struct devs *devices, char *devmap,
|
|
||||||
if (strcmp(c->update, "uuid") == 0 && !ident->uuid_set)
|
|
||||||
random_uuid((__u8 *)ident->uuid);
|
|
||||||
|
|
||||||
+ if (strcmp(c->update, "ppl") == 0 &&
|
|
||||||
+ ident->bitmap_fd >= 0) {
|
|
||||||
+ pr_err("PPL is not compatible with bitmap\n");
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
dfd = dev_open(devname,
|
|
||||||
tmpdev->disposition == 'I'
|
|
||||||
? O_RDWR : (O_RDWR|O_EXCL));
|
|
||||||
diff --git a/mdadm.8.in b/mdadm.8.in
|
|
||||||
index cad5db5..1178ed9 100644
|
|
||||||
--- a/mdadm.8.in
|
|
||||||
+++ b/mdadm.8.in
|
|
||||||
@@ -1176,6 +1176,8 @@ argument given to this flag can be one of
|
|
||||||
.BR no\-bitmap ,
|
|
||||||
.BR bbl ,
|
|
||||||
.BR no\-bbl ,
|
|
||||||
+.BR ppl ,
|
|
||||||
+.BR no\-ppl ,
|
|
||||||
.BR metadata ,
|
|
||||||
or
|
|
||||||
.BR super\-minor .
|
|
||||||
@@ -1316,6 +1318,16 @@ option will cause any reservation of space for a bad block list to be
|
|
||||||
removed. If the bad block list contains entries, this will fail, as
|
|
||||||
removing the list could cause data corruption.
|
|
||||||
|
|
||||||
+The
|
|
||||||
+.B ppl
|
|
||||||
+option will enable PPL for a RAID5 array and reserve space for PPL on each
|
|
||||||
+device. There must be enough free space between the data and superblock and a
|
|
||||||
+write-intent bitmap or journal must not be used.
|
|
||||||
+
|
|
||||||
+The
|
|
||||||
+.B no\-ppl
|
|
||||||
+option will disable PPL in the superblock.
|
|
||||||
+
|
|
||||||
.TP
|
|
||||||
.BR \-\-freeze\-reshape
|
|
||||||
Option is intended to be used in start-up scripts during initrd boot phase.
|
|
||||||
@@ -2327,9 +2339,11 @@ superblock field in the subarray. Similar to updating an array in
|
|
||||||
.B \-U
|
|
||||||
or
|
|
||||||
.B \-\-update=
|
|
||||||
-option. Currently only
|
|
||||||
-.B name
|
|
||||||
-is supported.
|
|
||||||
+option. The supported options are
|
|
||||||
+.BR name ,
|
|
||||||
+.B ppl
|
|
||||||
+and
|
|
||||||
+.BR no\-ppl .
|
|
||||||
|
|
||||||
The
|
|
||||||
.B name
|
|
||||||
@@ -2340,6 +2354,13 @@ re\-assembled. If updating
|
|
||||||
would change the UUID of an active subarray this operation is blocked,
|
|
||||||
and the command will end in an error.
|
|
||||||
|
|
||||||
+The
|
|
||||||
+.B ppl
|
|
||||||
+and
|
|
||||||
+.B no\-ppl
|
|
||||||
+options enable and disable PPL in the metadata. Currently supported only for
|
|
||||||
+IMSM subarrays.
|
|
||||||
+
|
|
||||||
.TP
|
|
||||||
.B \-\-examine
|
|
||||||
The device should be a component of an md array.
|
|
||||||
diff --git a/mdadm.c b/mdadm.c
|
|
||||||
index d4e8286..6edf3ab 100644
|
|
||||||
--- a/mdadm.c
|
|
||||||
+++ b/mdadm.c
|
|
||||||
@@ -769,6 +769,10 @@ int main(int argc, char *argv[])
|
|
||||||
continue;
|
|
||||||
if (strcmp(c.update, "force-no-bbl") == 0)
|
|
||||||
continue;
|
|
||||||
+ if (strcmp(c.update, "ppl") == 0)
|
|
||||||
+ continue;
|
|
||||||
+ if (strcmp(c.update, "no-ppl") == 0)
|
|
||||||
+ continue;
|
|
||||||
if (strcmp(c.update, "metadata") == 0)
|
|
||||||
continue;
|
|
||||||
if (strcmp(c.update, "revert-reshape") == 0)
|
|
||||||
@@ -802,7 +806,7 @@ int main(int argc, char *argv[])
|
|
||||||
" 'sparc2.2', 'super-minor', 'uuid', 'name', 'nodes', 'resync',\n"
|
|
||||||
" 'summaries', 'homehost', 'home-cluster', 'byteorder', 'devicesize',\n"
|
|
||||||
" 'no-bitmap', 'metadata', 'revert-reshape'\n"
|
|
||||||
- " 'bbl', 'no-bbl', 'force-no-bbl'\n"
|
|
||||||
+ " 'bbl', 'no-bbl', 'force-no-bbl', 'ppl', 'no-ppl'\n"
|
|
||||||
);
|
|
||||||
exit(outf == stdout ? 0 : 2);
|
|
||||||
|
|
||||||
diff --git a/super-intel.c b/super-intel.c
|
|
||||||
index 87fec8b..785488a 100644
|
|
||||||
--- a/super-intel.c
|
|
||||||
+++ b/super-intel.c
|
|
||||||
@@ -451,6 +451,7 @@ enum imsm_update_type {
|
|
||||||
update_general_migration_checkpoint,
|
|
||||||
update_size_change,
|
|
||||||
update_prealloc_badblocks_mem,
|
|
||||||
+ update_rwh_policy,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct imsm_update_activate_spare {
|
|
||||||
@@ -543,6 +544,12 @@ struct imsm_update_prealloc_bb_mem {
|
|
||||||
enum imsm_update_type type;
|
|
||||||
};
|
|
||||||
|
|
||||||
+struct imsm_update_rwh_policy {
|
|
||||||
+ enum imsm_update_type type;
|
|
||||||
+ int new_policy;
|
|
||||||
+ int dev_idx;
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
static const char *_sys_dev_type[] = {
|
|
||||||
[SYS_DEV_UNKNOWN] = "Unknown",
|
|
||||||
[SYS_DEV_SAS] = "SAS",
|
|
||||||
@@ -7373,6 +7380,34 @@ static int update_subarray_imsm(struct supertype *st, char *subarray,
|
|
||||||
}
|
|
||||||
super->updates_pending++;
|
|
||||||
}
|
|
||||||
+ } else if (strcmp(update, "ppl") == 0 ||
|
|
||||||
+ strcmp(update, "no-ppl") == 0) {
|
|
||||||
+ int new_policy;
|
|
||||||
+ char *ep;
|
|
||||||
+ int vol = strtoul(subarray, &ep, 10);
|
|
||||||
+
|
|
||||||
+ if (*ep != '\0' || vol >= super->anchor->num_raid_devs)
|
|
||||||
+ return 2;
|
|
||||||
+
|
|
||||||
+ if (strcmp(update, "ppl") == 0)
|
|
||||||
+ new_policy = RWH_DISTRIBUTED;
|
|
||||||
+ else
|
|
||||||
+ new_policy = RWH_OFF;
|
|
||||||
+
|
|
||||||
+ if (st->update_tail) {
|
|
||||||
+ struct imsm_update_rwh_policy *u = xmalloc(sizeof(*u));
|
|
||||||
+
|
|
||||||
+ u->type = update_rwh_policy;
|
|
||||||
+ u->dev_idx = vol;
|
|
||||||
+ u->new_policy = new_policy;
|
|
||||||
+ append_metadata_update(st, u, sizeof(*u));
|
|
||||||
+ } else {
|
|
||||||
+ struct imsm_dev *dev;
|
|
||||||
+
|
|
||||||
+ dev = get_imsm_dev(super, vol);
|
|
||||||
+ dev->rwh_policy = new_policy;
|
|
||||||
+ super->updates_pending++;
|
|
||||||
+ }
|
|
||||||
} else
|
|
||||||
return 2;
|
|
||||||
|
|
||||||
@@ -9599,6 +9634,21 @@ static void imsm_process_update(struct supertype *st,
|
|
||||||
}
|
|
||||||
case update_prealloc_badblocks_mem:
|
|
||||||
break;
|
|
||||||
+ case update_rwh_policy: {
|
|
||||||
+ struct imsm_update_rwh_policy *u = (void *)update->buf;
|
|
||||||
+ int target = u->dev_idx;
|
|
||||||
+ struct imsm_dev *dev = get_imsm_dev(super, target);
|
|
||||||
+ if (!dev) {
|
|
||||||
+ dprintf("could not find subarray-%d\n", target);
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (dev->rwh_policy != u->new_policy) {
|
|
||||||
+ dev->rwh_policy = u->new_policy;
|
|
||||||
+ super->updates_pending++;
|
|
||||||
+ }
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
default:
|
|
||||||
pr_err("error: unsuported process update type:(type: %d)\n", type);
|
|
||||||
}
|
|
||||||
@@ -9844,6 +9894,11 @@ static int imsm_prepare_update(struct supertype *st,
|
|
||||||
super->extra_space += sizeof(struct bbm_log) -
|
|
||||||
get_imsm_bbm_log_size(super->bbm_log);
|
|
||||||
break;
|
|
||||||
+ case update_rwh_policy: {
|
|
||||||
+ if (update->len < (int)sizeof(struct imsm_update_rwh_policy))
|
|
||||||
+ return 0;
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
diff --git a/super1.c b/super1.c
|
|
||||||
index 409b6c3..e76f777 100644
|
|
||||||
--- a/super1.c
|
|
||||||
+++ b/super1.c
|
|
||||||
@@ -1325,6 +1325,55 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
|
|
||||||
sb->bblog_size = 0;
|
|
||||||
sb->bblog_shift = 0;
|
|
||||||
sb->bblog_offset = 0;
|
|
||||||
+ } else if (strcmp(update, "ppl") == 0) {
|
|
||||||
+ unsigned long long sb_offset = __le64_to_cpu(sb->super_offset);
|
|
||||||
+ unsigned long long data_offset = __le64_to_cpu(sb->data_offset);
|
|
||||||
+ unsigned long long data_size = __le64_to_cpu(sb->data_size);
|
|
||||||
+ long bb_offset = __le32_to_cpu(sb->bblog_offset);
|
|
||||||
+ int space;
|
|
||||||
+ int optimal_space;
|
|
||||||
+ int offset;
|
|
||||||
+
|
|
||||||
+ if (sb->feature_map & __cpu_to_le32(MD_FEATURE_BITMAP_OFFSET)) {
|
|
||||||
+ pr_err("Cannot add PPL to array with bitmap\n");
|
|
||||||
+ return -2;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (sb->feature_map & __cpu_to_le32(MD_FEATURE_JOURNAL)) {
|
|
||||||
+ pr_err("Cannot add PPL to array with journal\n");
|
|
||||||
+ return -2;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (sb_offset < data_offset) {
|
|
||||||
+ if (bb_offset)
|
|
||||||
+ space = bb_offset - 8;
|
|
||||||
+ else
|
|
||||||
+ space = data_offset - sb_offset - 8;
|
|
||||||
+ offset = 8;
|
|
||||||
+ } else {
|
|
||||||
+ offset = -(sb_offset - data_offset - data_size);
|
|
||||||
+ if (offset < INT16_MIN)
|
|
||||||
+ offset = INT16_MIN;
|
|
||||||
+ space = -(offset - bb_offset);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (space < (PPL_HEADER_SIZE >> 9) + 8) {
|
|
||||||
+ pr_err("Not enough space to add ppl\n");
|
|
||||||
+ return -2;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ optimal_space = choose_ppl_space(__le32_to_cpu(sb->chunksize));
|
|
||||||
+
|
|
||||||
+ if (space > optimal_space)
|
|
||||||
+ space = optimal_space;
|
|
||||||
+ if (space > UINT16_MAX)
|
|
||||||
+ space = UINT16_MAX;
|
|
||||||
+
|
|
||||||
+ sb->ppl.offset = __cpu_to_le16(offset);
|
|
||||||
+ sb->ppl.size = __cpu_to_le16(space);
|
|
||||||
+ sb->feature_map |= __cpu_to_le32(MD_FEATURE_PPL);
|
|
||||||
+ } else if (strcmp(update, "no-ppl") == 0) {
|
|
||||||
+ sb->feature_map &= ~ __cpu_to_le32(MD_FEATURE_PPL);
|
|
||||||
} else if (strcmp(update, "name") == 0) {
|
|
||||||
if (info->name[0] == 0)
|
|
||||||
sprintf(info->name, "%d", info->array.md_minor);
|
|
||||||
--
|
|
||||||
2.10.2
|
|
||||||
|
|
@ -1,349 +0,0 @@
|
|||||||
From 860f11ed4d6a7bac6f2d698a30a13371c0aa7924 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|
||||||
Date: Wed, 29 Mar 2017 11:54:20 +0200
|
|
||||||
Subject: [PATCH] Grow: support consistency policy change
|
|
||||||
References: FATE#321941
|
|
||||||
|
|
||||||
Extend the --consistency-policy parameter to work also in Grow mode.
|
|
||||||
Using it changes the currently active consistency policy in the kernel
|
|
||||||
driver and updates the metadata to make this change permanent. Currently
|
|
||||||
this supports only changing between "ppl" and "resync" policies, that is
|
|
||||||
enabling or disabling PPL at runtime.
|
|
||||||
|
|
||||||
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
|
||||||
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
---
|
|
||||||
Grow.c | 172 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
||||||
ReadMe.c | 46 +++++++++--------
|
|
||||||
mdadm.8.in | 18 ++++++-
|
|
||||||
mdadm.c | 3 ++
|
|
||||||
mdadm.h | 2 +
|
|
||||||
5 files changed, 218 insertions(+), 23 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Grow.c b/Grow.c
|
|
||||||
index a849012..b86b53e 100755
|
|
||||||
--- a/Grow.c
|
|
||||||
+++ b/Grow.c
|
|
||||||
@@ -528,6 +528,178 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s)
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
+int Grow_consistency_policy(char *devname, int fd, struct context *c, struct shape *s)
|
|
||||||
+{
|
|
||||||
+ struct supertype *st;
|
|
||||||
+ struct mdinfo *sra;
|
|
||||||
+ struct mdinfo *sd;
|
|
||||||
+ char *subarray = NULL;
|
|
||||||
+ int ret = 0;
|
|
||||||
+ char container_dev[PATH_MAX];
|
|
||||||
+
|
|
||||||
+ if (s->consistency_policy != CONSISTENCY_POLICY_RESYNC &&
|
|
||||||
+ s->consistency_policy != CONSISTENCY_POLICY_PPL) {
|
|
||||||
+ pr_err("Operation not supported for consistency policy %s\n",
|
|
||||||
+ map_num(consistency_policies, s->consistency_policy));
|
|
||||||
+ return 1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ st = super_by_fd(fd, &subarray);
|
|
||||||
+ if (!st)
|
|
||||||
+ return 1;
|
|
||||||
+
|
|
||||||
+ sra = sysfs_read(fd, NULL, GET_CONSISTENCY_POLICY|GET_LEVEL|
|
|
||||||
+ GET_DEVS|GET_STATE);
|
|
||||||
+ if (!sra) {
|
|
||||||
+ ret = 1;
|
|
||||||
+ goto free_st;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (s->consistency_policy == CONSISTENCY_POLICY_PPL &&
|
|
||||||
+ !st->ss->write_init_ppl) {
|
|
||||||
+ pr_err("%s metadata does not support PPL\n", st->ss->name);
|
|
||||||
+ ret = 1;
|
|
||||||
+ goto free_info;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (sra->array.level != 5) {
|
|
||||||
+ pr_err("Operation not supported for array level %d\n",
|
|
||||||
+ sra->array.level);
|
|
||||||
+ ret = 1;
|
|
||||||
+ goto free_info;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (sra->consistency_policy == (unsigned)s->consistency_policy) {
|
|
||||||
+ pr_err("Consistency policy is already %s\n",
|
|
||||||
+ map_num(consistency_policies, s->consistency_policy));
|
|
||||||
+ ret = 1;
|
|
||||||
+ goto free_info;
|
|
||||||
+ } else if (sra->consistency_policy != CONSISTENCY_POLICY_RESYNC &&
|
|
||||||
+ sra->consistency_policy != CONSISTENCY_POLICY_PPL) {
|
|
||||||
+ pr_err("Current consistency policy is %s, cannot change to %s\n",
|
|
||||||
+ map_num(consistency_policies, sra->consistency_policy),
|
|
||||||
+ map_num(consistency_policies, s->consistency_policy));
|
|
||||||
+ ret = 1;
|
|
||||||
+ goto free_info;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (subarray) {
|
|
||||||
+ char *update;
|
|
||||||
+
|
|
||||||
+ if (s->consistency_policy == CONSISTENCY_POLICY_PPL)
|
|
||||||
+ update = "ppl";
|
|
||||||
+ else
|
|
||||||
+ update = "no-ppl";
|
|
||||||
+
|
|
||||||
+ sprintf(container_dev, "/dev/%s", st->container_devnm);
|
|
||||||
+
|
|
||||||
+ ret = Update_subarray(container_dev, subarray, update, NULL,
|
|
||||||
+ c->verbose);
|
|
||||||
+ if (ret)
|
|
||||||
+ goto free_info;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (s->consistency_policy == CONSISTENCY_POLICY_PPL) {
|
|
||||||
+ struct mdinfo info;
|
|
||||||
+
|
|
||||||
+ if (subarray) {
|
|
||||||
+ struct mdinfo *mdi;
|
|
||||||
+ int cfd;
|
|
||||||
+
|
|
||||||
+ cfd = open(container_dev, O_RDWR|O_EXCL);
|
|
||||||
+ if (cfd < 0) {
|
|
||||||
+ pr_err("Failed to open %s\n", container_dev);
|
|
||||||
+ ret = 1;
|
|
||||||
+ goto free_info;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ ret = st->ss->load_container(st, cfd, st->container_devnm);
|
|
||||||
+ close(cfd);
|
|
||||||
+
|
|
||||||
+ if (ret) {
|
|
||||||
+ pr_err("Cannot read superblock for %s\n",
|
|
||||||
+ container_dev);
|
|
||||||
+ goto free_info;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ mdi = st->ss->container_content(st, subarray);
|
|
||||||
+ info = *mdi;
|
|
||||||
+ free(mdi);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ for (sd = sra->devs; sd; sd = sd->next) {
|
|
||||||
+ int dfd;
|
|
||||||
+ char *devpath;
|
|
||||||
+
|
|
||||||
+ if ((sd->disk.state & (1 << MD_DISK_SYNC)) == 0)
|
|
||||||
+ continue;
|
|
||||||
+
|
|
||||||
+ devpath = map_dev(sd->disk.major, sd->disk.minor, 0);
|
|
||||||
+ dfd = dev_open(devpath, O_RDWR);
|
|
||||||
+ if (dfd < 0) {
|
|
||||||
+ pr_err("Failed to open %s\n", devpath);
|
|
||||||
+ ret = 1;
|
|
||||||
+ goto free_info;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (!subarray) {
|
|
||||||
+ ret = st->ss->load_super(st, dfd, NULL);
|
|
||||||
+ if (ret) {
|
|
||||||
+ pr_err("Failed to load super-block.\n");
|
|
||||||
+ close(dfd);
|
|
||||||
+ goto free_info;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ ret = st->ss->update_super(st, sra, "ppl", devname,
|
|
||||||
+ c->verbose, 0, NULL);
|
|
||||||
+ if (ret) {
|
|
||||||
+ close(dfd);
|
|
||||||
+ st->ss->free_super(st);
|
|
||||||
+ goto free_info;
|
|
||||||
+ }
|
|
||||||
+ st->ss->getinfo_super(st, &info, NULL);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ ret |= sysfs_set_num(sra, sd, "ppl_sector", info.ppl_sector);
|
|
||||||
+ ret |= sysfs_set_num(sra, sd, "ppl_size", info.ppl_size);
|
|
||||||
+
|
|
||||||
+ if (ret) {
|
|
||||||
+ pr_err("Failed to set PPL attributes for %s\n",
|
|
||||||
+ sd->sys_name);
|
|
||||||
+ close(dfd);
|
|
||||||
+ st->ss->free_super(st);
|
|
||||||
+ goto free_info;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ ret = st->ss->write_init_ppl(st, &info, dfd);
|
|
||||||
+ if (ret)
|
|
||||||
+ pr_err("Failed to write PPL\n");
|
|
||||||
+
|
|
||||||
+ close(dfd);
|
|
||||||
+
|
|
||||||
+ if (!subarray)
|
|
||||||
+ st->ss->free_super(st);
|
|
||||||
+
|
|
||||||
+ if (ret)
|
|
||||||
+ goto free_info;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ ret = sysfs_set_str(sra, NULL, "consistency_policy",
|
|
||||||
+ map_num(consistency_policies,
|
|
||||||
+ s->consistency_policy));
|
|
||||||
+ if (ret)
|
|
||||||
+ pr_err("Failed to change array consistency policy\n");
|
|
||||||
+
|
|
||||||
+free_info:
|
|
||||||
+ sysfs_free(sra);
|
|
||||||
+free_st:
|
|
||||||
+ free(st);
|
|
||||||
+ free(subarray);
|
|
||||||
+
|
|
||||||
+ return ret;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
/*
|
|
||||||
* When reshaping an array we might need to backup some data.
|
|
||||||
* 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
|
|
||||||
index 1178ed9..744c12b 100644
|
|
||||||
--- a/mdadm.8.in
|
|
||||||
+++ b/mdadm.8.in
|
|
||||||
@@ -126,7 +126,7 @@ of component devices and changing the number of active devices in
|
|
||||||
Linear and RAID levels 0/1/4/5/6,
|
|
||||||
changing the RAID level between 0, 1, 5, and 6, and between 0 and 10,
|
|
||||||
changing the chunk size and layout for RAID 0,4,5,6,10 as well as adding or
|
|
||||||
-removing a write-intent bitmap.
|
|
||||||
+removing a write-intent bitmap and changing the array's consistency policy.
|
|
||||||
|
|
||||||
.TP
|
|
||||||
.B "Incremental Assembly"
|
|
||||||
@@ -1050,6 +1050,10 @@ after unclean shutdown. Implicitly selected when using
|
|
||||||
For RAID5 only, Partial Parity Log is used to close the write hole and
|
|
||||||
eliminate resync. PPL is stored in the metadata region of RAID member drives,
|
|
||||||
no additional journal drive is needed.
|
|
||||||
+
|
|
||||||
+.PP
|
|
||||||
+Can be used with \-\-grow to change the consistency policy of an active array
|
|
||||||
+in some cases. See CONSISTENCY POLICY CHANGES below.
|
|
||||||
.RE
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2694,6 +2698,8 @@ RAID0, RAID4, and RAID5, and between RAID0 and RAID10 (in the near-2 mode).
|
|
||||||
.IP \(bu 4
|
|
||||||
add a write-intent bitmap to any array which supports these bitmaps, or
|
|
||||||
remove a write-intent bitmap from such an array.
|
|
||||||
+.IP \(bu 4
|
|
||||||
+change the array's consistency policy.
|
|
||||||
.PP
|
|
||||||
|
|
||||||
Using GROW on containers is currently supported only for Intel's IMSM
|
|
||||||
@@ -2850,6 +2856,16 @@ can be added. Note that if you add a bitmap stored in a file which is
|
|
||||||
in a filesystem that is on the RAID array being affected, the system
|
|
||||||
will deadlock. The bitmap must be on a separate filesystem.
|
|
||||||
|
|
||||||
+.SS CONSISTENCY POLICY CHANGES
|
|
||||||
+
|
|
||||||
+The consistency policy of an active array can be changed by using the
|
|
||||||
+.B \-\-consistency\-policy
|
|
||||||
+option in Grow mode. Currently this works only for the
|
|
||||||
+.B ppl
|
|
||||||
+and
|
|
||||||
+.B resync
|
|
||||||
+policies and allows to enable or disable the RAID5 Partial Parity Log (PPL).
|
|
||||||
+
|
|
||||||
.SH INCREMENTAL MODE
|
|
||||||
|
|
||||||
.HP 12
|
|
||||||
diff --git a/mdadm.c b/mdadm.c
|
|
||||||
index 6edf3ab..5ebf117 100644
|
|
||||||
--- a/mdadm.c
|
|
||||||
+++ b/mdadm.c
|
|
||||||
@@ -1221,6 +1221,7 @@ int main(int argc, char *argv[])
|
|
||||||
s.journaldisks = 1;
|
|
||||||
continue;
|
|
||||||
case O(CREATE, 'k'):
|
|
||||||
+ case O(GROW, 'k'):
|
|
||||||
s.consistency_policy = map_name(consistency_policies,
|
|
||||||
optarg);
|
|
||||||
if (s.consistency_policy == UnSet ||
|
|
||||||
@@ -1679,6 +1680,8 @@ int main(int argc, char *argv[])
|
|
||||||
rv = Grow_reshape(devlist->devname, mdfd,
|
|
||||||
devlist->next,
|
|
||||||
data_offset, &c, &s);
|
|
||||||
+ } else if (s.consistency_policy != UnSet) {
|
|
||||||
+ rv = Grow_consistency_policy(devlist->devname, mdfd, &c, &s);
|
|
||||||
} else if (array_size == 0)
|
|
||||||
pr_err("no changes to --grow\n");
|
|
||||||
break;
|
|
||||||
diff --git a/mdadm.h b/mdadm.h
|
|
||||||
index 2c7066d..4891acf 100644
|
|
||||||
--- a/mdadm.h
|
|
||||||
+++ b/mdadm.h
|
|
||||||
@@ -1331,6 +1331,8 @@ extern int Grow_restart(struct supertype *st, struct mdinfo *info,
|
|
||||||
extern int Grow_continue(int mdfd, struct supertype *st,
|
|
||||||
struct mdinfo *info, char *backup_file,
|
|
||||||
int forked, int freeze_reshape);
|
|
||||||
+extern int Grow_consistency_policy(char *devname, int fd,
|
|
||||||
+ struct context *c, struct shape *s);
|
|
||||||
|
|
||||||
extern int restore_backup(struct supertype *st,
|
|
||||||
struct mdinfo *content,
|
|
||||||
--
|
|
||||||
2.10.2
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
@ -1,45 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
@ -1,79 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
@ -1,196 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
@ -1,99 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
@ -1,176 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
@ -1,51 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
@ -1,41 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
@ -1,139 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
@ -1,61 +0,0 @@
|
|||||||
From 230a0dde0926125b8895e02a669b4701f79c0f07 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Zhilong Liu <zlliu@suse.com>
|
|
||||||
Date: Sat, 1 Apr 2017 20:51:44 +0800
|
|
||||||
Subject: [PATCH] mdadm/Create: declaring an existing struct within same
|
|
||||||
function
|
|
||||||
Git-commit: 230a0dde0926125b8895e02a669b4701f79c0f07
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
Create:declaring 'struct stat stb' twice within the same
|
|
||||||
function, rename stb as stb2 when declares 'struct stat'
|
|
||||||
at the second time.
|
|
||||||
|
|
||||||
Signed-off-by: Zhilong Liu <zlliu@suse.com>
|
|
||||||
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
Create.c | 12 ++++++------
|
|
||||||
1 file changed, 6 insertions(+), 6 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Create.c b/Create.c
|
|
||||||
index 32987af..ba24606 100644
|
|
||||||
--- a/Create.c
|
|
||||||
+++ b/Create.c
|
|
||||||
@@ -868,7 +868,7 @@ int Create(struct supertype *st, char *mddev,
|
|
||||||
for (dnum=0, raid_disk_num=0, dv = devlist ; dv ;
|
|
||||||
dv=(dv->next)?(dv->next):moved_disk, dnum++) {
|
|
||||||
int fd;
|
|
||||||
- struct stat stb;
|
|
||||||
+ struct stat stb2;
|
|
||||||
struct mdinfo *inf = &infos[dnum];
|
|
||||||
|
|
||||||
if (dnum >= total_slots)
|
|
||||||
@@ -924,9 +924,9 @@ int Create(struct supertype *st, char *mddev,
|
|
||||||
dv->devname);
|
|
||||||
goto abort_locked;
|
|
||||||
}
|
|
||||||
- fstat(fd, &stb);
|
|
||||||
- inf->disk.major = major(stb.st_rdev);
|
|
||||||
- inf->disk.minor = minor(stb.st_rdev);
|
|
||||||
+ fstat(fd, &stb2);
|
|
||||||
+ inf->disk.major = major(stb2.st_rdev);
|
|
||||||
+ inf->disk.minor = minor(stb2.st_rdev);
|
|
||||||
}
|
|
||||||
if (fd >= 0)
|
|
||||||
remove_partitions(fd);
|
|
||||||
@@ -947,8 +947,8 @@ int Create(struct supertype *st, char *mddev,
|
|
||||||
|
|
||||||
if (!have_container) {
|
|
||||||
/* getinfo_super might have lost these ... */
|
|
||||||
- inf->disk.major = major(stb.st_rdev);
|
|
||||||
- inf->disk.minor = minor(stb.st_rdev);
|
|
||||||
+ inf->disk.major = major(stb2.st_rdev);
|
|
||||||
+ inf->disk.minor = minor(stb2.st_rdev);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
@ -1,81 +0,0 @@
|
|||||||
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
|
|
||||||
Git-commit: cf622ec1d81a5bb3f882922667bac494b3a16581
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
These always go at the end of the line, never at the front
|
|
||||||
|
|
||||||
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
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
|
|
||||||
|
|
@ -1,172 +0,0 @@
|
|||||||
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
|
|
||||||
Git-commit: 98dbf73cba81cd846f9c706f37edc22e21038cf4
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
Create.c | 50 ++++++++++++++++++++++++--------------------------
|
|
||||||
1 file changed, 24 insertions(+), 26 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Create.c b/Create.c
|
|
||||||
index 17333ce..4f98c58 100644
|
|
||||||
--- a/Create.c
|
|
||||||
+++ b/Create.c
|
|
||||||
@@ -84,12 +84,12 @@ int Create(struct supertype *st, char *mddev,
|
|
||||||
* 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;
|
|
||||||
@@ -259,7 +259,7 @@ int Create(struct supertype *st, char *mddev,
|
|
||||||
&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) {
|
|
||||||
@@ -290,7 +290,7 @@ int Create(struct supertype *st, char *mddev,
|
|
||||||
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
|
|
||||||
@@ -302,7 +302,7 @@ int Create(struct supertype *st, char *mddev,
|
|
||||||
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)
|
|
||||||
@@ -348,7 +348,7 @@ int Create(struct supertype *st, char *mddev,
|
|
||||||
*/
|
|
||||||
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;
|
|
||||||
@@ -444,10 +444,10 @@ int Create(struct supertype *st, char *mddev,
|
|
||||||
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);
|
|
||||||
@@ -496,7 +496,7 @@ int Create(struct supertype *st, char *mddev,
|
|
||||||
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,
|
|
||||||
@@ -571,9 +571,9 @@ int Create(struct supertype *st, char *mddev,
|
|
||||||
* 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;
|
|
||||||
@@ -648,7 +648,7 @@ int Create(struct supertype *st, char *mddev,
|
|
||||||
* 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;
|
|
||||||
|
|
||||||
@@ -714,13 +714,11 @@ int Create(struct supertype *st, char *mddev,
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
@@ -771,9 +769,9 @@ int Create(struct supertype *st, char *mddev,
|
|
||||||
#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;
|
|
||||||
}
|
|
||||||
@@ -856,11 +854,11 @@ int Create(struct supertype *st, char *mddev,
|
|
||||||
|
|
||||||
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 stb2;
|
|
||||||
struct mdinfo *inf = &infos[dnum];
|
|
||||||
@@ -872,7 +870,7 @@ int Create(struct supertype *st, char *mddev,
|
|
||||||
moved_disk = dv;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
- if (strcasecmp(dv->devname, "missing")==0) {
|
|
||||||
+ if (strcasecmp(dv->devname, "missing") == 0) {
|
|
||||||
raid_disk_num += 1;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
|||||||
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"
|
|
||||||
Git-commit: 5fbc1f1527ec86ae904739a27c0af4e3bc89084e
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
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>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
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':
|
|
@ -1,59 +0,0 @@
|
|||||||
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.
|
|
||||||
Git-commit: 039df36231335fabe4da1a22fa3accb160d8bc1b
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
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>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
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
|
|
||||||
|
|
@ -1,48 +0,0 @@
|
|||||||
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
|
|
||||||
Git-commit: 8a70632fc2f9026e0f4895f5348cc7cd20d9fbb3
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
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>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
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
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
|||||||
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
|
|
||||||
Git-commit: e39c76b9b72db00d32780e9f30dfba25f58922d2
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
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>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
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
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
|||||||
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.
|
|
||||||
Git-commit: e47781fcea24778a16e4be53e5b84eab8db9413c
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
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>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
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
|
|
||||||
|
|
@ -1,41 +0,0 @@
|
|||||||
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.
|
|
||||||
Git-commit: a250ce240f245df594570a5e25398680d403af67
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
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>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
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
|
|
||||||
|
|
@ -1,54 +0,0 @@
|
|||||||
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
|
|
||||||
Git-commit: 5c4b3b9aa9f576305b36d5ccbd4b929b51307ce9
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
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>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
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
|
|
||||||
|
|
@ -1,74 +0,0 @@
|
|||||||
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.
|
|
||||||
Git-commit: b9c9bd9bacaab701d5b3cb3e4b6cb02ea8d36e47
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
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>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
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
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
|||||||
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
|
|
||||||
Git-commit: 07c45a1871df0a70beb8da80d11601d33c7a5de2
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
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>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
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
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
|||||||
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
|
|
||||||
Git-commit: 922a58292fafa4efcfcd44fbc46b0665681c955a
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
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>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
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
|
|
||||||
|
|
@ -1,41 +0,0 @@
|
|||||||
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
|
|
||||||
Git-commit: b208f817ec538e56df7280f0353e6bda532b9432
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
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>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
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
|
|
||||||
|
|
@ -1,49 +0,0 @@
|
|||||||
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
|
|
||||||
Git-commit: 84918897ee8bb450ea09f7c95b9da44df8e925e4
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
"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>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
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
|
|
||||||
|
|
@ -1,47 +0,0 @@
|
|||||||
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
|
|
||||||
Git-commit: 5c5ea85b4deedf5e7491a905bbb4f4a3bc284f2c
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
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>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
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
|
|
||||||
|
|
@ -1,88 +0,0 @@
|
|||||||
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
|
|
||||||
Git-commit: 853375734edcfd70ba64b444b9e69f7e336a30b7
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
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>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
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
|
|
||||||
|
|
@ -1,72 +0,0 @@
|
|||||||
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
|
|
||||||
Git-commit: f2cc4f7d829e1b849e78bdf6c38b7bd6e234c600
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
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>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
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
|
|
||||||
*/
|
|
@ -1,38 +0,0 @@
|
|||||||
From e81070a69bf0c6e20f95806b6c60f6ec5c952a20 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Zhilong Liu <zlliu@suse.com>
|
|
||||||
Date: Mon, 20 Mar 2017 13:21:24 +0800
|
|
||||||
Subject: [PATCH] mdadm/mdmon:deleted the abort_reshape never invoked
|
|
||||||
Git-commit: e81070a69bf0c6e20f95806b6c60f6ec5c952a20
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
Mdmon.c: abort_reshape() has implemented in Grow.c,
|
|
||||||
this function doesn't make a lot of sense here.
|
|
||||||
|
|
||||||
Signed-off-by: Zhilong Liu <zlliu@suse.com>
|
|
||||||
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
mdmon.c | 5 -----
|
|
||||||
1 file changed, 5 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/mdmon.c b/mdmon.c
|
|
||||||
index e4b73d9..95e9bba 100644
|
|
||||||
--- a/mdmon.c
|
|
||||||
+++ b/mdmon.c
|
|
||||||
@@ -580,11 +580,6 @@ int restore_stripes(int *dest, unsigned long long *offsets,
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
-void abort_reshape(struct mdinfo *sra)
|
|
||||||
-{
|
|
||||||
- return;
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
int save_stripes(int *source, unsigned long long *offsets,
|
|
||||||
int raid_disks, int chunk_size, int level, int layout,
|
|
||||||
int nwrites, int *dest,
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
@ -1,421 +0,0 @@
|
|||||||
From 9cd39f015558dba82c293a4433b481b921ceec87 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Date: Wed, 29 Mar 2017 14:35:41 -0400
|
|
||||||
Subject: [PATCH] util: Introduce md_get_array_info()
|
|
||||||
Git-commit: 9cd39f015558dba82c293a4433b481b921ceec87
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
Remove most direct ioctl calls for GET_ARRAY_INFO, except for one,
|
|
||||||
which will be addressed in the next patch.
|
|
||||||
|
|
||||||
This is the start of the effort to clean up the use of ioctl calls and
|
|
||||||
introduce a more structured API, which will use sysfs and fall back to
|
|
||||||
ioctl for backup.
|
|
||||||
|
|
||||||
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
Create.c | 5 ++---
|
|
||||||
Detail.c | 2 +-
|
|
||||||
Grow.c | 31 ++++++++++++++++---------------
|
|
||||||
Incremental.c | 11 +++++------
|
|
||||||
Manage.c | 13 ++++++-------
|
|
||||||
Monitor.c | 7 ++++---
|
|
||||||
Query.c | 7 ++++---
|
|
||||||
mdadm.h | 1 +
|
|
||||||
mdassemble.c | 2 +-
|
|
||||||
util.c | 14 +++++++++++---
|
|
||||||
10 files changed, 51 insertions(+), 42 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Create.c b/Create.c
|
|
||||||
index 10e7d10..0e0778f 100644
|
|
||||||
--- a/Create.c
|
|
||||||
+++ b/Create.c
|
|
||||||
@@ -156,8 +156,7 @@ int Create(struct supertype *st, char *mddev,
|
|
||||||
memset(&inf, 0, sizeof(inf));
|
|
||||||
fd = open(devlist->devname, O_RDONLY);
|
|
||||||
if (fd >= 0 &&
|
|
||||||
- ioctl(fd, GET_ARRAY_INFO, &inf) == 0 &&
|
|
||||||
- inf.raid_disks == 0) {
|
|
||||||
+ md_get_array_info(fd, &inf) == 0 && inf.raid_disks == 0) {
|
|
||||||
/* yep, looks like a container */
|
|
||||||
if (st) {
|
|
||||||
rv = st->ss->load_container(st, fd,
|
|
||||||
@@ -634,7 +633,7 @@ int Create(struct supertype *st, char *mddev,
|
|
||||||
} else {
|
|
||||||
mdu_array_info_t inf;
|
|
||||||
memset(&inf, 0, sizeof(inf));
|
|
||||||
- ioctl(mdfd, GET_ARRAY_INFO, &inf);
|
|
||||||
+ md_get_array_info(mdfd, &inf);
|
|
||||||
if (inf.working_disks != 0) {
|
|
||||||
pr_err("another array by this name is already running.\n");
|
|
||||||
goto abort_locked;
|
|
||||||
diff --git a/Detail.c b/Detail.c
|
|
||||||
index 136875b..d7e886a 100644
|
|
||||||
--- a/Detail.c
|
|
||||||
+++ b/Detail.c
|
|
||||||
@@ -107,7 +107,7 @@ int Detail(char *dev, struct context *c)
|
|
||||||
external = (sra != NULL && sra->array.major_version == -1
|
|
||||||
&& sra->array.minor_version == -2);
|
|
||||||
st = super_by_fd(fd, &subarray);
|
|
||||||
- if (ioctl(fd, GET_ARRAY_INFO, &array) == 0) {
|
|
||||||
+ if (md_get_array_info(fd, &array) == 0) {
|
|
||||||
inactive = 0;
|
|
||||||
} else if (errno == ENODEV && sra) {
|
|
||||||
if (sra->array.major_version == -1 &&
|
|
||||||
diff --git a/Grow.c b/Grow.c
|
|
||||||
index 6405f0e..4eab5cc 100755
|
|
||||||
--- a/Grow.c
|
|
||||||
+++ b/Grow.c
|
|
||||||
@@ -115,7 +115,7 @@ int Grow_Add_device(char *devname, int fd, char *newdev)
|
|
||||||
struct supertype *st = NULL;
|
|
||||||
char *subarray = NULL;
|
|
||||||
|
|
||||||
- if (ioctl(fd, GET_ARRAY_INFO, &info.array) < 0) {
|
|
||||||
+ if (md_get_array_info(fd, &info.array) < 0) {
|
|
||||||
pr_err("cannot get array info for %s\n", devname);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
@@ -221,7 +221,7 @@ int Grow_Add_device(char *devname, int fd, char *newdev)
|
|
||||||
* Now go through and update all superblocks
|
|
||||||
*/
|
|
||||||
|
|
||||||
- if (ioctl(fd, GET_ARRAY_INFO, &info.array) < 0) {
|
|
||||||
+ if (md_get_array_info(fd, &info.array) < 0) {
|
|
||||||
pr_err("cannot get array info for %s\n", devname);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
@@ -328,7 +328,7 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s)
|
|
||||||
devname, bmf.pathname);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
- if (ioctl(fd, GET_ARRAY_INFO, &array) != 0) {
|
|
||||||
+ if (md_get_array_info(fd, &array) != 0) {
|
|
||||||
pr_err("cannot get array status for %s\n", devname);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
@@ -1784,7 +1784,7 @@ int Grow_reshape(char *devname, int fd,
|
|
||||||
struct mdinfo info;
|
|
||||||
struct mdinfo *sra;
|
|
||||||
|
|
||||||
- if (ioctl(fd, GET_ARRAY_INFO, &array) < 0) {
|
|
||||||
+ if (md_get_array_info(fd, &array) < 0) {
|
|
||||||
pr_err("%s is not an active md array - aborting\n",
|
|
||||||
devname);
|
|
||||||
return 1;
|
|
||||||
@@ -2030,7 +2030,7 @@ int Grow_reshape(char *devname, int fd,
|
|
||||||
/* get array parameters after takeover
|
|
||||||
* to change one parameter at time only
|
|
||||||
*/
|
|
||||||
- rv = ioctl(fd, GET_ARRAY_INFO, &array);
|
|
||||||
+ rv = md_get_array_info(fd, &array);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* make sure mdmon is
|
|
||||||
@@ -2072,7 +2072,7 @@ int Grow_reshape(char *devname, int fd,
|
|
||||||
/* go back to raid0, drop parity disk
|
|
||||||
*/
|
|
||||||
sysfs_set_str(sra, NULL, "level", "raid0");
|
|
||||||
- ioctl(fd, GET_ARRAY_INFO, &array);
|
|
||||||
+ md_get_array_info(fd, &array);
|
|
||||||
}
|
|
||||||
|
|
||||||
size_change_error:
|
|
||||||
@@ -2101,7 +2101,7 @@ size_change_error:
|
|
||||||
sysfs_set_str(sra, NULL, "resync_start", "none") < 0)
|
|
||||||
pr_err("--assume-clean not supported with --grow on this kernel\n");
|
|
||||||
}
|
|
||||||
- ioctl(fd, GET_ARRAY_INFO, &array);
|
|
||||||
+ md_get_array_info(fd, &array);
|
|
||||||
s->size = get_component_size(fd)/2;
|
|
||||||
if (s->size == 0)
|
|
||||||
s->size = array.size;
|
|
||||||
@@ -2267,7 +2267,7 @@ size_change_error:
|
|
||||||
rv =1 ;
|
|
||||||
}
|
|
||||||
if (s->layout_str) {
|
|
||||||
- if (ioctl(fd, GET_ARRAY_INFO, &array) != 0) {
|
|
||||||
+ if (md_get_array_info(fd, &array) != 0) {
|
|
||||||
dprintf("Cannot get array information.\n");
|
|
||||||
goto release;
|
|
||||||
}
|
|
||||||
@@ -2830,7 +2830,7 @@ static int impose_reshape(struct mdinfo *sra,
|
|
||||||
* reshape->after.data_disks);
|
|
||||||
}
|
|
||||||
|
|
||||||
- ioctl(fd, GET_ARRAY_INFO, &array);
|
|
||||||
+ md_get_array_info(fd, &array);
|
|
||||||
if (info->array.chunk_size == info->new_chunk &&
|
|
||||||
reshape->before.layout == reshape->after.layout &&
|
|
||||||
st->ss->external == 0) {
|
|
||||||
@@ -2885,7 +2885,7 @@ static int impose_level(int fd, int level, char *devname, int verbose)
|
|
||||||
struct mdinfo info;
|
|
||||||
sysfs_init(&info, fd, NULL);
|
|
||||||
|
|
||||||
- ioctl(fd, GET_ARRAY_INFO, &array);
|
|
||||||
+ md_get_array_info(fd, &array);
|
|
||||||
if (level == 0 &&
|
|
||||||
(array.level >= 4 && array.level <= 6)) {
|
|
||||||
/* To convert to RAID0 we need to fail and
|
|
||||||
@@ -2921,7 +2921,7 @@ static int impose_level(int fd, int level, char *devname, int verbose)
|
|
||||||
makedev(disk.major, disk.minor));
|
|
||||||
}
|
|
||||||
/* Now fail anything left */
|
|
||||||
- ioctl(fd, GET_ARRAY_INFO, &array);
|
|
||||||
+ md_get_array_info(fd, &array);
|
|
||||||
for (d = 0, found = 0;
|
|
||||||
d < MAX_DISKS && found < array.nr_disks;
|
|
||||||
d++) {
|
|
||||||
@@ -3042,7 +3042,7 @@ static int reshape_array(char *container, int fd, char *devname,
|
|
||||||
/* when reshaping a RAID0, the component_size might be zero.
|
|
||||||
* So try to fix that up.
|
|
||||||
*/
|
|
||||||
- if (ioctl(fd, GET_ARRAY_INFO, &array) != 0) {
|
|
||||||
+ if (md_get_array_info(fd, &array) != 0) {
|
|
||||||
dprintf("Cannot get array information.\n");
|
|
||||||
goto release;
|
|
||||||
}
|
|
||||||
@@ -3230,7 +3230,7 @@ static int reshape_array(char *container, int fd, char *devname,
|
|
||||||
* some more changes: layout, raid_disks, chunk_size
|
|
||||||
*/
|
|
||||||
/* read current array info */
|
|
||||||
- if (ioctl(fd, GET_ARRAY_INFO, &array) != 0) {
|
|
||||||
+ if (md_get_array_info(fd, &array) != 0) {
|
|
||||||
dprintf("Cannot get array information.\n");
|
|
||||||
goto release;
|
|
||||||
}
|
|
||||||
@@ -4994,8 +4994,9 @@ int Grow_continue_command(char *devname, int fd,
|
|
||||||
int d;
|
|
||||||
int cnt = 5;
|
|
||||||
dprintf_cont("native array (%s)\n", devname);
|
|
||||||
- if (ioctl(fd, GET_ARRAY_INFO, &array.array) < 0) {
|
|
||||||
- pr_err("%s is not an active md array - aborting\n", devname);
|
|
||||||
+ if (md_get_array_info(fd, &array.array) < 0) {
|
|
||||||
+ pr_err("%s is not an active md array - aborting\n",
|
|
||||||
+ devname);
|
|
||||||
ret_val = 1;
|
|
||||||
goto Grow_continue_command_exit;
|
|
||||||
}
|
|
||||||
diff --git a/Incremental.c b/Incremental.c
|
|
||||||
index 81afc7e..1f12c77 100644
|
|
||||||
--- a/Incremental.c
|
|
||||||
+++ b/Incremental.c
|
|
||||||
@@ -398,7 +398,7 @@ int Incremental(struct mddev_dev *devlist, struct context *c,
|
|
||||||
&& ! policy_action_allows(policy, st->ss->name,
|
|
||||||
act_re_add)
|
|
||||||
&& c->runstop < 1) {
|
|
||||||
- if (ioctl(mdfd, GET_ARRAY_INFO, &ainf) == 0) {
|
|
||||||
+ if (md_get_array_info(mdfd, &ainf) == 0) {
|
|
||||||
pr_err("not adding %s to active array (without --run) %s\n",
|
|
||||||
devname, chosen_name);
|
|
||||||
rv = 2;
|
|
||||||
@@ -549,7 +549,7 @@ int Incremental(struct mddev_dev *devlist, struct context *c,
|
|
||||||
/* + add any bitmap file */
|
|
||||||
/* + start the array (auto-readonly). */
|
|
||||||
|
|
||||||
- if (ioctl(mdfd, GET_ARRAY_INFO, &ainf) == 0) {
|
|
||||||
+ if (md_get_array_info(mdfd, &ainf) == 0) {
|
|
||||||
if (c->export) {
|
|
||||||
printf("MD_STARTED=already\n");
|
|
||||||
} else if (c->verbose >= 0)
|
|
||||||
@@ -664,7 +664,7 @@ static void find_reject(int mdfd, struct supertype *st, struct mdinfo *sra,
|
|
||||||
struct mdinfo *d;
|
|
||||||
mdu_array_info_t ra;
|
|
||||||
|
|
||||||
- if (ioctl(mdfd, GET_ARRAY_INFO, &ra) == 0)
|
|
||||||
+ if (md_get_array_info(mdfd, &ra) == 0)
|
|
||||||
return; /* not safe to remove from active arrays
|
|
||||||
* without thinking more */
|
|
||||||
|
|
||||||
@@ -837,7 +837,7 @@ static int container_members_max_degradation(struct map_ent *map, struct map_ent
|
|
||||||
if (afd < 0)
|
|
||||||
continue;
|
|
||||||
/* most accurate information regarding array degradation */
|
|
||||||
- if (ioctl(afd, GET_ARRAY_INFO, &array) >= 0) {
|
|
||||||
+ if (md_get_array_info(afd, &array) >= 0) {
|
|
||||||
int degraded = array.raid_disks - array.active_disks -
|
|
||||||
array.spare_disks;
|
|
||||||
if (degraded > max_degraded)
|
|
||||||
@@ -1390,8 +1390,7 @@ restart:
|
|
||||||
rv = 1;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
- if (ioctl(mdfd, GET_ARRAY_INFO, &array) == 0 ||
|
|
||||||
- errno != ENODEV) {
|
|
||||||
+ if (md_get_array_info(mdfd, &array) == 0 || errno != ENODEV) {
|
|
||||||
close(mdfd);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
diff --git a/Manage.c b/Manage.c
|
|
||||||
index 55218d9..24ed370 100644
|
|
||||||
--- a/Manage.c
|
|
||||||
+++ b/Manage.c
|
|
||||||
@@ -95,7 +95,7 @@ int Manage_ro(char *devname, int fd, int readonly)
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
- if (ioctl(fd, GET_ARRAY_INFO, &array)) {
|
|
||||||
+ if (md_get_array_info(fd, &array)) {
|
|
||||||
pr_err("%s does not appear to be active.\n",
|
|
||||||
devname);
|
|
||||||
rv = 1;
|
|
||||||
@@ -539,7 +539,7 @@ static void add_faulty(struct mddev_dev *dv, int fd, char disp)
|
|
||||||
int remaining_disks;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
- if (ioctl(fd, GET_ARRAY_INFO, &array) != 0)
|
|
||||||
+ if (md_get_array_info(fd, &array) != 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
remaining_disks = array.nr_disks;
|
|
||||||
@@ -565,7 +565,7 @@ static void add_detached(struct mddev_dev *dv, int fd, char disp)
|
|
||||||
int remaining_disks;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
- if (ioctl(fd, GET_ARRAY_INFO, &array) != 0)
|
|
||||||
+ if (md_get_array_info(fd, &array) != 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
remaining_disks = array.nr_disks;
|
|
||||||
@@ -602,7 +602,7 @@ static void add_set(struct mddev_dev *dv, int fd, char set_char)
|
|
||||||
int copies, set;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
- if (ioctl(fd, GET_ARRAY_INFO, &array) != 0)
|
|
||||||
+ if (md_get_array_info(fd, &array) != 0)
|
|
||||||
return;
|
|
||||||
if (array.level != 10)
|
|
||||||
return;
|
|
||||||
@@ -1383,9 +1383,8 @@ int Manage_subdevs(char *devname, int fd,
|
|
||||||
int busy = 0;
|
|
||||||
int raid_slot = -1;
|
|
||||||
|
|
||||||
- if (ioctl(fd, GET_ARRAY_INFO, &array)) {
|
|
||||||
- pr_err("Cannot get array info for %s\n",
|
|
||||||
- devname);
|
|
||||||
+ if (md_get_array_info(fd, &array)) {
|
|
||||||
+ pr_err("Cannot get array info for %s\n", devname);
|
|
||||||
goto abort;
|
|
||||||
}
|
|
||||||
sysfs_init(&info, fd, NULL);
|
|
||||||
diff --git a/Monitor.c b/Monitor.c
|
|
||||||
index bdd3e63..0a0a1e2 100644
|
|
||||||
--- a/Monitor.c
|
|
||||||
+++ b/Monitor.c
|
|
||||||
@@ -497,7 +497,7 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
fcntl(fd, F_SETFD, FD_CLOEXEC);
|
|
||||||
- if (ioctl(fd, GET_ARRAY_INFO, &array)<0) {
|
|
||||||
+ if (md_get_array_info(fd, &array) < 0) {
|
|
||||||
if (!st->err)
|
|
||||||
alert("DeviceDisappeared", dev, NULL, ainfo);
|
|
||||||
st->err++;
|
|
||||||
@@ -709,9 +709,10 @@ static int add_new_arrays(struct mdstat_ent *mdstat, struct state **statelist,
|
|
||||||
|
|
||||||
st->devname = xstrdup(name);
|
|
||||||
if ((fd = open(st->devname, O_RDONLY)) < 0 ||
|
|
||||||
- ioctl(fd, GET_ARRAY_INFO, &array)< 0) {
|
|
||||||
+ md_get_array_info(fd, &array) < 0) {
|
|
||||||
/* no such array */
|
|
||||||
- if (fd >=0) close(fd);
|
|
||||||
+ if (fd >= 0)
|
|
||||||
+ close(fd);
|
|
||||||
put_md_name(st->devname);
|
|
||||||
free(st->devname);
|
|
||||||
if (st->metadata) {
|
|
||||||
diff --git a/Query.c b/Query.c
|
|
||||||
index fbc1d10..cae75d1 100644
|
|
||||||
--- a/Query.c
|
|
||||||
+++ b/Query.c
|
|
||||||
@@ -53,9 +53,10 @@ int Query(char *dev)
|
|
||||||
}
|
|
||||||
|
|
||||||
vers = md_get_version(fd);
|
|
||||||
- if (ioctl(fd, GET_ARRAY_INFO, &array)<0)
|
|
||||||
+ if (md_get_array_info(fd, &array) < 0)
|
|
||||||
ioctlerr = errno;
|
|
||||||
- else ioctlerr = 0;
|
|
||||||
+ else
|
|
||||||
+ ioctlerr = 0;
|
|
||||||
|
|
||||||
fstat(fd, &stb);
|
|
||||||
|
|
||||||
@@ -100,7 +101,7 @@ int Query(char *dev)
|
|
||||||
activity = "undetected";
|
|
||||||
if (mddev && (fd = open(mddev, O_RDONLY))>=0) {
|
|
||||||
if (md_get_version(fd) >= 9000 &&
|
|
||||||
- ioctl(fd, GET_ARRAY_INFO, &array)>= 0) {
|
|
||||||
+ md_get_array_info(fd, &array) >= 0) {
|
|
||||||
if (ioctl(fd, GET_DISK_INFO, &disc) >= 0 &&
|
|
||||||
makedev((unsigned)disc.major,(unsigned)disc.minor) == stb.st_rdev)
|
|
||||||
activity = "active";
|
|
||||||
diff --git a/mdadm.h b/mdadm.h
|
|
||||||
index dbf1f92..7770585 100644
|
|
||||||
--- a/mdadm.h
|
|
||||||
+++ b/mdadm.h
|
|
||||||
@@ -1405,6 +1405,7 @@ extern int Restore_metadata(char *dev, char *dir, struct context *c,
|
|
||||||
struct supertype *st, int only);
|
|
||||||
|
|
||||||
extern int md_get_version(int fd);
|
|
||||||
+int md_get_array_info(int fd, struct mdu_array_info_s *array);
|
|
||||||
extern int get_linux_version(void);
|
|
||||||
extern int mdadm_version(char *version);
|
|
||||||
extern unsigned long long parse_size(char *size);
|
|
||||||
diff --git a/mdassemble.c b/mdassemble.c
|
|
||||||
index 471ffeb..a24b324 100644
|
|
||||||
--- a/mdassemble.c
|
|
||||||
+++ b/mdassemble.c
|
|
||||||
@@ -67,7 +67,7 @@ int main(int argc, char *argv[])
|
|
||||||
if (strcasecmp(array_list->devname, "<ignore>") == 0)
|
|
||||||
continue;
|
|
||||||
mdfd = open_mddev(array_list->devname, 0);
|
|
||||||
- if (mdfd >= 0 && ioctl(mdfd, GET_ARRAY_INFO, &array) == 0) {
|
|
||||||
+ if (mdfd >= 0 && md_get_array_info(mdfd, &array) == 0) {
|
|
||||||
rv |= Manage_ro(array_list->devname, mdfd, -1); /* make it readwrite */
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
diff --git a/util.c b/util.c
|
|
||||||
index 374015e..725877d 100644
|
|
||||||
--- a/util.c
|
|
||||||
+++ b/util.c
|
|
||||||
@@ -212,6 +212,15 @@ int cluster_release_dlmlock(int lockid)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
+ * Get array info from the kernel. Longer term we want to deprecate the
|
|
||||||
+ * ioctl and get it from sysfs.
|
|
||||||
+ */
|
|
||||||
+int md_get_array_info(int fd, struct mdu_array_info_s *array)
|
|
||||||
+{
|
|
||||||
+ return ioctl(fd, GET_ARRAY_INFO, array);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/*
|
|
||||||
* Parse a 128 bit uuid in 4 integers
|
|
||||||
* format is 32 hexx nibbles with options :.<space> separator
|
|
||||||
* If not exactly 32 hex digits are found, return 0
|
|
||||||
@@ -539,8 +548,7 @@ int enough_fd(int fd)
|
|
||||||
int i, rv;
|
|
||||||
char *avail;
|
|
||||||
|
|
||||||
- if (ioctl(fd, GET_ARRAY_INFO, &array) != 0 ||
|
|
||||||
- array.raid_disks <= 0)
|
|
||||||
+ if (md_get_array_info(fd, &array) != 0 || array.raid_disks <= 0)
|
|
||||||
return 0;
|
|
||||||
avail = xcalloc(array.raid_disks, 1);
|
|
||||||
for (i = 0; i < MAX_DISKS && array.nr_disks > 0; i++) {
|
|
||||||
@@ -1175,7 +1183,7 @@ struct supertype *super_by_fd(int fd, char **subarrayp)
|
|
||||||
minor = sra->array.minor_version;
|
|
||||||
verstr = sra->text_version;
|
|
||||||
} else {
|
|
||||||
- if (ioctl(fd, GET_ARRAY_INFO, &array))
|
|
||||||
+ if (md_get_array_info(fd, &array))
|
|
||||||
array.major_version = array.minor_version = 0;
|
|
||||||
vers = array.major_version;
|
|
||||||
minor = array.minor_version;
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
@ -1,58 +0,0 @@
|
|||||||
From 5b13d2e1fb8abecddd4e28e67facac5d7ef2cef3 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Date: Wed, 29 Mar 2017 14:40:36 -0400
|
|
||||||
Subject: [PATCH] Incremental: Remove redundant call for GET_ARRAY_INFO
|
|
||||||
Git-commit: 5b13d2e1fb8abecddd4e28e67facac5d7ef2cef3
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
The code above just called md_get_array_info() and only reached this
|
|
||||||
point if it returned an error that isn't ENODEV, so it's pointless to
|
|
||||||
check this again here.
|
|
||||||
|
|
||||||
In addition it was incorrectly retrieving ioctl data into a
|
|
||||||
mdu_bitmap_file_t instead of mdu_array_info_t.
|
|
||||||
|
|
||||||
Fixes: ("8382f19 Add new mode: --incremental")
|
|
||||||
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
Incremental.c | 14 ++++++--------
|
|
||||||
1 file changed, 6 insertions(+), 8 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Incremental.c b/Incremental.c
|
|
||||||
index 1f12c77..802e525 100644
|
|
||||||
--- a/Incremental.c
|
|
||||||
+++ b/Incremental.c
|
|
||||||
@@ -1345,7 +1345,6 @@ int IncrementalScan(struct context *c, char *devnm)
|
|
||||||
restart:
|
|
||||||
for (me = mapl ; me ; me = me->next) {
|
|
||||||
mdu_array_info_t array;
|
|
||||||
- mdu_bitmap_file_t bmf;
|
|
||||||
struct mdinfo *sra;
|
|
||||||
int mdfd;
|
|
||||||
|
|
||||||
@@ -1405,13 +1404,12 @@ restart:
|
|
||||||
* is a hint only
|
|
||||||
*/
|
|
||||||
int added = -1;
|
|
||||||
- if (ioctl(mdfd, GET_ARRAY_INFO, &bmf) < 0) {
|
|
||||||
- int bmfd = open(mddev->bitmap_file, O_RDWR);
|
|
||||||
- if (bmfd >= 0) {
|
|
||||||
- added = ioctl(mdfd, SET_BITMAP_FILE,
|
|
||||||
- bmfd);
|
|
||||||
- close(bmfd);
|
|
||||||
- }
|
|
||||||
+ int bmfd;
|
|
||||||
+
|
|
||||||
+ bmfd = open(mddev->bitmap_file, O_RDWR);
|
|
||||||
+ if (bmfd >= 0) {
|
|
||||||
+ added = ioctl(mdfd, SET_BITMAP_FILE, bmfd);
|
|
||||||
+ close(bmfd);
|
|
||||||
}
|
|
||||||
if (c->verbose >= 0) {
|
|
||||||
if (added == 0)
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
@ -1,273 +0,0 @@
|
|||||||
From d97572f5a59ca1ddde9971a79d47c9ea4db5891b Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Date: Wed, 29 Mar 2017 15:23:50 -0400
|
|
||||||
Subject: [PATCH] util: Introduce md_get_disk_info()
|
|
||||||
Git-commit: d97572f5a59ca1ddde9971a79d47c9ea4db5891b
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
This removes all the inline ioctl calls for GET_DISK_INFO, allowing us
|
|
||||||
to switch to sysfs in one place, and improves type checking.
|
|
||||||
|
|
||||||
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
Detail.c | 8 +++-----
|
|
||||||
Grow.c | 14 +++++++-------
|
|
||||||
Manage.c | 19 +++++++++----------
|
|
||||||
Monitor.c | 2 +-
|
|
||||||
Query.c | 2 +-
|
|
||||||
mdadm.h | 1 +
|
|
||||||
util.c | 10 +++++++++-
|
|
||||||
7 files changed, 31 insertions(+), 25 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Detail.c b/Detail.c
|
|
||||||
index d7e886a..fa6d4c7 100644
|
|
||||||
--- a/Detail.c
|
|
||||||
+++ b/Detail.c
|
|
||||||
@@ -51,10 +51,8 @@ static int add_device(const char *dev, char ***p_devices,
|
|
||||||
int Detail(char *dev, struct context *c)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
- * Print out details for an md array by using
|
|
||||||
- * GET_ARRAY_INFO and GET_DISK_INFO ioctl calls
|
|
||||||
+ * Print out details for an md array
|
|
||||||
*/
|
|
||||||
-
|
|
||||||
int fd = open(dev, O_RDONLY);
|
|
||||||
int vers;
|
|
||||||
mdu_array_info_t array;
|
|
||||||
@@ -165,7 +163,7 @@ int Detail(char *dev, struct context *c)
|
|
||||||
disk = subdev->disk;
|
|
||||||
else {
|
|
||||||
disk.number = d;
|
|
||||||
- if (ioctl(fd, GET_DISK_INFO, &disk) < 0)
|
|
||||||
+ if (md_get_disk_info(fd, &disk) < 0)
|
|
||||||
continue;
|
|
||||||
if (d >= array.raid_disks &&
|
|
||||||
disk.major == 0 &&
|
|
||||||
@@ -322,7 +320,7 @@ int Detail(char *dev, struct context *c)
|
|
||||||
} else for (d = 0; d < max_disks; d++) {
|
|
||||||
mdu_disk_info_t disk;
|
|
||||||
disk.number = d;
|
|
||||||
- if (ioctl(fd, GET_DISK_INFO, &disk) < 0) {
|
|
||||||
+ if (md_get_disk_info(fd, &disk) < 0) {
|
|
||||||
if (d < array.raid_disks)
|
|
||||||
pr_err("cannot get device detail for device %d: %s\n",
|
|
||||||
d, strerror(errno));
|
|
||||||
diff --git a/Grow.c b/Grow.c
|
|
||||||
index 4eab5cc..1c90902 100755
|
|
||||||
--- a/Grow.c
|
|
||||||
+++ b/Grow.c
|
|
||||||
@@ -161,7 +161,7 @@ int Grow_Add_device(char *devname, int fd, char *newdev)
|
|
||||||
st->ss->free_super(st);
|
|
||||||
|
|
||||||
disk.number = d;
|
|
||||||
- if (ioctl(fd, GET_DISK_INFO, &disk) < 0) {
|
|
||||||
+ if (md_get_disk_info(fd, &disk) < 0) {
|
|
||||||
pr_err("cannot get device detail for device %d\n",
|
|
||||||
d);
|
|
||||||
close(nfd);
|
|
||||||
@@ -232,7 +232,7 @@ int Grow_Add_device(char *devname, int fd, char *newdev)
|
|
||||||
char *dv;
|
|
||||||
|
|
||||||
disk.number = d;
|
|
||||||
- if (ioctl(fd, GET_DISK_INFO, &disk) < 0) {
|
|
||||||
+ if (md_get_disk_info(fd, &disk) < 0) {
|
|
||||||
pr_err("cannot get device detail for device %d\n",
|
|
||||||
d);
|
|
||||||
return 1;
|
|
||||||
@@ -422,7 +422,7 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s)
|
|
||||||
int fd2;
|
|
||||||
|
|
||||||
disk.number = d;
|
|
||||||
- if (ioctl(fd, GET_DISK_INFO, &disk) < 0)
|
|
||||||
+ if (md_get_disk_info(fd, &disk) < 0)
|
|
||||||
continue;
|
|
||||||
if (disk.major == 0 && disk.minor == 0)
|
|
||||||
continue;
|
|
||||||
@@ -483,7 +483,7 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s)
|
|
||||||
char *dv;
|
|
||||||
int fd2;
|
|
||||||
disk.number = d;
|
|
||||||
- if (ioctl(fd, GET_DISK_INFO, &disk) < 0)
|
|
||||||
+ if (md_get_disk_info(fd, &disk) < 0)
|
|
||||||
continue;
|
|
||||||
if ((disk.major==0 && disk.minor == 0) ||
|
|
||||||
(disk.state & (1 << MD_DISK_REMOVED)))
|
|
||||||
@@ -2908,7 +2908,7 @@ static int impose_level(int fd, int level, char *devname, int verbose)
|
|
||||||
d++) {
|
|
||||||
mdu_disk_info_t disk;
|
|
||||||
disk.number = d;
|
|
||||||
- if (ioctl(fd, GET_DISK_INFO, &disk) < 0)
|
|
||||||
+ if (md_get_disk_info(fd, &disk) < 0)
|
|
||||||
continue;
|
|
||||||
if (disk.major == 0 && disk.minor == 0)
|
|
||||||
continue;
|
|
||||||
@@ -2927,7 +2927,7 @@ static int impose_level(int fd, int level, char *devname, int verbose)
|
|
||||||
d++) {
|
|
||||||
mdu_disk_info_t disk;
|
|
||||||
disk.number = d;
|
|
||||||
- if (ioctl(fd, GET_DISK_INFO, &disk) < 0)
|
|
||||||
+ if (md_get_disk_info(fd, &disk) < 0)
|
|
||||||
continue;
|
|
||||||
if (disk.major == 0 && disk.minor == 0)
|
|
||||||
continue;
|
|
||||||
@@ -5011,7 +5011,7 @@ int Grow_continue_command(char *devname, int fd,
|
|
||||||
char *dv;
|
|
||||||
int err;
|
|
||||||
disk.number = d;
|
|
||||||
- if (ioctl(fd, GET_DISK_INFO, &disk) < 0)
|
|
||||||
+ if (md_get_disk_info(fd, &disk) < 0)
|
|
||||||
continue;
|
|
||||||
if (disk.major == 0 && disk.minor == 0)
|
|
||||||
continue;
|
|
||||||
diff --git a/Manage.c b/Manage.c
|
|
||||||
index 24ed370..0ffb6c6 100644
|
|
||||||
--- a/Manage.c
|
|
||||||
+++ b/Manage.c
|
|
||||||
@@ -546,7 +546,7 @@ static void add_faulty(struct mddev_dev *dv, int fd, char disp)
|
|
||||||
for (i = 0; i < MAX_DISKS && remaining_disks > 0; i++) {
|
|
||||||
char buf[40];
|
|
||||||
disk.number = i;
|
|
||||||
- if (ioctl(fd, GET_DISK_INFO, &disk) != 0)
|
|
||||||
+ if (md_get_disk_info(fd, &disk) != 0)
|
|
||||||
continue;
|
|
||||||
if (disk.major == 0 && disk.minor == 0)
|
|
||||||
continue;
|
|
||||||
@@ -573,7 +573,7 @@ static void add_detached(struct mddev_dev *dv, int fd, char disp)
|
|
||||||
char buf[40];
|
|
||||||
int sfd;
|
|
||||||
disk.number = i;
|
|
||||||
- if (ioctl(fd, GET_DISK_INFO, &disk) != 0)
|
|
||||||
+ if (md_get_disk_info(fd, &disk) != 0)
|
|
||||||
continue;
|
|
||||||
if (disk.major == 0 && disk.minor == 0)
|
|
||||||
continue;
|
|
||||||
@@ -615,7 +615,7 @@ static void add_set(struct mddev_dev *dv, int fd, char set_char)
|
|
||||||
for (i = 0; i < MAX_DISKS && remaining_disks > 0; i++) {
|
|
||||||
char buf[40];
|
|
||||||
disk.number = i;
|
|
||||||
- if (ioctl(fd, GET_DISK_INFO, &disk) != 0)
|
|
||||||
+ if (md_get_disk_info(fd, &disk) != 0)
|
|
||||||
continue;
|
|
||||||
if (disk.major == 0 && disk.minor == 0)
|
|
||||||
continue;
|
|
||||||
@@ -661,9 +661,8 @@ int attempt_re_add(int fd, int tfd, struct mddev_dev *dv,
|
|
||||||
get_linux_version() <= 2006018)
|
|
||||||
goto skip_re_add;
|
|
||||||
disc.number = mdi.disk.number;
|
|
||||||
- if (ioctl(fd, GET_DISK_INFO, &disc) != 0
|
|
||||||
- || disc.major != 0 || disc.minor != 0
|
|
||||||
- )
|
|
||||||
+ if (md_get_disk_info(fd, &disc) != 0 ||
|
|
||||||
+ disc.major != 0 || disc.minor != 0)
|
|
||||||
goto skip_re_add;
|
|
||||||
disc.major = major(rdev);
|
|
||||||
disc.minor = minor(rdev);
|
|
||||||
@@ -805,7 +804,7 @@ int Manage_add(int fd, int tfd, struct mddev_dev *dv,
|
|
||||||
char *dev;
|
|
||||||
int dfd;
|
|
||||||
disc.number = j;
|
|
||||||
- if (ioctl(fd, GET_DISK_INFO, &disc))
|
|
||||||
+ if (md_get_disk_info(fd, &disc))
|
|
||||||
continue;
|
|
||||||
if (disc.major==0 && disc.minor==0)
|
|
||||||
continue;
|
|
||||||
@@ -888,7 +887,7 @@ int Manage_add(int fd, int tfd, struct mddev_dev *dv,
|
|
||||||
|
|
||||||
for (d = 0; d < MAX_DISKS && found < array->nr_disks; d++) {
|
|
||||||
disc.number = d;
|
|
||||||
- if (ioctl(fd, GET_DISK_INFO, &disc))
|
|
||||||
+ if (md_get_disk_info(fd, &disc))
|
|
||||||
continue;
|
|
||||||
if (disc.major == 0 && disc.minor == 0)
|
|
||||||
continue;
|
|
||||||
@@ -929,7 +928,7 @@ int Manage_add(int fd, int tfd, struct mddev_dev *dv,
|
|
||||||
*/
|
|
||||||
for (j = array->raid_disks; j < tst->max_devs; j++) {
|
|
||||||
disc.number = j;
|
|
||||||
- if (ioctl(fd, GET_DISK_INFO, &disc))
|
|
||||||
+ if (md_get_disk_info(fd, &disc))
|
|
||||||
break;
|
|
||||||
if (disc.major==0 && disc.minor==0)
|
|
||||||
break;
|
|
||||||
@@ -994,7 +993,7 @@ int Manage_add(int fd, int tfd, struct mddev_dev *dv,
|
|
||||||
for (j = 0; j < tst->max_devs; j++) {
|
|
||||||
mdu_disk_info_t disc2;
|
|
||||||
disc2.number = j;
|
|
||||||
- if (ioctl(fd, GET_DISK_INFO, &disc2))
|
|
||||||
+ if (md_get_disk_info(fd, &disc2))
|
|
||||||
continue;
|
|
||||||
if (disc2.major==0 && disc2.minor==0)
|
|
||||||
continue;
|
|
||||||
diff --git a/Monitor.c b/Monitor.c
|
|
||||||
index 0a0a1e2..2c0f717 100644
|
|
||||||
--- a/Monitor.c
|
|
||||||
+++ b/Monitor.c
|
|
||||||
@@ -608,7 +608,7 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
|
|
||||||
i++) {
|
|
||||||
mdu_disk_info_t disc;
|
|
||||||
disc.number = i;
|
|
||||||
- if (ioctl(fd, GET_DISK_INFO, &disc) >= 0) {
|
|
||||||
+ if (md_get_disk_info(fd, &disc) >= 0) {
|
|
||||||
info[i].state = disc.state;
|
|
||||||
info[i].major = disc.major;
|
|
||||||
info[i].minor = disc.minor;
|
|
||||||
diff --git a/Query.c b/Query.c
|
|
||||||
index cae75d1..a2c839c 100644
|
|
||||||
--- a/Query.c
|
|
||||||
+++ b/Query.c
|
|
||||||
@@ -102,7 +102,7 @@ int Query(char *dev)
|
|
||||||
if (mddev && (fd = open(mddev, O_RDONLY))>=0) {
|
|
||||||
if (md_get_version(fd) >= 9000 &&
|
|
||||||
md_get_array_info(fd, &array) >= 0) {
|
|
||||||
- if (ioctl(fd, GET_DISK_INFO, &disc) >= 0 &&
|
|
||||||
+ if (md_get_disk_info(fd, &disc) >= 0 &&
|
|
||||||
makedev((unsigned)disc.major,(unsigned)disc.minor) == stb.st_rdev)
|
|
||||||
activity = "active";
|
|
||||||
else
|
|
||||||
diff --git a/mdadm.h b/mdadm.h
|
|
||||||
index 7770585..3ab548f 100644
|
|
||||||
--- a/mdadm.h
|
|
||||||
+++ b/mdadm.h
|
|
||||||
@@ -1406,6 +1406,7 @@ extern int Restore_metadata(char *dev, char *dir, struct context *c,
|
|
||||||
|
|
||||||
extern int md_get_version(int fd);
|
|
||||||
int md_get_array_info(int fd, struct mdu_array_info_s *array);
|
|
||||||
+int md_get_disk_info(int fd, struct mdu_disk_info_s *disk);
|
|
||||||
extern int get_linux_version(void);
|
|
||||||
extern int mdadm_version(char *version);
|
|
||||||
extern unsigned long long parse_size(char *size);
|
|
||||||
diff --git a/util.c b/util.c
|
|
||||||
index 725877d..aa27e59 100644
|
|
||||||
--- a/util.c
|
|
||||||
+++ b/util.c
|
|
||||||
@@ -221,6 +221,14 @@ int md_get_array_info(int fd, struct mdu_array_info_s *array)
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
+ * Get disk info from the kernel.
|
|
||||||
+ */
|
|
||||||
+int md_get_disk_info(int fd, struct mdu_disk_info_s *disk)
|
|
||||||
+{
|
|
||||||
+ return ioctl(fd, GET_DISK_INFO, disk);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/*
|
|
||||||
* Parse a 128 bit uuid in 4 integers
|
|
||||||
* format is 32 hexx nibbles with options :.<space> separator
|
|
||||||
* If not exactly 32 hex digits are found, return 0
|
|
||||||
@@ -553,7 +561,7 @@ int enough_fd(int fd)
|
|
||||||
avail = xcalloc(array.raid_disks, 1);
|
|
||||||
for (i = 0; i < MAX_DISKS && array.nr_disks > 0; i++) {
|
|
||||||
disk.number = i;
|
|
||||||
- if (ioctl(fd, GET_DISK_INFO, &disk) != 0)
|
|
||||||
+ if (md_get_disk_info(fd, &disk) != 0)
|
|
||||||
continue;
|
|
||||||
if (disk.major == 0 && disk.minor == 0)
|
|
||||||
continue;
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
@ -1,158 +0,0 @@
|
|||||||
From 018a488238e2ff55d7c2fd29333c1f7305354318 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Date: Wed, 29 Mar 2017 15:43:53 -0400
|
|
||||||
Subject: [PATCH] util: Introduce md_set_array_info()
|
|
||||||
Git-commit: 018a488238e2ff55d7c2fd29333c1f7305354318
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
Switch from using ioctl(SET_ARRAY_INFO) to using md_set_array_info()
|
|
||||||
|
|
||||||
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
Build.c | 4 ++--
|
|
||||||
Grow.c | 17 ++++++++---------
|
|
||||||
mdadm.h | 1 +
|
|
||||||
util.c | 12 ++++++++++--
|
|
||||||
4 files changed, 21 insertions(+), 13 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Build.c b/Build.c
|
|
||||||
index a5fcc06..691dd6f 100644
|
|
||||||
--- a/Build.c
|
|
||||||
+++ b/Build.c
|
|
||||||
@@ -148,8 +148,8 @@ int Build(char *mddev, struct mddev_dev *devlist,
|
|
||||||
s->chunk = 64;
|
|
||||||
array.chunk_size = s->chunk*1024;
|
|
||||||
array.layout = s->layout;
|
|
||||||
- if (ioctl(mdfd, SET_ARRAY_INFO, &array)) {
|
|
||||||
- pr_err("SET_ARRAY_INFO failed for %s: %s\n",
|
|
||||||
+ if (md_set_array_info(mdfd, &array)) {
|
|
||||||
+ pr_err("md_set_array_info() failed for %s: %s\n",
|
|
||||||
mddev, strerror(errno));
|
|
||||||
goto abort;
|
|
||||||
}
|
|
||||||
diff --git a/Grow.c b/Grow.c
|
|
||||||
index 1c90902..af8d520 100755
|
|
||||||
--- a/Grow.c
|
|
||||||
+++ b/Grow.c
|
|
||||||
@@ -335,7 +335,7 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s)
|
|
||||||
if (array.state & (1 << MD_SB_BITMAP_PRESENT)) {
|
|
||||||
if (strcmp(s->bitmap_file, "none")==0) {
|
|
||||||
array.state &= ~(1 << MD_SB_BITMAP_PRESENT);
|
|
||||||
- if (ioctl(fd, SET_ARRAY_INFO, &array) != 0) {
|
|
||||||
+ if (md_set_array_info(fd, &array) != 0) {
|
|
||||||
if (array.state & (1 << MD_SB_CLUSTERED))
|
|
||||||
pr_err("failed to remove clustered bitmap.\n");
|
|
||||||
else
|
|
||||||
@@ -463,7 +463,7 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s)
|
|
||||||
if (strcmp(s->bitmap_file, "clustered") == 0)
|
|
||||||
array.state |= (1 << MD_SB_CLUSTERED);
|
|
||||||
array.state |= (1 << MD_SB_BITMAP_PRESENT);
|
|
||||||
- rv = ioctl(fd, SET_ARRAY_INFO, &array);
|
|
||||||
+ rv = md_set_array_info(fd, &array);
|
|
||||||
}
|
|
||||||
if (rv < 0) {
|
|
||||||
if (errno == EBUSY)
|
|
||||||
@@ -1823,7 +1823,7 @@ int Grow_reshape(char *devname, int fd,
|
|
||||||
(array.state & (1<<MD_SB_BITMAP_PRESENT)) &&
|
|
||||||
!(array.state & (1<<MD_SB_CLUSTERED))) {
|
|
||||||
array.state &= ~(1<<MD_SB_BITMAP_PRESENT);
|
|
||||||
- if (ioctl(fd, SET_ARRAY_INFO, &array)!= 0) {
|
|
||||||
+ if (md_set_array_info(fd, &array)!= 0) {
|
|
||||||
pr_err("failed to remove internal bitmap.\n");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
@@ -2056,7 +2056,7 @@ int Grow_reshape(char *devname, int fd,
|
|
||||||
else
|
|
||||||
rv = -1;
|
|
||||||
} else {
|
|
||||||
- rv = ioctl(fd, SET_ARRAY_INFO, &array);
|
|
||||||
+ rv = md_set_array_info(fd, &array);
|
|
||||||
|
|
||||||
/* manage array size when it is managed externally
|
|
||||||
*/
|
|
||||||
@@ -2272,7 +2272,7 @@ size_change_error:
|
|
||||||
goto release;
|
|
||||||
}
|
|
||||||
array.layout = info.new_layout;
|
|
||||||
- if (ioctl(fd, SET_ARRAY_INFO, &array) != 0) {
|
|
||||||
+ if (md_set_array_info(fd, &array) != 0) {
|
|
||||||
pr_err("failed to set new layout\n");
|
|
||||||
rv = 1;
|
|
||||||
} else if (c->verbose >= 0)
|
|
||||||
@@ -2836,8 +2836,7 @@ static int impose_reshape(struct mdinfo *sra,
|
|
||||||
st->ss->external == 0) {
|
|
||||||
/* use SET_ARRAY_INFO but only if reshape hasn't started */
|
|
||||||
array.raid_disks = reshape->after.data_disks + reshape->parity;
|
|
||||||
- if (!restart &&
|
|
||||||
- ioctl(fd, SET_ARRAY_INFO, &array) != 0) {
|
|
||||||
+ if (!restart && md_set_array_info(fd, &array) != 0) {
|
|
||||||
int err = errno;
|
|
||||||
|
|
||||||
pr_err("Cannot set device shape for %s: %s\n",
|
|
||||||
@@ -3239,7 +3238,7 @@ static int reshape_array(char *container, int fd, char *devname,
|
|
||||||
if (info->new_layout != UnSet &&
|
|
||||||
info->new_layout != array.layout) {
|
|
||||||
array.layout = info->new_layout;
|
|
||||||
- if (ioctl(fd, SET_ARRAY_INFO, &array) != 0) {
|
|
||||||
+ if (md_set_array_info(fd, &array) != 0) {
|
|
||||||
pr_err("failed to set new layout\n");
|
|
||||||
goto release;
|
|
||||||
} else if (verbose >= 0)
|
|
||||||
@@ -3250,7 +3249,7 @@ static int reshape_array(char *container, int fd, char *devname,
|
|
||||||
info->delta_disks != 0 &&
|
|
||||||
array.raid_disks != (info->array.raid_disks + info->delta_disks)) {
|
|
||||||
array.raid_disks += info->delta_disks;
|
|
||||||
- if (ioctl(fd, SET_ARRAY_INFO, &array) != 0) {
|
|
||||||
+ if (md_set_array_info(fd, &array) != 0) {
|
|
||||||
pr_err("failed to set raid disks\n");
|
|
||||||
goto release;
|
|
||||||
} else if (verbose >= 0) {
|
|
||||||
diff --git a/mdadm.h b/mdadm.h
|
|
||||||
index 3ab548f..084bc97 100644
|
|
||||||
--- a/mdadm.h
|
|
||||||
+++ b/mdadm.h
|
|
||||||
@@ -1406,6 +1406,7 @@ extern int Restore_metadata(char *dev, char *dir, struct context *c,
|
|
||||||
|
|
||||||
extern int md_get_version(int fd);
|
|
||||||
int md_get_array_info(int fd, struct mdu_array_info_s *array);
|
|
||||||
+int md_set_array_info(int fd, struct mdu_array_info_s *array);
|
|
||||||
int md_get_disk_info(int fd, struct mdu_disk_info_s *disk);
|
|
||||||
extern int get_linux_version(void);
|
|
||||||
extern int mdadm_version(char *version);
|
|
||||||
diff --git a/util.c b/util.c
|
|
||||||
index aa27e59..9fc7ba0 100644
|
|
||||||
--- a/util.c
|
|
||||||
+++ b/util.c
|
|
||||||
@@ -221,6 +221,14 @@ int md_get_array_info(int fd, struct mdu_array_info_s *array)
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
+ * Set array info
|
|
||||||
+ */
|
|
||||||
+int md_set_array_info(int fd, struct mdu_array_info_s *array)
|
|
||||||
+{
|
|
||||||
+ return ioctl(fd, SET_ARRAY_INFO, array);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/*
|
|
||||||
* Get disk info from the kernel.
|
|
||||||
*/
|
|
||||||
int md_get_disk_info(int fd, struct mdu_disk_info_s *disk)
|
|
||||||
@@ -1858,9 +1866,9 @@ int set_array_info(int mdfd, struct supertype *st, struct mdinfo *info)
|
|
||||||
memset(&inf, 0, sizeof(inf));
|
|
||||||
inf.major_version = info->array.major_version;
|
|
||||||
inf.minor_version = info->array.minor_version;
|
|
||||||
- rv = ioctl(mdfd, SET_ARRAY_INFO, &inf);
|
|
||||||
+ rv = md_set_array_info(mdfd, &inf);
|
|
||||||
} else
|
|
||||||
- rv = ioctl(mdfd, SET_ARRAY_INFO, NULL);
|
|
||||||
+ rv = md_set_array_info(mdfd, NULL);
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
|||||||
From b0ba6a1dee995b3cd7331b4df92d115e51d8ac0c Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Date: Wed, 29 Mar 2017 15:48:24 -0400
|
|
||||||
Subject: [PATCH] md_u: Remove some unused ioctl declarations
|
|
||||||
Git-commit: b0ba6a1dee995b3cd7331b4df92d115e51d8ac0c
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
These were no longer used in the code, so get rid of them.
|
|
||||||
|
|
||||||
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
md_u.h | 6 ------
|
|
||||||
1 file changed, 6 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/md_u.h b/md_u.h
|
|
||||||
index f570a34..d59aa2d 100644
|
|
||||||
--- a/md_u.h
|
|
||||||
+++ b/md_u.h
|
|
||||||
@@ -21,19 +21,13 @@
|
|
||||||
#define RAID_VERSION _IOR (MD_MAJOR, 0x10, mdu_version_t)
|
|
||||||
#define GET_ARRAY_INFO _IOR (MD_MAJOR, 0x11, mdu_array_info_t)
|
|
||||||
#define GET_DISK_INFO _IOR (MD_MAJOR, 0x12, mdu_disk_info_t)
|
|
||||||
-#define PRINT_RAID_DEBUG _IO (MD_MAJOR, 0x13)
|
|
||||||
#define RAID_AUTORUN _IO (MD_MAJOR, 0x14)
|
|
||||||
#define GET_BITMAP_FILE _IOR (MD_MAJOR, 0x15, mdu_bitmap_file_t)
|
|
||||||
|
|
||||||
/* configuration */
|
|
||||||
-#define CLEAR_ARRAY _IO (MD_MAJOR, 0x20)
|
|
||||||
#define ADD_NEW_DISK _IOW (MD_MAJOR, 0x21, mdu_disk_info_t)
|
|
||||||
#define HOT_REMOVE_DISK _IO (MD_MAJOR, 0x22)
|
|
||||||
#define SET_ARRAY_INFO _IOW (MD_MAJOR, 0x23, mdu_array_info_t)
|
|
||||||
-#define SET_DISK_INFO _IO (MD_MAJOR, 0x24)
|
|
||||||
-#define WRITE_RAID_INFO _IO (MD_MAJOR, 0x25)
|
|
||||||
-#define UNPROTECT_ARRAY _IO (MD_MAJOR, 0x26)
|
|
||||||
-#define PROTECT_ARRAY _IO (MD_MAJOR, 0x27)
|
|
||||||
#define HOT_ADD_DISK _IO (MD_MAJOR, 0x28)
|
|
||||||
#define SET_DISK_FAULTY _IO (MD_MAJOR, 0x29)
|
|
||||||
#define SET_BITMAP_FILE _IOW (MD_MAJOR, 0x2b, int)
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
@ -1,42 +0,0 @@
|
|||||||
From 5b2846684ef5172eccc432e3520b79efbc2abba5 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Zhilong Liu <zlliu@suse.com>
|
|
||||||
Date: Thu, 30 Mar 2017 15:38:08 +0800
|
|
||||||
Subject: [PATCH] mdadm/grow: reshape would be stuck from raid1 to raid5
|
|
||||||
Git-commit: 5b2846684ef5172eccc432e3520b79efbc2abba5
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
systemctl doesn't interpret mdadm-grow-continue@.service
|
|
||||||
correctly due to the wrong argument provided in [service],
|
|
||||||
it should be corrected %I as %i. Otherwise, if the service
|
|
||||||
cannot start by systemctl and the reshap progress would be
|
|
||||||
stuck all time when grows array from raid1 to raid5.
|
|
||||||
|
|
||||||
reproduce steps:
|
|
||||||
./mdadm -CR /dev/md0 -l1 -b internal -n2 /dev/loop[0-1]
|
|
||||||
./mdadm --grow /dev/md0 -l5 -n3 -a /dev/loop2
|
|
||||||
|
|
||||||
Signed-off-by: Zhilong Liu <zlliu@suse.com>
|
|
||||||
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
systemd/mdadm-grow-continue@.service | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/systemd/mdadm-grow-continue@.service b/systemd/mdadm-grow-continue@.service
|
|
||||||
index 5c667d2..882bc0b 100644
|
|
||||||
--- a/systemd/mdadm-grow-continue@.service
|
|
||||||
+++ b/systemd/mdadm-grow-continue@.service
|
|
||||||
@@ -10,7 +10,7 @@ Description=Manage MD Reshape on /dev/%I
|
|
||||||
DefaultDependencies=no
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
-ExecStart=BINDIR/mdadm --grow --continue /dev/%I
|
|
||||||
+ExecStart=BINDIR/mdadm --grow --continue /dev/%i
|
|
||||||
StandardInput=null
|
|
||||||
StandardOutput=null
|
|
||||||
StandardError=null
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
@ -1,56 +0,0 @@
|
|||||||
From 67a02d520085b01a1b9e6ea59fb30e79c5649c9c Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Date: Thu, 30 Mar 2017 16:02:36 -0400
|
|
||||||
Subject: [PATCH] sysfs: Use the presence of /sys/block/<dev>/md as indicator
|
|
||||||
of valid device
|
|
||||||
Git-commit: 67a02d520085b01a1b9e6ea59fb30e79c5649c9c
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
Rather than calling ioctl(RAID_VERSION), use the presence of
|
|
||||||
/sys/block/<dev>/md as indicator of the device being valid and sysfs
|
|
||||||
being active for it. The ioctl could return valid data, but sysfs
|
|
||||||
not mounted, which renders sysfs_init() useless anyway.
|
|
||||||
|
|
||||||
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
sysfs.c | 17 ++++++++++++-----
|
|
||||||
1 file changed, 12 insertions(+), 5 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sysfs.c b/sysfs.c
|
|
||||||
index 2a91ba0..93ec3de 100644
|
|
||||||
--- a/sysfs.c
|
|
||||||
+++ b/sysfs.c
|
|
||||||
@@ -86,15 +86,22 @@ void sysfs_init_dev(struct mdinfo *mdi, unsigned long devid)
|
|
||||||
|
|
||||||
void sysfs_init(struct mdinfo *mdi, int fd, char *devnm)
|
|
||||||
{
|
|
||||||
+ struct stat stb;
|
|
||||||
+ char fname[MAX_SYSFS_PATH_LEN];
|
|
||||||
+
|
|
||||||
mdi->sys_name[0] = 0;
|
|
||||||
- if (fd >= 0) {
|
|
||||||
- mdu_version_t vers;
|
|
||||||
- if (ioctl(fd, RAID_VERSION, &vers) != 0)
|
|
||||||
- return;
|
|
||||||
+ if (fd >= 0)
|
|
||||||
devnm = fd2devnm(fd);
|
|
||||||
- }
|
|
||||||
+
|
|
||||||
if (devnm == NULL)
|
|
||||||
return;
|
|
||||||
+
|
|
||||||
+ snprintf(fname, MAX_SYSFS_PATH_LEN, "/sys/block/%s/md", devnm);
|
|
||||||
+
|
|
||||||
+ if (stat(fname, &stb))
|
|
||||||
+ return;
|
|
||||||
+ if (!S_ISDIR(stb.st_mode))
|
|
||||||
+ return;
|
|
||||||
strcpy(mdi->sys_name, devnm);
|
|
||||||
}
|
|
||||||
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
@ -1,336 +0,0 @@
|
|||||||
From dae131379f9fd82e2867aed25a3ff719f957e9a3 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Date: Thu, 30 Mar 2017 16:52:37 -0400
|
|
||||||
Subject: [PATCH] sysfs: Make sysfs_init() return an error code
|
|
||||||
Git-commit: dae131379f9fd82e2867aed25a3ff719f957e9a3
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
Rather than have the caller inspect the returned content, return an
|
|
||||||
error code from sysfs_init(). In addition make all callers actually
|
|
||||||
check it.
|
|
||||||
|
|
||||||
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
Assemble.c | 12 ++++++++++--
|
|
||||||
Create.c | 10 ++++++++--
|
|
||||||
Grow.c | 39 +++++++++++++++++++++++++++++++++------
|
|
||||||
Incremental.c | 12 ++++++++++--
|
|
||||||
Manage.c | 7 +++++--
|
|
||||||
Monitor.c | 4 +++-
|
|
||||||
mdadm.c | 11 ++++++++---
|
|
||||||
mdadm.h | 2 +-
|
|
||||||
sysfs.c | 16 ++++++++++------
|
|
||||||
9 files changed, 88 insertions(+), 25 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Assemble.c b/Assemble.c
|
|
||||||
index 6a6a56b..672cd12 100644
|
|
||||||
--- a/Assemble.c
|
|
||||||
+++ b/Assemble.c
|
|
||||||
@@ -1670,7 +1670,12 @@ try_again:
|
|
||||||
}
|
|
||||||
st->ss->getinfo_super(st, content, NULL);
|
|
||||||
#ifndef MDASSEMBLE
|
|
||||||
- sysfs_init(content, mdfd, NULL);
|
|
||||||
+ if (sysfs_init(content, mdfd, NULL)) {
|
|
||||||
+ pr_err("Unable to initialize sysfs\n");
|
|
||||||
+ close(mdfd);
|
|
||||||
+ free(devices);
|
|
||||||
+ return 1;
|
|
||||||
+ }
|
|
||||||
#endif
|
|
||||||
/* after reload context, store journal_clean in context */
|
|
||||||
content->journal_clean = journal_clean;
|
|
||||||
@@ -1885,7 +1890,10 @@ int assemble_container_content(struct supertype *st, int mdfd,
|
|
||||||
char *avail;
|
|
||||||
int err;
|
|
||||||
|
|
||||||
- sysfs_init(content, mdfd, NULL);
|
|
||||||
+ if (sysfs_init(content, mdfd, NULL)) {
|
|
||||||
+ pr_err("Unable to initialize sysfs\n");
|
|
||||||
+ return 1;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
sra = sysfs_read(mdfd, NULL, GET_VERSION|GET_DEVS);
|
|
||||||
if (sra == NULL || strcmp(sra->text_version, content->text_version) != 0) {
|
|
||||||
diff --git a/Create.c b/Create.c
|
|
||||||
index 0e0778f..32987af 100644
|
|
||||||
--- a/Create.c
|
|
||||||
+++ b/Create.c
|
|
||||||
@@ -737,7 +737,10 @@ int Create(struct supertype *st, char *mddev,
|
|
||||||
|
|
||||||
total_slots = info.array.nr_disks;
|
|
||||||
st->ss->getinfo_super(st, &info, NULL);
|
|
||||||
- sysfs_init(&info, mdfd, NULL);
|
|
||||||
+ if (sysfs_init(&info, mdfd, NULL)) {
|
|
||||||
+ pr_err("unable to initialize sysfs\n");
|
|
||||||
+ goto abort_locked;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
if (did_default && c->verbose >= 0) {
|
|
||||||
if (is_subarray(info.text_version)) {
|
|
||||||
@@ -794,7 +797,10 @@ int Create(struct supertype *st, char *mddev,
|
|
||||||
s->bitmap_file = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
- sysfs_init(&info, mdfd, NULL);
|
|
||||||
+ if (sysfs_init(&info, mdfd, NULL)) {
|
|
||||||
+ pr_err("unable to initialize sysfs\n");
|
|
||||||
+ goto abort_locked;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
if (st->ss->external && st->container_devnm[0]) {
|
|
||||||
/* member */
|
|
||||||
diff --git a/Grow.c b/Grow.c
|
|
||||||
index 0c16d5b..78a3474 100755
|
|
||||||
--- a/Grow.c
|
|
||||||
+++ b/Grow.c
|
|
||||||
@@ -455,7 +455,10 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s)
|
|
||||||
}
|
|
||||||
if (offset_setable) {
|
|
||||||
st->ss->getinfo_super(st, mdi, NULL);
|
|
||||||
- sysfs_init(mdi, fd, NULL);
|
|
||||||
+ if (sysfs_init(mdi, fd, NULL)) {
|
|
||||||
+ pr_err("failed to intialize sysfs.\n");
|
|
||||||
+ free(mdi);
|
|
||||||
+ }
|
|
||||||
rv = sysfs_set_num_signed(mdi, NULL, "bitmap/location",
|
|
||||||
mdi->bitmap_offset);
|
|
||||||
free(mdi);
|
|
||||||
@@ -2149,7 +2152,11 @@ size_change_error:
|
|
||||||
|
|
||||||
memset(&info, 0, sizeof(info));
|
|
||||||
info.array = array;
|
|
||||||
- sysfs_init(&info, fd, NULL);
|
|
||||||
+ if (sysfs_init(&info, fd, NULL)) {
|
|
||||||
+ pr_err("failed to intialize sysfs.\n");
|
|
||||||
+ rv = 1;
|
|
||||||
+ goto release;
|
|
||||||
+ }
|
|
||||||
strcpy(info.text_version, sra->text_version);
|
|
||||||
info.component_size = s->size*2;
|
|
||||||
info.new_level = s->level;
|
|
||||||
@@ -2870,7 +2877,11 @@ static int impose_level(int fd, int level, char *devname, int verbose)
|
|
||||||
char *c;
|
|
||||||
struct mdu_array_info_s array;
|
|
||||||
struct mdinfo info;
|
|
||||||
- sysfs_init(&info, fd, NULL);
|
|
||||||
+
|
|
||||||
+ if (sysfs_init(&info, fd, NULL)) {
|
|
||||||
+ pr_err("failed to intialize sysfs.\n");
|
|
||||||
+ return 1;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
md_get_array_info(fd, &array);
|
|
||||||
if (level == 0 &&
|
|
||||||
@@ -3178,7 +3189,12 @@ static int reshape_array(char *container, int fd, char *devname,
|
|
||||||
struct mdinfo *d;
|
|
||||||
|
|
||||||
if (info2) {
|
|
||||||
- sysfs_init(info2, fd, st->devnm);
|
|
||||||
+ if (sysfs_init(info2, fd, st->devnm)) {
|
|
||||||
+ pr_err("unable to initialize sysfs for %s",
|
|
||||||
+ st->devnm);
|
|
||||||
+ free(info2);
|
|
||||||
+ goto release;
|
|
||||||
+ }
|
|
||||||
/* When increasing number of devices, we need to set
|
|
||||||
* new raid_disks before adding these, or they might
|
|
||||||
* be rejected.
|
|
||||||
@@ -3777,7 +3793,12 @@ int reshape_container(char *container, char *devname,
|
|
||||||
}
|
|
||||||
strcpy(last_devnm, mdstat->devnm);
|
|
||||||
|
|
||||||
- sysfs_init(content, fd, mdstat->devnm);
|
|
||||||
+ if (sysfs_init(content, fd, mdstat->devnm)) {
|
|
||||||
+ pr_err("Unable to initialize sysfs for %s\n",
|
|
||||||
+ mdstat->devnm);
|
|
||||||
+ rv = 1;
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
if (mdmon_running(container))
|
|
||||||
flush_mdmon(container);
|
|
||||||
@@ -5110,7 +5131,13 @@ int Grow_continue_command(char *devname, int fd,
|
|
||||||
goto Grow_continue_command_exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
- sysfs_init(content, fd2, mdstat->devnm);
|
|
||||||
+ if (sysfs_init(content, fd2, mdstat->devnm)) {
|
|
||||||
+ pr_err("Unable to initialize sysfs for %s, Grow cannot continue",
|
|
||||||
+ mdstat->devnm);
|
|
||||||
+ ret_val = 1;
|
|
||||||
+ close(fd2);
|
|
||||||
+ goto Grow_continue_command_exit;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
close(fd2);
|
|
||||||
|
|
||||||
diff --git a/Incremental.c b/Incremental.c
|
|
||||||
index 802e525..28f1f77 100644
|
|
||||||
--- a/Incremental.c
|
|
||||||
+++ b/Incremental.c
|
|
||||||
@@ -326,7 +326,12 @@ int Incremental(struct mddev_dev *devlist, struct context *c,
|
|
||||||
if (mdfd < 0)
|
|
||||||
goto out_unlock;
|
|
||||||
|
|
||||||
- sysfs_init(&info, mdfd, NULL);
|
|
||||||
+ if (sysfs_init(&info, mdfd, NULL)) {
|
|
||||||
+ pr_err("unable to initialize sysfs for %s\n",
|
|
||||||
+ chosen_name);
|
|
||||||
+ rv = 2;
|
|
||||||
+ goto out_unlock;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
if (set_array_info(mdfd, st, &info) != 0) {
|
|
||||||
pr_err("failed to set array info for %s: %s\n",
|
|
||||||
@@ -1734,7 +1739,10 @@ int IncrementalRemove(char *devname, char *id_path, int verbose)
|
|
||||||
pr_err("%s does not appear to be a component of any array\n", devname);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
- sysfs_init(&mdi, -1, ent->devnm);
|
|
||||||
+ if (sysfs_init(&mdi, -1, ent->devnm)) {
|
|
||||||
+ pr_err("unable to initialize sysfs for: %s\n", devname);
|
|
||||||
+ return 1;
|
|
||||||
+ }
|
|
||||||
mdfd = open_dev_excl(ent->devnm);
|
|
||||||
if (mdfd > 0) {
|
|
||||||
close(mdfd);
|
|
||||||
diff --git a/Manage.c b/Manage.c
|
|
||||||
index 0ffb6c6..618c98b 100644
|
|
||||||
--- a/Manage.c
|
|
||||||
+++ b/Manage.c
|
|
||||||
@@ -1382,12 +1382,15 @@ int Manage_subdevs(char *devname, int fd,
|
|
||||||
int busy = 0;
|
|
||||||
int raid_slot = -1;
|
|
||||||
|
|
||||||
+ if (sysfs_init(&info, fd, NULL)) {
|
|
||||||
+ pr_err("sysfs not availabile for %s\n", devname);
|
|
||||||
+ goto abort;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
if (md_get_array_info(fd, &array)) {
|
|
||||||
pr_err("Cannot get array info for %s\n", devname);
|
|
||||||
goto abort;
|
|
||||||
}
|
|
||||||
- sysfs_init(&info, fd, NULL);
|
|
||||||
-
|
|
||||||
/* array.size is only 32 bits and may be truncated.
|
|
||||||
* So read from sysfs if possible, and record number of sectors
|
|
||||||
*/
|
|
||||||
diff --git a/Monitor.c b/Monitor.c
|
|
||||||
index 2c0f717..036a561 100644
|
|
||||||
--- a/Monitor.c
|
|
||||||
+++ b/Monitor.c
|
|
||||||
@@ -1026,7 +1026,9 @@ int Wait(char *dev)
|
|
||||||
*/
|
|
||||||
struct mdinfo mdi;
|
|
||||||
char buf[21];
|
|
||||||
- sysfs_init(&mdi, -1, devnm);
|
|
||||||
+
|
|
||||||
+ if (sysfs_init(&mdi, -1, devnm))
|
|
||||||
+ return 2;
|
|
||||||
if (sysfs_get_str(&mdi, NULL, "sync_action",
|
|
||||||
buf, 20) > 0 &&
|
|
||||||
strcmp(buf,"idle\n") != 0) {
|
|
||||||
diff --git a/mdadm.c b/mdadm.c
|
|
||||||
index d6b5437..3fe17fc 100644
|
|
||||||
--- a/mdadm.c
|
|
||||||
+++ b/mdadm.c
|
|
||||||
@@ -1631,7 +1631,10 @@ int main(int argc, char *argv[])
|
|
||||||
rv = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
- sysfs_init(&sra, mdfd, NULL);
|
|
||||||
+ if (sysfs_init(&sra, mdfd, NULL)) {
|
|
||||||
+ rv = 1;
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
if (array_size == MAX_SIZE)
|
|
||||||
err = sysfs_set_str(&sra, NULL, "array_size", "default");
|
|
||||||
else
|
|
||||||
@@ -1998,13 +2001,15 @@ int SetAction(char *dev, char *action)
|
|
||||||
{
|
|
||||||
int fd = open(dev, O_RDONLY);
|
|
||||||
struct mdinfo mdi;
|
|
||||||
+ int retval;
|
|
||||||
+
|
|
||||||
if (fd < 0) {
|
|
||||||
pr_err("Couldn't open %s: %s\n", dev, strerror(errno));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
- sysfs_init(&mdi, fd, NULL);
|
|
||||||
+ retval = sysfs_init(&mdi, fd, NULL);
|
|
||||||
close(fd);
|
|
||||||
- if (!mdi.sys_name[0]) {
|
|
||||||
+ if (retval) {
|
|
||||||
pr_err("%s is no an md array\n", dev);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
diff --git a/mdadm.h b/mdadm.h
|
|
||||||
index 084bc97..612bd86 100644
|
|
||||||
--- a/mdadm.h
|
|
||||||
+++ b/mdadm.h
|
|
||||||
@@ -639,7 +639,7 @@ enum sysfs_read_flags {
|
|
||||||
* else use devnm.
|
|
||||||
*/
|
|
||||||
extern int sysfs_open(char *devnm, char *devname, char *attr);
|
|
||||||
-extern void sysfs_init(struct mdinfo *mdi, int fd, char *devnm);
|
|
||||||
+extern int sysfs_init(struct mdinfo *mdi, int fd, char *devnm);
|
|
||||||
extern void sysfs_init_dev(struct mdinfo *mdi, unsigned long devid);
|
|
||||||
extern void sysfs_free(struct mdinfo *sra);
|
|
||||||
extern struct mdinfo *sysfs_read(int fd, char *devnm, unsigned long options);
|
|
||||||
diff --git a/sysfs.c b/sysfs.c
|
|
||||||
index 93ec3de..51deb23 100644
|
|
||||||
--- a/sysfs.c
|
|
||||||
+++ b/sysfs.c
|
|
||||||
@@ -84,25 +84,30 @@ void sysfs_init_dev(struct mdinfo *mdi, unsigned long devid)
|
|
||||||
sizeof(mdi->sys_name), "dev-%s", devid2kname(devid));
|
|
||||||
}
|
|
||||||
|
|
||||||
-void sysfs_init(struct mdinfo *mdi, int fd, char *devnm)
|
|
||||||
+int sysfs_init(struct mdinfo *mdi, int fd, char *devnm)
|
|
||||||
{
|
|
||||||
struct stat stb;
|
|
||||||
char fname[MAX_SYSFS_PATH_LEN];
|
|
||||||
+ int retval = -ENODEV;
|
|
||||||
|
|
||||||
mdi->sys_name[0] = 0;
|
|
||||||
if (fd >= 0)
|
|
||||||
devnm = fd2devnm(fd);
|
|
||||||
|
|
||||||
if (devnm == NULL)
|
|
||||||
- return;
|
|
||||||
+ goto out;
|
|
||||||
|
|
||||||
snprintf(fname, MAX_SYSFS_PATH_LEN, "/sys/block/%s/md", devnm);
|
|
||||||
|
|
||||||
if (stat(fname, &stb))
|
|
||||||
- return;
|
|
||||||
+ goto out;
|
|
||||||
if (!S_ISDIR(stb.st_mode))
|
|
||||||
- return;
|
|
||||||
+ goto out;
|
|
||||||
strcpy(mdi->sys_name, devnm);
|
|
||||||
+
|
|
||||||
+ retval = 0;
|
|
||||||
+out:
|
|
||||||
+ return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct mdinfo *sysfs_read(int fd, char *devnm, unsigned long options)
|
|
||||||
@@ -117,8 +122,7 @@ struct mdinfo *sysfs_read(int fd, char *devnm, unsigned long options)
|
|
||||||
struct dirent *de;
|
|
||||||
|
|
||||||
sra = xcalloc(1, sizeof(*sra));
|
|
||||||
- sysfs_init(sra, fd, devnm);
|
|
||||||
- if (sra->sys_name[0] == 0) {
|
|
||||||
+ if (sysfs_init(sra, fd, devnm)) {
|
|
||||||
free(sra);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
@ -1,42 +0,0 @@
|
|||||||
From f5c924f441cedce2a13c48b12be35250560ee575 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Date: Wed, 5 Apr 2017 14:01:30 -0400
|
|
||||||
Subject: [PATCH] util/must_be_container: Use sysfs_read(GET_VERSION) to
|
|
||||||
determine valid array
|
|
||||||
Git-commit: f5c924f441cedce2a13c48b12be35250560ee575
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
Use sysfs_read() instead of ioctl(RAID_VERSION) to determine this is
|
|
||||||
in fact a valid raid array fd.
|
|
||||||
|
|
||||||
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
util.c | 7 ++++++-
|
|
||||||
1 file changed, 6 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/util.c b/util.c
|
|
||||||
index 9fc7ba0..56daee3 100644
|
|
||||||
--- a/util.c
|
|
||||||
+++ b/util.c
|
|
||||||
@@ -1376,9 +1376,14 @@ int get_dev_sector_size(int fd, char *dname, unsigned int *sectsizep)
|
|
||||||
*/
|
|
||||||
int must_be_container(int fd)
|
|
||||||
{
|
|
||||||
+ struct mdinfo *mdi;
|
|
||||||
unsigned long long size;
|
|
||||||
- if (md_get_version(fd) < 0)
|
|
||||||
+
|
|
||||||
+ mdi = sysfs_read(fd, NULL, GET_VERSION);
|
|
||||||
+ if (!mdi)
|
|
||||||
return 0;
|
|
||||||
+ sysfs_free(mdi);
|
|
||||||
+
|
|
||||||
if (get_dev_size(fd, NULL, &size) == 0)
|
|
||||||
return 1;
|
|
||||||
if (size == 0)
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
@ -1,57 +0,0 @@
|
|||||||
From 700483a22340f2f25a761acd08e6db87e92d90e9 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Date: Wed, 5 Apr 2017 15:06:24 -0400
|
|
||||||
Subject: [PATCH] util/set_array_info: Simplify code since md_get_version
|
|
||||||
returns a constant
|
|
||||||
Git-commit: 700483a22340f2f25a761acd08e6db87e92d90e9
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
md_get_version() always returns (0 * 1000) + (90 * 100) + 3, so no
|
|
||||||
point in calling it.
|
|
||||||
|
|
||||||
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
util.c | 19 ++++++++-----------
|
|
||||||
1 file changed, 8 insertions(+), 11 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/util.c b/util.c
|
|
||||||
index 56daee3..afeb6a5 100644
|
|
||||||
--- a/util.c
|
|
||||||
+++ b/util.c
|
|
||||||
@@ -1858,22 +1858,19 @@ int set_array_info(int mdfd, struct supertype *st, struct mdinfo *info)
|
|
||||||
* This varies between externally managed arrays
|
|
||||||
* and older kernels
|
|
||||||
*/
|
|
||||||
- int vers = md_get_version(mdfd);
|
|
||||||
+ mdu_array_info_t inf;
|
|
||||||
int rv;
|
|
||||||
|
|
||||||
#ifndef MDASSEMBLE
|
|
||||||
if (st->ss->external)
|
|
||||||
- rv = sysfs_set_array(info, vers);
|
|
||||||
- else
|
|
||||||
+ return sysfs_set_array(info, 9003);
|
|
||||||
#endif
|
|
||||||
- if ((vers % 100) >= 1) { /* can use different versions */
|
|
||||||
- mdu_array_info_t inf;
|
|
||||||
- memset(&inf, 0, sizeof(inf));
|
|
||||||
- inf.major_version = info->array.major_version;
|
|
||||||
- inf.minor_version = info->array.minor_version;
|
|
||||||
- rv = md_set_array_info(mdfd, &inf);
|
|
||||||
- } else
|
|
||||||
- rv = md_set_array_info(mdfd, NULL);
|
|
||||||
+
|
|
||||||
+ memset(&inf, 0, sizeof(inf));
|
|
||||||
+ inf.major_version = info->array.major_version;
|
|
||||||
+ inf.minor_version = info->array.minor_version;
|
|
||||||
+ rv = md_set_array_info(mdfd, &inf);
|
|
||||||
+
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
|||||||
From 6142741d144824c31b733f9d6e6e240b159effc0 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Date: Wed, 5 Apr 2017 15:09:18 -0400
|
|
||||||
Subject: [PATCH] Assemble/Assemble: Stop checking kernel md driver version
|
|
||||||
Git-commit: 6142741d144824c31b733f9d6e6e240b159effc0
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
Any kernel released during the last decade will return 9003 from
|
|
||||||
md_get_version() so no point in checking that.
|
|
||||||
|
|
||||||
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
Assemble.c | 3 +--
|
|
||||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Assemble.c b/Assemble.c
|
|
||||||
index 672cd12..fa5fdbe 100644
|
|
||||||
--- a/Assemble.c
|
|
||||||
+++ b/Assemble.c
|
|
||||||
@@ -1477,8 +1477,7 @@ try_again:
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
mddev = chosen_name;
|
|
||||||
- if (get_linux_version() < 2004000 ||
|
|
||||||
- md_get_version(mdfd) < 9000) {
|
|
||||||
+ if (get_linux_version() < 2004000) {
|
|
||||||
pr_err("Assemble requires Linux 2.4 or later, and\n"
|
|
||||||
" md driver version 0.90.0 or later.\n"
|
|
||||||
" Upgrade your kernel or try --build\n");
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
@ -1,271 +0,0 @@
|
|||||||
From e6e5f8f1267de4f310415231b3434fce2d25f02a Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Date: Wed, 5 Apr 2017 15:20:52 -0400
|
|
||||||
Subject: [PATCH] Build: Stop bothering about supporting md driver older than
|
|
||||||
0.90.00
|
|
||||||
Git-commit: e6e5f8f1267de4f310415231b3434fce2d25f02a
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
The kernel has been stuck at md driver version 0.90.03 for at least a
|
|
||||||
decade. No point in continuing to support the older API.
|
|
||||||
|
|
||||||
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
Build.c | 187 ++++++++++++++++++++++++----------------------------------------
|
|
||||||
1 file changed, 69 insertions(+), 118 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Build.c b/Build.c
|
|
||||||
index 691dd6f..11ba12f 100644
|
|
||||||
--- a/Build.c
|
|
||||||
+++ b/Build.c
|
|
||||||
@@ -39,13 +39,8 @@ int Build(char *mddev, struct mddev_dev *devlist,
|
|
||||||
* geometry is 0xpp00cc
|
|
||||||
* where pp is personality: 1==linear, 2=raid0
|
|
||||||
* cc = chunk size factor: 0==4k, 1==8k etc.
|
|
||||||
- *
|
|
||||||
- * For md_version >= 0.90.0 we call
|
|
||||||
- * SET_ARRAY_INFO, ADD_NEW_DISK, RUN_ARRAY
|
|
||||||
- *
|
|
||||||
*/
|
|
||||||
int i;
|
|
||||||
- int vers;
|
|
||||||
struct stat stb;
|
|
||||||
int subdevs = 0, missing_disks = 0;
|
|
||||||
struct mddev_dev *dv;
|
|
||||||
@@ -55,6 +50,8 @@ int Build(char *mddev, struct mddev_dev *devlist,
|
|
||||||
char chosen_name[1024];
|
|
||||||
int uuid[4] = {0,0,0,0};
|
|
||||||
struct map_ent *map = NULL;
|
|
||||||
+ mdu_array_info_t array;
|
|
||||||
+ mdu_param_t param; /* not used by syscall */
|
|
||||||
|
|
||||||
if (s->level == UnSet) {
|
|
||||||
pr_err("a RAID level is needed to Build an array.\n");
|
|
||||||
@@ -122,39 +119,30 @@ int Build(char *mddev, struct mddev_dev *devlist,
|
|
||||||
map_update(&map, fd2devnm(mdfd), "none", uuid, chosen_name);
|
|
||||||
map_unlock(&map);
|
|
||||||
|
|
||||||
- vers = md_get_version(mdfd);
|
|
||||||
-
|
|
||||||
- /* looks Ok, go for it */
|
|
||||||
- if (vers >= 9000) {
|
|
||||||
- mdu_array_info_t array;
|
|
||||||
- array.level = s->level;
|
|
||||||
- if (s->size == MAX_SIZE)
|
|
||||||
- s->size = 0;
|
|
||||||
- array.size = s->size;
|
|
||||||
- array.nr_disks = s->raiddisks;
|
|
||||||
- array.raid_disks = s->raiddisks;
|
|
||||||
- array.md_minor = 0;
|
|
||||||
- if (fstat(mdfd, &stb)==0)
|
|
||||||
- array.md_minor = minor(stb.st_rdev);
|
|
||||||
- array.not_persistent = 1;
|
|
||||||
- array.state = 0; /* not clean, but no errors */
|
|
||||||
- if (s->assume_clean)
|
|
||||||
- array.state |= 1;
|
|
||||||
- array.active_disks = s->raiddisks - missing_disks;
|
|
||||||
- array.working_disks = s->raiddisks - missing_disks;
|
|
||||||
- array.spare_disks = 0;
|
|
||||||
- array.failed_disks = missing_disks;
|
|
||||||
- if (s->chunk == 0 && (s->level==0 || s->level==LEVEL_LINEAR))
|
|
||||||
- s->chunk = 64;
|
|
||||||
- array.chunk_size = s->chunk*1024;
|
|
||||||
- array.layout = s->layout;
|
|
||||||
- if (md_set_array_info(mdfd, &array)) {
|
|
||||||
- pr_err("md_set_array_info() failed for %s: %s\n",
|
|
||||||
- mddev, strerror(errno));
|
|
||||||
- goto abort;
|
|
||||||
- }
|
|
||||||
- } else if (s->bitmap_file) {
|
|
||||||
- pr_err("bitmaps not supported with this kernel\n");
|
|
||||||
+ array.level = s->level;
|
|
||||||
+ if (s->size == MAX_SIZE)
|
|
||||||
+ s->size = 0;
|
|
||||||
+ array.size = s->size;
|
|
||||||
+ array.nr_disks = s->raiddisks;
|
|
||||||
+ array.raid_disks = s->raiddisks;
|
|
||||||
+ array.md_minor = 0;
|
|
||||||
+ if (fstat(mdfd, &stb) == 0)
|
|
||||||
+ array.md_minor = minor(stb.st_rdev);
|
|
||||||
+ array.not_persistent = 1;
|
|
||||||
+ array.state = 0; /* not clean, but no errors */
|
|
||||||
+ if (s->assume_clean)
|
|
||||||
+ array.state |= 1;
|
|
||||||
+ array.active_disks = s->raiddisks - missing_disks;
|
|
||||||
+ array.working_disks = s->raiddisks - missing_disks;
|
|
||||||
+ array.spare_disks = 0;
|
|
||||||
+ array.failed_disks = missing_disks;
|
|
||||||
+ if (s->chunk == 0 && (s->level==0 || s->level==LEVEL_LINEAR))
|
|
||||||
+ s->chunk = 64;
|
|
||||||
+ array.chunk_size = s->chunk*1024;
|
|
||||||
+ array.layout = s->layout;
|
|
||||||
+ if (md_set_array_info(mdfd, &array)) {
|
|
||||||
+ pr_err("md_set_array_info() failed for %s: %s\n",
|
|
||||||
+ mddev, strerror(errno));
|
|
||||||
goto abort;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -167,8 +155,10 @@ int Build(char *mddev, struct mddev_dev *devlist,
|
|
||||||
}
|
|
||||||
/* now add the devices */
|
|
||||||
for ((i=0), (dv = devlist) ; dv ; i++, dv=dv->next) {
|
|
||||||
+ mdu_disk_info_t disk;
|
|
||||||
unsigned long long dsize;
|
|
||||||
int fd;
|
|
||||||
+
|
|
||||||
if (strcmp("missing", dv->devname) == 0)
|
|
||||||
continue;
|
|
||||||
if (stat(dv->devname, &stb)) {
|
|
||||||
@@ -191,94 +181,58 @@ int Build(char *mddev, struct mddev_dev *devlist,
|
|
||||||
(s->size == 0 || s->size == MAX_SIZE || dsize < s->size))
|
|
||||||
s->size = dsize;
|
|
||||||
close(fd);
|
|
||||||
- if (vers >= 9000) {
|
|
||||||
- mdu_disk_info_t disk;
|
|
||||||
- disk.number = i;
|
|
||||||
- disk.raid_disk = i;
|
|
||||||
- disk.state = (1<<MD_DISK_SYNC) | (1<<MD_DISK_ACTIVE);
|
|
||||||
- if (dv->writemostly == FlagSet)
|
|
||||||
- disk.state |= 1<<MD_DISK_WRITEMOSTLY;
|
|
||||||
- disk.major = major(stb.st_rdev);
|
|
||||||
- disk.minor = minor(stb.st_rdev);
|
|
||||||
- if (ioctl(mdfd, ADD_NEW_DISK, &disk)) {
|
|
||||||
- pr_err("ADD_NEW_DISK failed for %s: %s\n",
|
|
||||||
- dv->devname, strerror(errno));
|
|
||||||
- goto abort;
|
|
||||||
- }
|
|
||||||
- } else {
|
|
||||||
- if (ioctl(mdfd, REGISTER_DEV, &stb.st_rdev)) {
|
|
||||||
- pr_err("REGISTER_DEV failed for %s: %s.\n",
|
|
||||||
- dv->devname, strerror(errno));
|
|
||||||
- goto abort;
|
|
||||||
- }
|
|
||||||
+ disk.number = i;
|
|
||||||
+ disk.raid_disk = i;
|
|
||||||
+ disk.state = (1<<MD_DISK_SYNC) | (1<<MD_DISK_ACTIVE);
|
|
||||||
+ if (dv->writemostly == FlagSet)
|
|
||||||
+ disk.state |= 1<<MD_DISK_WRITEMOSTLY;
|
|
||||||
+ disk.major = major(stb.st_rdev);
|
|
||||||
+ disk.minor = minor(stb.st_rdev);
|
|
||||||
+ if (ioctl(mdfd, ADD_NEW_DISK, &disk)) {
|
|
||||||
+ pr_err("ADD_NEW_DISK failed for %s: %s\n",
|
|
||||||
+ dv->devname, strerror(errno));
|
|
||||||
+ goto abort;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* now to start it */
|
|
||||||
- if (vers >= 9000) {
|
|
||||||
- mdu_param_t param; /* not used by syscall */
|
|
||||||
- if (s->bitmap_file) {
|
|
||||||
- bitmap_fd = open(s->bitmap_file, O_RDWR);
|
|
||||||
- if (bitmap_fd < 0) {
|
|
||||||
- int major = BITMAP_MAJOR_HI;
|
|
||||||
+ if (s->bitmap_file) {
|
|
||||||
+ bitmap_fd = open(s->bitmap_file, O_RDWR);
|
|
||||||
+ if (bitmap_fd < 0) {
|
|
||||||
+ int major = BITMAP_MAJOR_HI;
|
|
||||||
#if 0
|
|
||||||
- if (s->bitmap_chunk == UnSet) {
|
|
||||||
- pr_err("%s cannot be openned.",
|
|
||||||
- s->bitmap_file);
|
|
||||||
- goto abort;
|
|
||||||
- }
|
|
||||||
-#endif
|
|
||||||
- if (vers < 9003) {
|
|
||||||
- major = BITMAP_MAJOR_HOSTENDIAN;
|
|
||||||
-#ifdef __BIG_ENDIAN
|
|
||||||
- pr_err("Warning - bitmaps created on this kernel are not portable\n"
|
|
||||||
- " between different architectures. Consider upgrading the Linux kernel.\n");
|
|
||||||
+ if (s->bitmap_chunk == UnSet) {
|
|
||||||
+ pr_err("%s cannot be openned.", s->bitmap_file);
|
|
||||||
+ goto abort;
|
|
||||||
+ }
|
|
||||||
#endif
|
|
||||||
- }
|
|
||||||
- bitmapsize = s->size>>9; /* FIXME wrong for RAID10 */
|
|
||||||
- if (CreateBitmap(s->bitmap_file, 1, NULL, s->bitmap_chunk,
|
|
||||||
- c->delay, s->write_behind, bitmapsize, major)) {
|
|
||||||
- goto abort;
|
|
||||||
- }
|
|
||||||
- bitmap_fd = open(s->bitmap_file, O_RDWR);
|
|
||||||
- if (bitmap_fd < 0) {
|
|
||||||
- pr_err("%s cannot be openned.",
|
|
||||||
- s->bitmap_file);
|
|
||||||
- goto abort;
|
|
||||||
- }
|
|
||||||
+ bitmapsize = s->size >> 9; /* FIXME wrong for RAID10 */
|
|
||||||
+ if (CreateBitmap(s->bitmap_file, 1, NULL,
|
|
||||||
+ s->bitmap_chunk, c->delay,
|
|
||||||
+ s->write_behind, bitmapsize, major)) {
|
|
||||||
+ goto abort;
|
|
||||||
}
|
|
||||||
- if (bitmap_fd >= 0) {
|
|
||||||
- if (ioctl(mdfd, SET_BITMAP_FILE, bitmap_fd) < 0) {
|
|
||||||
- pr_err("Cannot set bitmap file for %s: %s\n",
|
|
||||||
- mddev, strerror(errno));
|
|
||||||
- goto abort;
|
|
||||||
- }
|
|
||||||
+ bitmap_fd = open(s->bitmap_file, O_RDWR);
|
|
||||||
+ if (bitmap_fd < 0) {
|
|
||||||
+ pr_err("%s cannot be openned.", s->bitmap_file);
|
|
||||||
+ goto abort;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
- if (ioctl(mdfd, RUN_ARRAY, ¶m)) {
|
|
||||||
- pr_err("RUN_ARRAY failed: %s\n",
|
|
||||||
- strerror(errno));
|
|
||||||
- if (s->chunk & (s->chunk-1)) {
|
|
||||||
- cont_err("Problem may be that chunk size is not a power of 2\n");
|
|
||||||
+ if (bitmap_fd >= 0) {
|
|
||||||
+ if (ioctl(mdfd, SET_BITMAP_FILE, bitmap_fd) < 0) {
|
|
||||||
+ pr_err("Cannot set bitmap file for %s: %s\n",
|
|
||||||
+ mddev, strerror(errno));
|
|
||||||
+ goto abort;
|
|
||||||
}
|
|
||||||
- goto abort;
|
|
||||||
- }
|
|
||||||
- } else {
|
|
||||||
- unsigned long arg;
|
|
||||||
- arg=0;
|
|
||||||
- while (s->chunk > 4096) {
|
|
||||||
- arg++;
|
|
||||||
- s->chunk >>= 1;
|
|
||||||
}
|
|
||||||
- if (s->level == 0)
|
|
||||||
- arg |= 0x20000;
|
|
||||||
- else
|
|
||||||
- arg |= 0x10000;
|
|
||||||
- if (ioctl(mdfd, START_MD, arg)) {
|
|
||||||
- pr_err("START_MD failed: %s\n",
|
|
||||||
- strerror(errno));
|
|
||||||
- goto abort;
|
|
||||||
+ }
|
|
||||||
+ if (ioctl(mdfd, RUN_ARRAY, ¶m)) {
|
|
||||||
+ pr_err("RUN_ARRAY failed: %s\n", strerror(errno));
|
|
||||||
+ if (s->chunk & (s->chunk - 1)) {
|
|
||||||
+ cont_err("Problem may be that chunk size is not a power of 2\n");
|
|
||||||
}
|
|
||||||
+ goto abort;
|
|
||||||
}
|
|
||||||
+
|
|
||||||
if (c->verbose >= 0)
|
|
||||||
pr_err("array %s built and started.\n",
|
|
||||||
mddev);
|
|
||||||
@@ -287,10 +241,7 @@ int Build(char *mddev, struct mddev_dev *devlist,
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
abort:
|
|
||||||
- if (vers >= 9000)
|
|
||||||
- ioctl(mdfd, STOP_ARRAY, 0);
|
|
||||||
- else
|
|
||||||
- ioctl(mdfd, STOP_MD, 0);
|
|
||||||
+ ioctl(mdfd, STOP_ARRAY, 0);
|
|
||||||
close(mdfd);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
@ -1,40 +0,0 @@
|
|||||||
From 6ae8b2b3140475b1a70485052454210aba4065a6 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Date: Wed, 5 Apr 2017 15:22:36 -0400
|
|
||||||
Subject: [PATCH] Grow: Stop bothering about md driver versions older than
|
|
||||||
0.90.00
|
|
||||||
Git-commit: 6ae8b2b3140475b1a70485052454210aba4065a6
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
Grow.c | 7 -------
|
|
||||||
1 file changed, 7 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Grow.c b/Grow.c
|
|
||||||
index 78a3474..15f4ed1 100755
|
|
||||||
--- a/Grow.c
|
|
||||||
+++ b/Grow.c
|
|
||||||
@@ -288,16 +288,9 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s)
|
|
||||||
struct supertype *st;
|
|
||||||
char *subarray = NULL;
|
|
||||||
int major = BITMAP_MAJOR_HI;
|
|
||||||
- int vers = md_get_version(fd);
|
|
||||||
unsigned long long bitmapsize, array_size;
|
|
||||||
struct mdinfo *mdi;
|
|
||||||
|
|
||||||
- if (vers < 9003) {
|
|
||||||
- major = BITMAP_MAJOR_HOSTENDIAN;
|
|
||||||
- pr_err("Warning - bitmaps created on this kernel are not portable\n"
|
|
||||||
- " between different architectures. Consider upgrading the Linux kernel.\n");
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
/*
|
|
||||||
* We only ever get called if s->bitmap_file is != NULL, so this check
|
|
||||||
* is just here to quiet down static code checkers.
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
@ -1,82 +0,0 @@
|
|||||||
From 901d5ee6da145033ac30fee68f4fec0e8af9eddc Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Date: Wed, 5 Apr 2017 15:26:53 -0400
|
|
||||||
Subject: [PATCH] Detail: Stop bothering about md drivers older than 0.90.00
|
|
||||||
Git-commit: 901d5ee6da145033ac30fee68f4fec0e8af9eddc
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
Remove further handling of md driver version older than 0.90.00
|
|
||||||
|
|
||||||
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
Detail.c | 27 +++++++--------------------
|
|
||||||
1 file changed, 7 insertions(+), 20 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Detail.c b/Detail.c
|
|
||||||
index fa6d4c7..d4e6204 100644
|
|
||||||
--- a/Detail.c
|
|
||||||
+++ b/Detail.c
|
|
||||||
@@ -54,7 +54,6 @@ int Detail(char *dev, struct context *c)
|
|
||||||
* Print out details for an md array
|
|
||||||
*/
|
|
||||||
int fd = open(dev, O_RDONLY);
|
|
||||||
- int vers;
|
|
||||||
mdu_array_info_t array;
|
|
||||||
mdu_disk_info_t *disks;
|
|
||||||
int next;
|
|
||||||
@@ -88,22 +87,14 @@ int Detail(char *dev, struct context *c)
|
|
||||||
dev, strerror(errno));
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
- vers = md_get_version(fd);
|
|
||||||
- if (vers < 0) {
|
|
||||||
- pr_err("%s does not appear to be an md device\n",
|
|
||||||
- dev);
|
|
||||||
- close(fd);
|
|
||||||
- return rv;
|
|
||||||
- }
|
|
||||||
- if (vers < 9000) {
|
|
||||||
- pr_err("cannot get detail for md device %s: driver version too old.\n",
|
|
||||||
- dev);
|
|
||||||
+ sra = sysfs_read(fd, NULL, GET_VERSION|GET_DEVS);
|
|
||||||
+ if (!sra) {
|
|
||||||
+ pr_err("%s does not appear to be an md device\n", dev);
|
|
||||||
close(fd);
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
- sra = sysfs_read(fd, NULL, GET_VERSION|GET_DEVS);
|
|
||||||
- external = (sra != NULL && sra->array.major_version == -1
|
|
||||||
- && sra->array.minor_version == -2);
|
|
||||||
+ external = (sra != NULL && sra->array.major_version == -1 &&
|
|
||||||
+ sra->array.minor_version == -2);
|
|
||||||
st = super_by_fd(fd, &subarray);
|
|
||||||
if (md_get_array_info(fd, &array) == 0) {
|
|
||||||
inactive = 0;
|
|
||||||
@@ -378,9 +369,7 @@ int Detail(char *dev, struct context *c)
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Only try GET_BITMAP_FILE for 0.90.01 and later */
|
|
||||||
- if (vers >= 9001 &&
|
|
||||||
- ioctl(fd, GET_BITMAP_FILE, &bmf) == 0 &&
|
|
||||||
- bmf.pathname[0]) {
|
|
||||||
+ if (ioctl(fd, GET_BITMAP_FILE, &bmf) == 0 && bmf.pathname[0]) {
|
|
||||||
printf(" bitmap=%s", bmf.pathname);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
@@ -449,9 +438,7 @@ int Detail(char *dev, struct context *c)
|
|
||||||
array.not_persistent?"not ":"");
|
|
||||||
printf("\n");
|
|
||||||
/* Only try GET_BITMAP_FILE for 0.90.01 and later */
|
|
||||||
- if (vers >= 9001 &&
|
|
||||||
- ioctl(fd, GET_BITMAP_FILE, &bmf) == 0 &&
|
|
||||||
- bmf.pathname[0]) {
|
|
||||||
+ if (ioctl(fd, GET_BITMAP_FILE, &bmf) == 0 && bmf.pathname[0]) {
|
|
||||||
printf(" Intent Bitmap : %s\n", bmf.pathname);
|
|
||||||
printf("\n");
|
|
||||||
} else if (array.state & (1<<MD_SB_BITMAP_PRESENT))
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
@ -1,93 +0,0 @@
|
|||||||
From 5f4cc2392689528a9234fae1935cd442f7917738 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Date: Wed, 5 Apr 2017 15:32:40 -0400
|
|
||||||
Subject: [PATCH] Create: Remove all attemps to handle md driver older than
|
|
||||||
0.90.03
|
|
||||||
Git-commit: 5f4cc2392689528a9234fae1935cd442f7917738
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
More legacy code moved to the bit-bucket.
|
|
||||||
|
|
||||||
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
Create.c | 30 +++++-------------------------
|
|
||||||
1 file changed, 5 insertions(+), 25 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Create.c b/Create.c
|
|
||||||
index 4f98c58..6ca0924 100644
|
|
||||||
--- a/Create.c
|
|
||||||
+++ b/Create.c
|
|
||||||
@@ -97,7 +97,6 @@ int Create(struct supertype *st, char *mddev,
|
|
||||||
int insert_point = subdevs * 2; /* where to insert a missing drive */
|
|
||||||
int total_slots;
|
|
||||||
int pass;
|
|
||||||
- int vers;
|
|
||||||
int rv;
|
|
||||||
int bitmap_fd;
|
|
||||||
int have_container = 0;
|
|
||||||
@@ -112,6 +111,7 @@ int Create(struct supertype *st, char *mddev,
|
|
||||||
char chosen_name[1024];
|
|
||||||
struct map_ent *map = NULL;
|
|
||||||
unsigned long long newsize;
|
|
||||||
+ mdu_array_info_t inf;
|
|
||||||
|
|
||||||
int major_num = BITMAP_MAJOR_HI;
|
|
||||||
if (s->bitmap_file && strcmp(s->bitmap_file, "clustered") == 0) {
|
|
||||||
@@ -150,7 +150,6 @@ int Create(struct supertype *st, char *mddev,
|
|
||||||
/* If given a single device, it might be a container, and we can
|
|
||||||
* extract a device list from there
|
|
||||||
*/
|
|
||||||
- mdu_array_info_t inf;
|
|
||||||
int fd;
|
|
||||||
|
|
||||||
memset(&inf, 0, sizeof(inf));
|
|
||||||
@@ -625,18 +624,11 @@ int Create(struct supertype *st, char *mddev,
|
|
||||||
}
|
|
||||||
mddev = chosen_name;
|
|
||||||
|
|
||||||
- vers = md_get_version(mdfd);
|
|
||||||
- if (vers < 9000) {
|
|
||||||
- pr_err("Create requires md driver version 0.90.0 or later\n");
|
|
||||||
+ memset(&inf, 0, sizeof(inf));
|
|
||||||
+ md_get_array_info(mdfd, &inf);
|
|
||||||
+ if (inf.working_disks != 0) {
|
|
||||||
+ pr_err("another array by this name is already running.\n");
|
|
||||||
goto abort_locked;
|
|
||||||
- } else {
|
|
||||||
- mdu_array_info_t inf;
|
|
||||||
- memset(&inf, 0, sizeof(inf));
|
|
||||||
- md_get_array_info(mdfd, &inf);
|
|
||||||
- if (inf.working_disks != 0) {
|
|
||||||
- pr_err("another array by this name is already running.\n");
|
|
||||||
- goto abort_locked;
|
|
||||||
- }
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Ok, lets try some ioctls */
|
|
||||||
@@ -761,20 +753,8 @@ int Create(struct supertype *st, char *mddev,
|
|
||||||
* to stop another mdadm from finding and using those devices.
|
|
||||||
*/
|
|
||||||
|
|
||||||
- if (s->bitmap_file && vers < 9003) {
|
|
||||||
- major_num = BITMAP_MAJOR_HOSTENDIAN;
|
|
||||||
-#ifdef __BIG_ENDIAN
|
|
||||||
- pr_err("Warning - bitmaps created on this kernel are not portable\n"
|
|
||||||
- " between different architectured. Consider upgrading the Linux kernel.\n");
|
|
||||||
-#endif
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
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;
|
|
||||||
- }
|
|
||||||
if (!st->ss->add_internal_bitmap) {
|
|
||||||
pr_err("internal bitmaps not supported with %s metadata\n",
|
|
||||||
st->ss->name);
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
@ -1,73 +0,0 @@
|
|||||||
From 091e8e6e061a5739be68d214bbd4a25e38bec65c Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Date: Wed, 5 Apr 2017 15:34:44 -0400
|
|
||||||
Subject: [PATCH] Manage: Remove all references to md_get_version()
|
|
||||||
Git-commit: 091e8e6e061a5739be68d214bbd4a25e38bec65c
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
At this point, support for md driver prior to 0.90.03 is going to
|
|
||||||
disappear.
|
|
||||||
|
|
||||||
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
Manage.c | 20 +-------------------
|
|
||||||
1 file changed, 1 insertion(+), 19 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Manage.c b/Manage.c
|
|
||||||
index 618c98b..9e69132 100644
|
|
||||||
--- a/Manage.c
|
|
||||||
+++ b/Manage.c
|
|
||||||
@@ -46,10 +46,6 @@ int Manage_ro(char *devname, int fd, int readonly)
|
|
||||||
#endif
|
|
||||||
int rv = 0;
|
|
||||||
|
|
||||||
- if (md_get_version(fd) < 9000) {
|
|
||||||
- pr_err("need md driver version 0.90.0 or later\n");
|
|
||||||
- return 1;
|
|
||||||
- }
|
|
||||||
#ifndef MDASSEMBLE
|
|
||||||
/* If this is an externally-managed array, we need to modify the
|
|
||||||
* metadata_version so that mdmon doesn't undo our change.
|
|
||||||
@@ -176,10 +172,6 @@ int Manage_run(char *devname, int fd, struct context *c)
|
|
||||||
*/
|
|
||||||
char nm[32], *nmp;
|
|
||||||
|
|
||||||
- if (md_get_version(fd) < 9000) {
|
|
||||||
- pr_err("need md driver version 0.90.0 or later\n");
|
|
||||||
- return 1;
|
|
||||||
- }
|
|
||||||
nmp = fd2devnm(fd);
|
|
||||||
if (!nmp) {
|
|
||||||
pr_err("Cannot find %s in sysfs!!\n", devname);
|
|
||||||
@@ -207,14 +199,6 @@ int Manage_stop(char *devname, int fd, int verbose, int will_retry)
|
|
||||||
if (will_retry && verbose == 0)
|
|
||||||
verbose = -1;
|
|
||||||
|
|
||||||
- if (md_get_version(fd) < 9000) {
|
|
||||||
- if (ioctl(fd, STOP_MD, 0) == 0)
|
|
||||||
- return 0;
|
|
||||||
- pr_err("stopping device %s failed: %s\n",
|
|
||||||
- devname, strerror(errno));
|
|
||||||
- return 1;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
strcpy(devnm, fd2devnm(fd));
|
|
||||||
/* Get EXCL access first. If this fails, then attempting
|
|
||||||
* to stop is probably a bad idea.
|
|
||||||
@@ -773,9 +757,7 @@ int Manage_add(int fd, int tfd, struct mddev_dev *dv,
|
|
||||||
" Adding anyway as --force was given.\n",
|
|
||||||
dv->devname, devname);
|
|
||||||
}
|
|
||||||
- if (!tst->ss->external &&
|
|
||||||
- array->major_version == 0 &&
|
|
||||||
- md_get_version(fd)%100 < 2) {
|
|
||||||
+ if (!tst->ss->external && array->major_version == 0) {
|
|
||||||
if (ioctl(fd, HOT_ADD_DISK, rdev)==0) {
|
|
||||||
if (verbose >= 0)
|
|
||||||
pr_err("hot added %s\n",
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
@ -1,69 +0,0 @@
|
|||||||
From 5cb859962febacba3bb9257fc6ed9553ecc16752 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Date: Wed, 5 Apr 2017 15:37:38 -0400
|
|
||||||
Subject: [PATCH] Query: Remove all references to md_get_version()
|
|
||||||
Git-commit: 5cb859962febacba3bb9257fc6ed9553ecc16752
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
More legacy code removed
|
|
||||||
|
|
||||||
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
Query.c | 13 +++----------
|
|
||||||
1 file changed, 3 insertions(+), 10 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Query.c b/Query.c
|
|
||||||
index a2c839c..bea273f 100644
|
|
||||||
--- a/Query.c
|
|
||||||
+++ b/Query.c
|
|
||||||
@@ -33,7 +33,6 @@ int Query(char *dev)
|
|
||||||
* a superblock
|
|
||||||
*/
|
|
||||||
int fd = open(dev, O_RDONLY);
|
|
||||||
- int vers;
|
|
||||||
int ioctlerr;
|
|
||||||
int superror;
|
|
||||||
struct mdinfo info;
|
|
||||||
@@ -52,7 +51,6 @@ int Query(char *dev)
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
- vers = md_get_version(fd);
|
|
||||||
if (md_get_array_info(fd, &array) < 0)
|
|
||||||
ioctlerr = errno;
|
|
||||||
else
|
|
||||||
@@ -60,16 +58,12 @@ int Query(char *dev)
|
|
||||||
|
|
||||||
fstat(fd, &stb);
|
|
||||||
|
|
||||||
- if (vers>=9000 && !ioctlerr) {
|
|
||||||
+ if (!ioctlerr) {
|
|
||||||
if (!get_dev_size(fd, NULL, &larray_size))
|
|
||||||
larray_size = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (vers < 0)
|
|
||||||
- printf("%s: is not an md array\n", dev);
|
|
||||||
- else if (vers < 9000)
|
|
||||||
- printf("%s: is an md device, but kernel cannot provide details\n", dev);
|
|
||||||
- else if (ioctlerr == ENODEV)
|
|
||||||
+ if (ioctlerr == ENODEV)
|
|
||||||
printf("%s: is an md device which is not active\n", dev);
|
|
||||||
else if (ioctlerr)
|
|
||||||
printf("%s: is an md device, but gives \"%s\" when queried\n",
|
|
||||||
@@ -100,8 +94,7 @@ int Query(char *dev)
|
|
||||||
disc.number = info.disk.number;
|
|
||||||
activity = "undetected";
|
|
||||||
if (mddev && (fd = open(mddev, O_RDONLY))>=0) {
|
|
||||||
- if (md_get_version(fd) >= 9000 &&
|
|
||||||
- md_get_array_info(fd, &array) >= 0) {
|
|
||||||
+ if (md_get_array_info(fd, &array) >= 0) {
|
|
||||||
if (md_get_disk_info(fd, &disc) >= 0 &&
|
|
||||||
makedev((unsigned)disc.major,(unsigned)disc.minor) == stb.st_rdev)
|
|
||||||
activity = "active";
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
|||||||
From 5d89b18da805cb9ce2b0f726cd534bcbf4dce8c6 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Date: Wed, 5 Apr 2017 15:38:48 -0400
|
|
||||||
Subject: [PATCH] bitmap: Remove use of md_get_version()
|
|
||||||
Git-commit: 5d89b18da805cb9ce2b0f726cd534bcbf4dce8c6
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
bitmap.c | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/bitmap.c b/bitmap.c
|
|
||||||
index ccedfd3..16a6b73 100644
|
|
||||||
--- a/bitmap.c
|
|
||||||
+++ b/bitmap.c
|
|
||||||
@@ -260,7 +260,7 @@ int ExamineBitmap(char *filename, int brief, struct supertype *st)
|
|
||||||
if (!info)
|
|
||||||
return rv;
|
|
||||||
sb = &info->sb;
|
|
||||||
- if (sb->magic != BITMAP_MAGIC && md_get_version(fd) > 0) {
|
|
||||||
+ if (sb->magic != BITMAP_MAGIC) {
|
|
||||||
pr_err("This is an md array. To view a bitmap you need to examine\n");
|
|
||||||
pr_err("a member device, not the array.\n");
|
|
||||||
pr_err("Reporting bitmap that would be used if this array were used\n");
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
|||||||
From 15d924d363a2bc02aa4a489241333be3d7820978 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Date: Wed, 5 Apr 2017 15:39:51 -0400
|
|
||||||
Subject: [PATCH] mdmon: Stop bothering about md_get_version()
|
|
||||||
Git-commit: 15d924d363a2bc02aa4a489241333be3d7820978
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
If anyone has a kernel with md driver older than 0.90.03 they will
|
|
||||||
also know where to find older versions of mdadm.
|
|
||||||
|
|
||||||
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
mdmon.c | 4 ----
|
|
||||||
1 file changed, 4 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/mdmon.c b/mdmon.c
|
|
||||||
index 95e9bba..0955fcc 100644
|
|
||||||
--- a/mdmon.c
|
|
||||||
+++ b/mdmon.c
|
|
||||||
@@ -408,10 +408,6 @@ static int mdmon(char *devnm, int must_fork, int takeover)
|
|
||||||
pr_err("%s: %s\n", devnm, strerror(errno));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
- if (md_get_version(mdfd) < 0) {
|
|
||||||
- pr_err("%s: Not an md device\n", devnm);
|
|
||||||
- return 1;
|
|
||||||
- }
|
|
||||||
|
|
||||||
/* Fork, and have the child tell us when they are ready */
|
|
||||||
if (must_fork) {
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
@ -1,51 +0,0 @@
|
|||||||
From 40b054e1dc9e334621fd2081bf6fc46b01dd7ef4 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Date: Wed, 5 Apr 2017 15:44:20 -0400
|
|
||||||
Subject: [PATCH] mdopen/open_mddev: Use md_get_array_info() to determine valid
|
|
||||||
array
|
|
||||||
Git-commit: 40b054e1dc9e334621fd2081bf6fc46b01dd7ef4
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
md_get_array_info() can be used instead of md_get_version() to
|
|
||||||
determine this is in fact a valid array.
|
|
||||||
|
|
||||||
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
mdopen.c | 6 +++++-
|
|
||||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/mdopen.c b/mdopen.c
|
|
||||||
index 685ca32..fe240e5 100644
|
|
||||||
--- a/mdopen.c
|
|
||||||
+++ b/mdopen.c
|
|
||||||
@@ -416,19 +416,23 @@ int create_mddev(char *dev, char *name, int autof, int trustworthy,
|
|
||||||
*/
|
|
||||||
int open_mddev(char *dev, int report_errors)
|
|
||||||
{
|
|
||||||
+ struct mdu_array_info_s array;
|
|
||||||
int mdfd = open(dev, O_RDONLY);
|
|
||||||
+
|
|
||||||
if (mdfd < 0) {
|
|
||||||
if (report_errors)
|
|
||||||
pr_err("error opening %s: %s\n",
|
|
||||||
dev, strerror(errno));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
- if (md_get_version(mdfd) <= 0) {
|
|
||||||
+
|
|
||||||
+ if (md_get_array_info(mdfd, &array) != 0) {
|
|
||||||
close(mdfd);
|
|
||||||
if (report_errors)
|
|
||||||
pr_err("%s does not appear to be an md device\n", dev);
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
+
|
|
||||||
return mdfd;
|
|
||||||
}
|
|
||||||
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
@ -1,42 +0,0 @@
|
|||||||
From 1c9591115d577841522acd245cd2445cb77ee204 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Date: Wed, 5 Apr 2017 15:46:35 -0400
|
|
||||||
Subject: [PATCH] mdassemble: Use md_get_array_info() to check for valid array
|
|
||||||
Git-commit: 1c9591115d577841522acd245cd2445cb77ee204
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
Get rid of another use of md_get_version()
|
|
||||||
|
|
||||||
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
mdassemble.c | 9 ++++-----
|
|
||||||
1 file changed, 4 insertions(+), 5 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/mdassemble.c b/mdassemble.c
|
|
||||||
index a24b324..f0833bc 100644
|
|
||||||
--- a/mdassemble.c
|
|
||||||
+++ b/mdassemble.c
|
|
||||||
@@ -32,13 +32,12 @@ char const Name[] = "mdassemble";
|
|
||||||
/* from mdopen.c */
|
|
||||||
int open_mddev(char *dev, int report_errors/*unused*/)
|
|
||||||
{
|
|
||||||
+ struct mdu_array_info_s array;
|
|
||||||
int mdfd = open(dev, O_RDONLY);
|
|
||||||
if (mdfd < 0)
|
|
||||||
- pr_err("error opening %s: %s\n",
|
|
||||||
- dev, strerror(errno));
|
|
||||||
- else if (md_get_version(mdfd) <= 0) {
|
|
||||||
- pr_err("%s does not appear to be an md device\n",
|
|
||||||
- dev);
|
|
||||||
+ pr_err("error opening %s: %s\n", dev, strerror(errno));
|
|
||||||
+ else if (md_get_array_info(mdfd, &array) != 0) {
|
|
||||||
+ pr_err("%s does not appear to be an md device\n", dev);
|
|
||||||
close(mdfd);
|
|
||||||
mdfd = -1;
|
|
||||||
}
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
|||||||
From b6e60be6281a2a4ec326a72de114867797a42d7f Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Date: Wed, 5 Apr 2017 15:47:37 -0400
|
|
||||||
Subject: [PATCH] Assemble/Assemble: Get rid of last use of md_get_version()
|
|
||||||
Git-commit: b6e60be6281a2a4ec326a72de114867797a42d7f
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
At this point in the code, we know we have a valid array, and any
|
|
||||||
recent kernel will return 9003, so no point in querying the kernel for
|
|
||||||
this.
|
|
||||||
|
|
||||||
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
Assemble.c | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/Assemble.c b/Assemble.c
|
|
||||||
index fa5fdbe..0db428f 100644
|
|
||||||
--- a/Assemble.c
|
|
||||||
+++ b/Assemble.c
|
|
||||||
@@ -1901,7 +1901,7 @@ int assemble_container_content(struct supertype *st, int mdfd,
|
|
||||||
c->readonly &&
|
|
||||||
content->text_version[0] == '/')
|
|
||||||
content->text_version[0] = '-';
|
|
||||||
- if (sysfs_set_array(content, md_get_version(mdfd)) != 0) {
|
|
||||||
+ if (sysfs_set_array(content, 9003) != 0) {
|
|
||||||
sysfs_free(sra);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
@ -1,71 +0,0 @@
|
|||||||
From 303949f6f00b750a88bcdfc39ffdfe9f0463f6f2 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Date: Wed, 5 Apr 2017 15:49:18 -0400
|
|
||||||
Subject: [PATCH] util: Finally kill off md_get_version()
|
|
||||||
Git-commit: 303949f6f00b750a88bcdfc39ffdfe9f0463f6f2
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
mdadm.h | 1 -
|
|
||||||
util.c | 29 -----------------------------
|
|
||||||
2 files changed, 30 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/mdadm.h b/mdadm.h
|
|
||||||
index 612bd86..f1f643c 100644
|
|
||||||
--- a/mdadm.h
|
|
||||||
+++ b/mdadm.h
|
|
||||||
@@ -1404,7 +1404,6 @@ extern int Dump_metadata(char *dev, char *dir, struct context *c,
|
|
||||||
extern int Restore_metadata(char *dev, char *dir, struct context *c,
|
|
||||||
struct supertype *st, int only);
|
|
||||||
|
|
||||||
-extern int md_get_version(int fd);
|
|
||||||
int md_get_array_info(int fd, struct mdu_array_info_s *array);
|
|
||||||
int md_set_array_info(int fd, struct mdu_array_info_s *array);
|
|
||||||
int md_get_disk_info(int fd, struct mdu_disk_info_s *disk);
|
|
||||||
diff --git a/util.c b/util.c
|
|
||||||
index afeb6a5..a536f81 100644
|
|
||||||
--- a/util.c
|
|
||||||
+++ b/util.c
|
|
||||||
@@ -273,35 +273,6 @@ int parse_uuid(char *str, int uuid[4])
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
-/*
|
|
||||||
- * Get the md version number.
|
|
||||||
- * We use the RAID_VERSION ioctl if it is supported
|
|
||||||
- * If not, but we have a block device with major '9', we assume
|
|
||||||
- * 0.36.0
|
|
||||||
- *
|
|
||||||
- * Return version number as 24 but number - assume version parts
|
|
||||||
- * always < 255
|
|
||||||
- */
|
|
||||||
-
|
|
||||||
-int md_get_version(int fd)
|
|
||||||
-{
|
|
||||||
- struct stat stb;
|
|
||||||
- mdu_version_t vers;
|
|
||||||
-
|
|
||||||
- if (fstat(fd, &stb)<0)
|
|
||||||
- return -1;
|
|
||||||
- if ((S_IFMT&stb.st_mode) != S_IFBLK)
|
|
||||||
- return -1;
|
|
||||||
-
|
|
||||||
- if (ioctl(fd, RAID_VERSION, &vers) == 0)
|
|
||||||
- return (vers.major*10000) + (vers.minor*100) + vers.patchlevel;
|
|
||||||
- if (errno == EACCES)
|
|
||||||
- return -1;
|
|
||||||
- if (major(stb.st_rdev) == MD_MAJOR)
|
|
||||||
- return (3600);
|
|
||||||
- return -1;
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
int get_linux_version()
|
|
||||||
{
|
|
||||||
struct utsname name;
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
|||||||
From dcf3d4de95d1a4cbc65b24a844173ba1c1300b55 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Date: Thu, 6 Apr 2017 15:46:31 -0400
|
|
||||||
Subject: [PATCH] mdadm: Fail for kernels older than 2.6.15
|
|
||||||
Git-commit: dcf3d4de95d1a4cbc65b24a844173ba1c1300b55
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
With the removal of old kernel API support, mdadm will no longer run
|
|
||||||
on kernels older than 2.6.15.
|
|
||||||
|
|
||||||
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
mdadm.c | 5 +++++
|
|
||||||
1 file changed, 5 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/mdadm.c b/mdadm.c
|
|
||||||
index 3fe17fc..001ff68 100644
|
|
||||||
--- a/mdadm.c
|
|
||||||
+++ b/mdadm.c
|
|
||||||
@@ -120,6 +120,11 @@ int main(int argc, char *argv[])
|
|
||||||
ident.container = NULL;
|
|
||||||
ident.member = NULL;
|
|
||||||
|
|
||||||
+ if (get_linux_version() < 2006015) {
|
|
||||||
+ pr_err("This version of mdadm does not support kernels older than 2.6.15\n");
|
|
||||||
+ exit(1);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
while ((option_index = -1),
|
|
||||||
(opt = getopt_long(argc, argv, shortopt, long_options,
|
|
||||||
&option_index)) != -1) {
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
|||||||
From 2cfe6f7c646ebc25043f7607f5756edad0bc3071 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Date: Tue, 11 Apr 2017 11:30:23 -0400
|
|
||||||
Subject: [PATCH] Revert "mdadm/grow: reshape would be stuck from raid1 to
|
|
||||||
raid5"
|
|
||||||
Git-commit: 2cfe6f7c646ebc25043f7607f5756edad0bc3071
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
This reverts commit 5b2846684ef5172eccc432e3520b79efbc2abba5.
|
|
||||||
|
|
||||||
This was a red herring and shouldn't have been applied in the first
|
|
||||||
place.
|
|
||||||
|
|
||||||
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
systemd/mdadm-grow-continue@.service | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/systemd/mdadm-grow-continue@.service b/systemd/mdadm-grow-continue@.service
|
|
||||||
index 882bc0b..5c667d2 100644
|
|
||||||
--- a/systemd/mdadm-grow-continue@.service
|
|
||||||
+++ b/systemd/mdadm-grow-continue@.service
|
|
||||||
@@ -10,7 +10,7 @@ Description=Manage MD Reshape on /dev/%I
|
|
||||||
DefaultDependencies=no
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
-ExecStart=BINDIR/mdadm --grow --continue /dev/%i
|
|
||||||
+ExecStart=BINDIR/mdadm --grow --continue /dev/%I
|
|
||||||
StandardInput=null
|
|
||||||
StandardOutput=null
|
|
||||||
StandardError=null
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
@ -1,914 +0,0 @@
|
|||||||
From 46a533a90c01b0492577c61d4e65de2ac4bf220c Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jes Sorensen <jsorensen@fb.com>
|
|
||||||
Date: Tue, 11 Apr 2017 14:25:24 -0400
|
|
||||||
Subject: [PATCH] super1: Clean up various style abuses
|
|
||||||
Git-commit: 46a533a90c01b0492577c61d4e65de2ac4bf220c
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
Code is 80 characters wide, so lets try to respect that. In addition, we
|
|
||||||
should never have one-line 'if () action()' statements. Fixup various
|
|
||||||
whitespace abuse.
|
|
||||||
|
|
||||||
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
super1.c | 363 +++++++++++++++++++++++++++++++++++++++------------------------
|
|
||||||
1 file changed, 223 insertions(+), 140 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/super1.c b/super1.c
|
|
||||||
index 4db4dff..2fcb814 100644
|
|
||||||
--- a/super1.c
|
|
||||||
+++ b/super1.c
|
|
||||||
@@ -227,6 +227,7 @@ static void init_afd(struct align_fd *afd, int fd)
|
|
||||||
}
|
|
||||||
|
|
||||||
static char abuf[4096+4096];
|
|
||||||
+
|
|
||||||
static int aread(struct align_fd *afd, void *buf, int len)
|
|
||||||
{
|
|
||||||
/* aligned read.
|
|
||||||
@@ -339,7 +340,8 @@ static void examine_super1(struct supertype *st, char *homehost)
|
|
||||||
strncmp(sb->set_name, homehost, l) == 0)
|
|
||||||
printf(" (local to host %s)", homehost);
|
|
||||||
printf("\n");
|
|
||||||
- if (bms->nodes > 0 && (__le32_to_cpu(sb->feature_map) & MD_FEATURE_BITMAP_OFFSET))
|
|
||||||
+ if (bms->nodes > 0 &&
|
|
||||||
+ (__le32_to_cpu(sb->feature_map) & MD_FEATURE_BITMAP_OFFSET))
|
|
||||||
printf(" Cluster Name : %-64s\n", bms->cluster_name);
|
|
||||||
atime = __le64_to_cpu(sb->ctime) & 0xFFFFFFFFFFULL;
|
|
||||||
printf(" Creation Time : %.24s\n", ctime(&atime));
|
|
||||||
@@ -385,7 +387,8 @@ static void examine_super1(struct supertype *st, char *homehost)
|
|
||||||
printf(" Super Offset : %llu sectors\n",
|
|
||||||
(unsigned long long)__le64_to_cpu(sb->super_offset));
|
|
||||||
if (__le32_to_cpu(sb->feature_map) & MD_FEATURE_RECOVERY_OFFSET)
|
|
||||||
- printf("Recovery Offset : %llu sectors\n", (unsigned long long)__le64_to_cpu(sb->recovery_offset));
|
|
||||||
+ printf("Recovery Offset : %llu sectors\n",
|
|
||||||
+ (unsigned long long)__le64_to_cpu(sb->recovery_offset));
|
|
||||||
|
|
||||||
st->ss->getinfo_super(st, &info, NULL);
|
|
||||||
if (info.space_after != 1 &&
|
|
||||||
@@ -393,10 +396,12 @@ static void examine_super1(struct supertype *st, char *homehost)
|
|
||||||
printf(" Unused Space : before=%llu sectors, after=%llu sectors\n",
|
|
||||||
info.space_before, info.space_after);
|
|
||||||
|
|
||||||
- printf(" State : %s\n", (__le64_to_cpu(sb->resync_offset)+1)? "active":"clean");
|
|
||||||
+ printf(" State : %s\n",
|
|
||||||
+ (__le64_to_cpu(sb->resync_offset)+1)? "active":"clean");
|
|
||||||
printf(" Device UUID : ");
|
|
||||||
for (i=0; i<16; i++) {
|
|
||||||
- if ((i&3)==0 && i != 0) printf(":");
|
|
||||||
+ if ((i&3)==0 && i != 0)
|
|
||||||
+ printf(":");
|
|
||||||
printf("%02x", sb->device_uuid[i]);
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
@@ -410,12 +415,15 @@ static void examine_super1(struct supertype *st, char *homehost)
|
|
||||||
__le16_to_cpu(sb->ppl.offset));
|
|
||||||
}
|
|
||||||
if (sb->feature_map & __cpu_to_le32(MD_FEATURE_RESHAPE_ACTIVE)) {
|
|
||||||
- printf(" Reshape pos'n : %llu%s\n", (unsigned long long)__le64_to_cpu(sb->reshape_position)/2,
|
|
||||||
+ printf(" Reshape pos'n : %llu%s\n", (unsigned long long)
|
|
||||||
+ __le64_to_cpu(sb->reshape_position)/2,
|
|
||||||
human_size(__le64_to_cpu(sb->reshape_position)<<9));
|
|
||||||
if (__le32_to_cpu(sb->delta_disks)) {
|
|
||||||
- printf(" Delta Devices : %d", __le32_to_cpu(sb->delta_disks));
|
|
||||||
+ printf(" Delta Devices : %d",
|
|
||||||
+ __le32_to_cpu(sb->delta_disks));
|
|
||||||
printf(" (%d->%d)\n",
|
|
||||||
- __le32_to_cpu(sb->raid_disks)-__le32_to_cpu(sb->delta_disks),
|
|
||||||
+ __le32_to_cpu(sb->raid_disks) -
|
|
||||||
+ __le32_to_cpu(sb->delta_disks),
|
|
||||||
__le32_to_cpu(sb->raid_disks));
|
|
||||||
if ((int)__le32_to_cpu(sb->delta_disks) < 0)
|
|
||||||
delta_extra = -__le32_to_cpu(sb->delta_disks);
|
|
||||||
@@ -424,13 +432,16 @@ static void examine_super1(struct supertype *st, char *homehost)
|
|
||||||
c = map_num(pers, __le32_to_cpu(sb->new_level));
|
|
||||||
printf(" New Level : %s\n", c?c:"-unknown-");
|
|
||||||
}
|
|
||||||
- if (__le32_to_cpu(sb->new_layout) != __le32_to_cpu(sb->layout)) {
|
|
||||||
+ if (__le32_to_cpu(sb->new_layout) !=
|
|
||||||
+ __le32_to_cpu(sb->layout)) {
|
|
||||||
if (__le32_to_cpu(sb->level) == 5) {
|
|
||||||
- c = map_num(r5layout, __le32_to_cpu(sb->new_layout));
|
|
||||||
+ c = map_num(r5layout,
|
|
||||||
+ __le32_to_cpu(sb->new_layout));
|
|
||||||
printf(" New Layout : %s\n", c?c:"-unknown-");
|
|
||||||
}
|
|
||||||
if (__le32_to_cpu(sb->level) == 6) {
|
|
||||||
- c = map_num(r6layout, __le32_to_cpu(sb->new_layout));
|
|
||||||
+ c = map_num(r6layout,
|
|
||||||
+ __le32_to_cpu(sb->new_layout));
|
|
||||||
printf(" New Layout : %s\n", c?c:"-unknown-");
|
|
||||||
}
|
|
||||||
if (__le32_to_cpu(sb->level) == 10) {
|
|
||||||
@@ -439,8 +450,10 @@ static void examine_super1(struct supertype *st, char *homehost)
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
- if (__le32_to_cpu(sb->new_chunk) != __le32_to_cpu(sb->chunksize))
|
|
||||||
- printf(" New Chunksize : %dK\n", __le32_to_cpu(sb->new_chunk)/2);
|
|
||||||
+ if (__le32_to_cpu(sb->new_chunk) !=
|
|
||||||
+ __le32_to_cpu(sb->chunksize))
|
|
||||||
+ printf(" New Chunksize : %dK\n",
|
|
||||||
+ __le32_to_cpu(sb->new_chunk)/2);
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
if (sb->devflags) {
|
|
||||||
@@ -459,18 +472,20 @@ static void examine_super1(struct supertype *st, char *homehost)
|
|
||||||
printf(" Bad Block Log : %d entries available at offset %ld sectors",
|
|
||||||
__le16_to_cpu(sb->bblog_size)*512/8,
|
|
||||||
(long)(int32_t)__le32_to_cpu(sb->bblog_offset));
|
|
||||||
- if (sb->feature_map &
|
|
||||||
- __cpu_to_le32(MD_FEATURE_BAD_BLOCKS))
|
|
||||||
+ if (sb->feature_map & __cpu_to_le32(MD_FEATURE_BAD_BLOCKS))
|
|
||||||
printf(" - bad blocks present.");
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (calc_sb_1_csum(sb) == sb->sb_csum)
|
|
||||||
- printf(" Checksum : %x - correct\n", __le32_to_cpu(sb->sb_csum));
|
|
||||||
+ printf(" Checksum : %x - correct\n",
|
|
||||||
+ __le32_to_cpu(sb->sb_csum));
|
|
||||||
else
|
|
||||||
- printf(" Checksum : %x - expected %x\n", __le32_to_cpu(sb->sb_csum),
|
|
||||||
+ printf(" Checksum : %x - expected %x\n",
|
|
||||||
+ __le32_to_cpu(sb->sb_csum),
|
|
||||||
__le32_to_cpu(calc_sb_1_csum(sb)));
|
|
||||||
- printf(" Events : %llu\n", (unsigned long long)__le64_to_cpu(sb->events));
|
|
||||||
+ printf(" Events : %llu\n",
|
|
||||||
+ (unsigned long long)__le64_to_cpu(sb->events));
|
|
||||||
printf("\n");
|
|
||||||
if (__le32_to_cpu(sb->level) == 5) {
|
|
||||||
c = map_num(r5layout, __le32_to_cpu(sb->layout));
|
|
||||||
@@ -492,26 +507,34 @@ static void examine_super1(struct supertype *st, char *homehost)
|
|
||||||
case 5:
|
|
||||||
case 6:
|
|
||||||
case 10:
|
|
||||||
- printf(" Chunk Size : %dK\n", __le32_to_cpu(sb->chunksize)/2);
|
|
||||||
+ printf(" Chunk Size : %dK\n",
|
|
||||||
+ __le32_to_cpu(sb->chunksize)/2);
|
|
||||||
break;
|
|
||||||
case -1:
|
|
||||||
- printf(" Rounding : %dK\n", __le32_to_cpu(sb->chunksize)/2);
|
|
||||||
+ printf(" Rounding : %dK\n",
|
|
||||||
+ __le32_to_cpu(sb->chunksize)/2);
|
|
||||||
+ break;
|
|
||||||
+ default:
|
|
||||||
break;
|
|
||||||
- default: break;
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
#if 0
|
|
||||||
/* This turns out to just be confusing */
|
|
||||||
printf(" Array Slot : %d (", __le32_to_cpu(sb->dev_number));
|
|
||||||
- for (i= __le32_to_cpu(sb->max_dev); i> 0 ; i--)
|
|
||||||
+ for (i = __le32_to_cpu(sb->max_dev); i> 0 ; i--)
|
|
||||||
if (__le16_to_cpu(sb->dev_roles[i-1]) != MD_DISK_ROLE_SPARE)
|
|
||||||
break;
|
|
||||||
- for (d=0; d < i; d++) {
|
|
||||||
+ for (d = 0; d < i; d++) {
|
|
||||||
int role = __le16_to_cpu(sb->dev_roles[d]);
|
|
||||||
- if (d) printf(", ");
|
|
||||||
- if (role == MD_DISK_ROLE_SPARE) printf("empty");
|
|
||||||
- else if(role == MD_DISK_ROLE_FAULTY) printf("failed");
|
|
||||||
- else printf("%d", role);
|
|
||||||
+ if (d)
|
|
||||||
+ printf(", ");
|
|
||||||
+ if (role == MD_DISK_ROLE_SPARE)
|
|
||||||
+ printf("empty");
|
|
||||||
+ else
|
|
||||||
+ if(role == MD_DISK_ROLE_FAULTY)
|
|
||||||
+ printf("failed");
|
|
||||||
+ else
|
|
||||||
+ printf("%d", role);
|
|
||||||
}
|
|
||||||
printf(")\n");
|
|
||||||
#endif
|
|
||||||
@@ -527,10 +550,10 @@ static void examine_super1(struct supertype *st, char *homehost)
|
|
||||||
printf("Active device %d\n", role);
|
|
||||||
|
|
||||||
printf(" Array State : ");
|
|
||||||
- for (d=0; d<__le32_to_cpu(sb->raid_disks) + delta_extra; d++) {
|
|
||||||
+ for (d = 0; d < __le32_to_cpu(sb->raid_disks) + delta_extra; d++) {
|
|
||||||
int cnt = 0;
|
|
||||||
unsigned int i;
|
|
||||||
- for (i=0; i< __le32_to_cpu(sb->max_dev); i++) {
|
|
||||||
+ for (i = 0; i < __le32_to_cpu(sb->max_dev); i++) {
|
|
||||||
unsigned int role = __le16_to_cpu(sb->dev_roles[i]);
|
|
||||||
if (role == d)
|
|
||||||
cnt++;
|
|
||||||
@@ -547,12 +570,13 @@ static void examine_super1(struct supertype *st, char *homehost)
|
|
||||||
#if 0
|
|
||||||
/* This is confusing too */
|
|
||||||
faulty = 0;
|
|
||||||
- for (i=0; i< __le32_to_cpu(sb->max_dev); i++) {
|
|
||||||
+ for (i = 0; i< __le32_to_cpu(sb->max_dev); i++) {
|
|
||||||
int role = __le16_to_cpu(sb->dev_roles[i]);
|
|
||||||
if (role == MD_DISK_ROLE_FAULTY)
|
|
||||||
faulty++;
|
|
||||||
}
|
|
||||||
- if (faulty) printf(" %d failed", faulty);
|
|
||||||
+ if (faulty)
|
|
||||||
+ printf(" %d failed", faulty);
|
|
||||||
#endif
|
|
||||||
printf(" ('A' == active, '.' == missing, 'R' == replacing)");
|
|
||||||
printf("\n");
|
|
||||||
@@ -564,7 +588,7 @@ static void brief_examine_super1(struct supertype *st, int verbose)
|
|
||||||
int i;
|
|
||||||
unsigned long long sb_offset;
|
|
||||||
char *nm;
|
|
||||||
- char *c=map_num(pers, __le32_to_cpu(sb->level));
|
|
||||||
+ char *c = map_num(pers, __le32_to_cpu(sb->level));
|
|
||||||
|
|
||||||
nm = strchr(sb->set_name, ':');
|
|
||||||
if (nm)
|
|
||||||
@@ -592,8 +616,9 @@ static void brief_examine_super1(struct supertype *st, int verbose)
|
|
||||||
if (verbose)
|
|
||||||
printf("num-devices=%d ", __le32_to_cpu(sb->raid_disks));
|
|
||||||
printf("UUID=");
|
|
||||||
- for (i=0; i<16; i++) {
|
|
||||||
- if ((i&3)==0 && i != 0) printf(":");
|
|
||||||
+ for (i = 0; i < 16; i++) {
|
|
||||||
+ if ((i&3)==0 && i != 0)
|
|
||||||
+ printf(":");
|
|
||||||
printf("%02x", sb->set_uuid[i]);
|
|
||||||
}
|
|
||||||
if (sb->set_name[0]) {
|
|
||||||
@@ -612,9 +637,8 @@ static void export_examine_super1(struct supertype *st)
|
|
||||||
|
|
||||||
printf("MD_LEVEL=%s\n", map_num(pers, __le32_to_cpu(sb->level)));
|
|
||||||
printf("MD_DEVICES=%d\n", __le32_to_cpu(sb->raid_disks));
|
|
||||||
- for (i=0; i<32; i++)
|
|
||||||
- if (sb->set_name[i] == '\n' ||
|
|
||||||
- sb->set_name[i] == '\0') {
|
|
||||||
+ for (i = 0; i < 32; i++)
|
|
||||||
+ if (sb->set_name[i] == '\n' || sb->set_name[i] == '\0') {
|
|
||||||
len = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
@@ -623,10 +647,16 @@ static void export_examine_super1(struct supertype *st)
|
|
||||||
if (__le32_to_cpu(sb->level) > 0) {
|
|
||||||
int ddsks = 0, ddsks_denom = 1;
|
|
||||||
switch(__le32_to_cpu(sb->level)) {
|
|
||||||
- case 1: ddsks=1;break;
|
|
||||||
+ case 1:
|
|
||||||
+ ddsks = 1;
|
|
||||||
+ break;
|
|
||||||
case 4:
|
|
||||||
- case 5: ddsks = __le32_to_cpu(sb->raid_disks)-1; break;
|
|
||||||
- case 6: ddsks = __le32_to_cpu(sb->raid_disks)-2; break;
|
|
||||||
+ case 5:
|
|
||||||
+ ddsks = __le32_to_cpu(sb->raid_disks)-1;
|
|
||||||
+ break;
|
|
||||||
+ case 6:
|
|
||||||
+ ddsks = __le32_to_cpu(sb->raid_disks)-2;
|
|
||||||
+ break;
|
|
||||||
case 10:
|
|
||||||
layout = __le32_to_cpu(sb->layout);
|
|
||||||
ddsks = __le32_to_cpu(sb->raid_disks);
|
|
||||||
@@ -635,20 +665,23 @@ static void export_examine_super1(struct supertype *st)
|
|
||||||
if (ddsks) {
|
|
||||||
long long asize = __le64_to_cpu(sb->size);
|
|
||||||
asize = (asize << 9) * ddsks / ddsks_denom;
|
|
||||||
- printf("MD_ARRAY_SIZE=%s\n",human_size_brief(asize,JEDEC));
|
|
||||||
+ printf("MD_ARRAY_SIZE=%s\n",
|
|
||||||
+ human_size_brief(asize, JEDEC));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
printf("MD_UUID=");
|
|
||||||
- for (i=0; i<16; i++) {
|
|
||||||
- if ((i&3)==0 && i != 0) printf(":");
|
|
||||||
+ for (i = 0; i < 16; i++) {
|
|
||||||
+ if ((i&3) == 0 && i != 0)
|
|
||||||
+ printf(":");
|
|
||||||
printf("%02x", sb->set_uuid[i]);
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
printf("MD_UPDATE_TIME=%llu\n",
|
|
||||||
__le64_to_cpu(sb->utime) & 0xFFFFFFFFFFULL);
|
|
||||||
printf("MD_DEV_UUID=");
|
|
||||||
- for (i=0; i<16; i++) {
|
|
||||||
- if ((i&3)==0 && i != 0) printf(":");
|
|
||||||
+ for (i = 0; i < 16; i++) {
|
|
||||||
+ if ((i&3) == 0 && i != 0)
|
|
||||||
+ printf(":");
|
|
||||||
printf("%02x", sb->device_uuid[i]);
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
@@ -797,15 +830,16 @@ static void detail_super1(struct supertype *st, char *homehost)
|
|
||||||
int l = homehost ? strlen(homehost) : 0;
|
|
||||||
|
|
||||||
printf(" Name : %.32s", sb->set_name);
|
|
||||||
- if (l > 0 && l < 32 &&
|
|
||||||
- sb->set_name[l] == ':' &&
|
|
||||||
+ if (l > 0 && l < 32 && sb->set_name[l] == ':' &&
|
|
||||||
strncmp(sb->set_name, homehost, l) == 0)
|
|
||||||
printf(" (local to host %s)", homehost);
|
|
||||||
- if (bms->nodes > 0 && (__le32_to_cpu(sb->feature_map) & MD_FEATURE_BITMAP_OFFSET))
|
|
||||||
- printf("\n Cluster Name : %-64s", bms->cluster_name);
|
|
||||||
+ if (bms->nodes > 0 &&
|
|
||||||
+ (__le32_to_cpu(sb->feature_map) & MD_FEATURE_BITMAP_OFFSET))
|
|
||||||
+ printf("\n Cluster Name : %-64s", bms->cluster_name);
|
|
||||||
printf("\n UUID : ");
|
|
||||||
- for (i=0; i<16; i++) {
|
|
||||||
- if ((i&3)==0 && i != 0) printf(":");
|
|
||||||
+ for (i = 0; i < 16; i++) {
|
|
||||||
+ if ((i&3) == 0 && i != 0)
|
|
||||||
+ printf(":");
|
|
||||||
printf("%02x", sb->set_uuid[i]);
|
|
||||||
}
|
|
||||||
printf("\n Events : %llu\n\n",
|
|
||||||
@@ -822,8 +856,9 @@ static void brief_detail_super1(struct supertype *st)
|
|
||||||
print_quoted(sb->set_name);
|
|
||||||
}
|
|
||||||
printf(" UUID=");
|
|
||||||
- for (i=0; i<16; i++) {
|
|
||||||
- if ((i&3)==0 && i != 0) printf(":");
|
|
||||||
+ for (i = 0; i < 16; i++) {
|
|
||||||
+ if ((i & 3) == 0 && i != 0)
|
|
||||||
+ printf(":");
|
|
||||||
printf("%02x", sb->set_uuid[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -834,9 +869,8 @@ static void export_detail_super1(struct supertype *st)
|
|
||||||
int i;
|
|
||||||
int len = 32;
|
|
||||||
|
|
||||||
- for (i=0; i<32; i++)
|
|
||||||
- if (sb->set_name[i] == '\n' ||
|
|
||||||
- sb->set_name[i] == '\0') {
|
|
||||||
+ for (i = 0; i < 32; i++)
|
|
||||||
+ if (sb->set_name[i] == '\n' || sb->set_name[i] == '\0') {
|
|
||||||
len = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
@@ -852,13 +886,12 @@ static int examine_badblocks_super1(struct supertype *st, int fd, char *devname)
|
|
||||||
__u64 *bbl, *bbp;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
- if (!sb->bblog_size || __le16_to_cpu(sb->bblog_size) > 100
|
|
||||||
- || !sb->bblog_offset){
|
|
||||||
+ if (!sb->bblog_size || __le16_to_cpu(sb->bblog_size) > 100 ||
|
|
||||||
+ !sb->bblog_offset){
|
|
||||||
printf("No bad-blocks list configured on %s\n", devname);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
- if ((sb->feature_map & __cpu_to_le32(MD_FEATURE_BAD_BLOCKS))
|
|
||||||
- == 0) {
|
|
||||||
+ if ((sb->feature_map & __cpu_to_le32(MD_FEATURE_BAD_BLOCKS)) == 0) {
|
|
||||||
printf("Bad-blocks list is empty in %s\n", devname);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -905,8 +938,7 @@ static int match_home1(struct supertype *st, char *homehost)
|
|
||||||
struct mdp_superblock_1 *sb = st->sb;
|
|
||||||
int l = homehost ? strlen(homehost) : 0;
|
|
||||||
|
|
||||||
- return (l > 0 && l < 32 &&
|
|
||||||
- sb->set_name[l] == ':' &&
|
|
||||||
+ return (l > 0 && l < 32 && sb->set_name[l] == ':' &&
|
|
||||||
strncmp(sb->set_name, homehost, l) == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -915,7 +947,7 @@ static void uuid_from_super1(struct supertype *st, int uuid[4])
|
|
||||||
struct mdp_superblock_1 *super = st->sb;
|
|
||||||
char *cuuid = (char*)uuid;
|
|
||||||
int i;
|
|
||||||
- for (i=0; i<16; i++)
|
|
||||||
+ for (i = 0; i < 16; i++)
|
|
||||||
cuuid[i] = super->set_uuid[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -923,7 +955,8 @@ static void getinfo_super1(struct supertype *st, struct mdinfo *info, char *map)
|
|
||||||
{
|
|
||||||
struct mdp_superblock_1 *sb = st->sb;
|
|
||||||
struct bitmap_super_s *bsb = (void*)(((char*)sb)+MAX_SB_SIZE);
|
|
||||||
- struct misc_dev_info *misc = (void*)(((char*)sb)+MAX_SB_SIZE+BM_SUPER_SIZE);
|
|
||||||
+ struct misc_dev_info *misc =
|
|
||||||
+ (void*)(((char*)sb)+MAX_SB_SIZE+BM_SUPER_SIZE);
|
|
||||||
int working = 0;
|
|
||||||
unsigned int i;
|
|
||||||
unsigned int role;
|
|
||||||
@@ -943,8 +976,7 @@ static void getinfo_super1(struct supertype *st, struct mdinfo *info, char *map)
|
|
||||||
info->array.utime = __le64_to_cpu(sb->utime);
|
|
||||||
info->array.chunk_size = __le32_to_cpu(sb->chunksize)*512;
|
|
||||||
info->array.state =
|
|
||||||
- (__le64_to_cpu(sb->resync_offset) == MaxSector)
|
|
||||||
- ? 1 : 0;
|
|
||||||
+ (__le64_to_cpu(sb->resync_offset) == MaxSector) ? 1 : 0;
|
|
||||||
if (__le32_to_cpu(bsb->nodes) > 1)
|
|
||||||
info->array.state |= (1 << MD_SB_CLUSTERED);
|
|
||||||
|
|
||||||
@@ -985,7 +1017,8 @@ static void getinfo_super1(struct supertype *st, struct mdinfo *info, char *map)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (super_offset + info->bitmap_offset + info->ppl_offset < end)
|
|
||||||
- end = super_offset + info->bitmap_offset + info->ppl_offset;
|
|
||||||
+ end = super_offset + info->bitmap_offset +
|
|
||||||
+ info->ppl_offset;
|
|
||||||
|
|
||||||
if (info->data_offset + data_size < end)
|
|
||||||
info->space_after = end - data_size - info->data_offset;
|
|
||||||
@@ -1002,8 +1035,9 @@ static void getinfo_super1(struct supertype *st, struct mdinfo *info, char *map)
|
|
||||||
if (bmend > earliest)
|
|
||||||
earliest = bmend;
|
|
||||||
} else if (info->ppl_offset > 0) {
|
|
||||||
- unsigned long long pplend = info->ppl_offset +
|
|
||||||
- info->ppl_size;
|
|
||||||
+ unsigned long long pplend;
|
|
||||||
+
|
|
||||||
+ pplend = info->ppl_offset + info->ppl_size;
|
|
||||||
if (pplend > earliest)
|
|
||||||
earliest = pplend;
|
|
||||||
}
|
|
||||||
@@ -1018,7 +1052,8 @@ static void getinfo_super1(struct supertype *st, struct mdinfo *info, char *map)
|
|
||||||
info->space_before = info->data_offset - earliest;
|
|
||||||
else
|
|
||||||
info->space_before = 0;
|
|
||||||
- info->space_after = misc->device_size - data_size - info->data_offset;
|
|
||||||
+ info->space_after = misc->device_size - data_size -
|
|
||||||
+ info->data_offset;
|
|
||||||
}
|
|
||||||
if (info->space_before == 0 && info->space_after == 0) {
|
|
||||||
/* It will look like we don't support data_offset changes,
|
|
||||||
@@ -1032,7 +1067,8 @@ static void getinfo_super1(struct supertype *st, struct mdinfo *info, char *map)
|
|
||||||
info->disk.raid_disk = -1;
|
|
||||||
switch(role) {
|
|
||||||
case MD_DISK_ROLE_SPARE:
|
|
||||||
- info->disk.state = 0; /* spare: not active, not sync, not faulty */
|
|
||||||
+ /* spare: not active, not sync, not faulty */
|
|
||||||
+ info->disk.state = 0;
|
|
||||||
break;
|
|
||||||
case MD_DISK_ROLE_FAULTY:
|
|
||||||
info->disk.state = (1 << MD_DISK_FAULTY); /* faulty */
|
|
||||||
@@ -1040,7 +1076,8 @@ static void getinfo_super1(struct supertype *st, struct mdinfo *info, char *map)
|
|
||||||
case MD_DISK_ROLE_JOURNAL:
|
|
||||||
info->disk.state = (1 << MD_DISK_JOURNAL);
|
|
||||||
info->disk.raid_disk = role;
|
|
||||||
- info->space_after = (misc->device_size - info->data_offset) % 8; /* journal uses all 4kB blocks*/
|
|
||||||
+ /* journal uses all 4kB blocks*/
|
|
||||||
+ info->space_after = (misc->device_size - info->data_offset) % 8;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
info->disk.state = 6; /* active and in sync */
|
|
||||||
@@ -1129,8 +1166,7 @@ static struct mdinfo *container_content1(struct supertype *st, char *subarray)
|
|
||||||
}
|
|
||||||
|
|
||||||
static int update_super1(struct supertype *st, struct mdinfo *info,
|
|
||||||
- char *update,
|
|
||||||
- char *devname, int verbose,
|
|
||||||
+ char *update, char *devname, int verbose,
|
|
||||||
int uuid_set, char *homehost)
|
|
||||||
{
|
|
||||||
/* NOTE: for 'assemble' and 'force' we need to return non-zero
|
|
||||||
@@ -1145,7 +1181,8 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
|
|
||||||
if (bms->version == BITMAP_MAJOR_CLUSTERED && dlm_funs_ready()) {
|
|
||||||
rv = cluster_get_dlmlock(&lockid);
|
|
||||||
if (rv) {
|
|
||||||
- pr_err("Cannot get dlmlock in %s return %d\n", __func__, rv);
|
|
||||||
+ pr_err("Cannot get dlmlock in %s return %d\n",
|
|
||||||
+ __func__, rv);
|
|
||||||
cluster_release_dlmlock(lockid);
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
@@ -1178,7 +1215,9 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
|
|
||||||
* maybe need to mark it 'clean'.
|
|
||||||
*/
|
|
||||||
switch(__le32_to_cpu(sb->level)) {
|
|
||||||
- case 5: case 4: case 6:
|
|
||||||
+ case 4:
|
|
||||||
+ case 5:
|
|
||||||
+ case 6:
|
|
||||||
/* need to force clean */
|
|
||||||
if (sb->resync_offset != MaxSector)
|
|
||||||
rv = 1;
|
|
||||||
@@ -1198,17 +1237,23 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
|
|
||||||
rv = 1;
|
|
||||||
}
|
|
||||||
if (info->reshape_active &&
|
|
||||||
- sb->feature_map & __le32_to_cpu(MD_FEATURE_RESHAPE_ACTIVE) &&
|
|
||||||
+ sb->feature_map &
|
|
||||||
+ __le32_to_cpu(MD_FEATURE_RESHAPE_ACTIVE) &&
|
|
||||||
info->delta_disks >= 0 &&
|
|
||||||
- info->reshape_progress < __le64_to_cpu(sb->reshape_position)) {
|
|
||||||
- sb->reshape_position = __cpu_to_le64(info->reshape_progress);
|
|
||||||
+ info->reshape_progress <
|
|
||||||
+ __le64_to_cpu(sb->reshape_position)) {
|
|
||||||
+ sb->reshape_position =
|
|
||||||
+ __cpu_to_le64(info->reshape_progress);
|
|
||||||
rv = 1;
|
|
||||||
}
|
|
||||||
if (info->reshape_active &&
|
|
||||||
- sb->feature_map & __le32_to_cpu(MD_FEATURE_RESHAPE_ACTIVE) &&
|
|
||||||
+ sb->feature_map &
|
|
||||||
+ __le32_to_cpu(MD_FEATURE_RESHAPE_ACTIVE) &&
|
|
||||||
info->delta_disks < 0 &&
|
|
||||||
- info->reshape_progress > __le64_to_cpu(sb->reshape_position)) {
|
|
||||||
- sb->reshape_position = __cpu_to_le64(info->reshape_progress);
|
|
||||||
+ info->reshape_progress >
|
|
||||||
+ __le64_to_cpu(sb->reshape_position)) {
|
|
||||||
+ sb->reshape_position =
|
|
||||||
+ __cpu_to_le64(info->reshape_progress);
|
|
||||||
rv = 1;
|
|
||||||
}
|
|
||||||
} else if (strcmp(update, "linear-grow-new") == 0) {
|
|
||||||
@@ -1216,8 +1261,9 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
|
|
||||||
int fd;
|
|
||||||
unsigned int max = __le32_to_cpu(sb->max_dev);
|
|
||||||
|
|
||||||
- for (i=0 ; i < max ; i++)
|
|
||||||
- if (__le16_to_cpu(sb->dev_roles[i]) >= MD_DISK_ROLE_FAULTY)
|
|
||||||
+ for (i = 0; i < max; i++)
|
|
||||||
+ if (__le16_to_cpu(sb->dev_roles[i]) >=
|
|
||||||
+ MD_DISK_ROLE_FAULTY)
|
|
||||||
break;
|
|
||||||
sb->dev_number = __cpu_to_le32(i);
|
|
||||||
info->disk.number = i;
|
|
||||||
@@ -1226,8 +1272,7 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
|
|
||||||
|
|
||||||
random_uuid(sb->device_uuid);
|
|
||||||
|
|
||||||
- sb->dev_roles[i] =
|
|
||||||
- __cpu_to_le16(info->disk.raid_disk);
|
|
||||||
+ sb->dev_roles[i] = __cpu_to_le16(info->disk.raid_disk);
|
|
||||||
|
|
||||||
fd = open(devname, O_RDONLY);
|
|
||||||
if (fd >= 0) {
|
|
||||||
@@ -1280,14 +1325,16 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sb_offset < data_offset) {
|
|
||||||
- /* 1.1 or 1.2. Put bbl after bitmap leaving at least 32K
|
|
||||||
+ /*
|
|
||||||
+ * 1.1 or 1.2. Put bbl after bitmap leaving
|
|
||||||
+ * at least 32K
|
|
||||||
*/
|
|
||||||
long bb_offset;
|
|
||||||
bb_offset = sb_offset + 8;
|
|
||||||
if (bm_sectors && bitmap_offset > 0)
|
|
||||||
bb_offset = bitmap_offset + bm_sectors;
|
|
||||||
- while (bb_offset < (long)sb_offset + 8 + 32*2
|
|
||||||
- && bb_offset + 8+8 <= (long)data_offset)
|
|
||||||
+ while (bb_offset < (long)sb_offset + 8 + 32*2 &&
|
|
||||||
+ bb_offset + 8+8 <= (long)data_offset)
|
|
||||||
/* too close to bitmap, and room to grow */
|
|
||||||
bb_offset += 8;
|
|
||||||
if (bb_offset + 8 <= (long)data_offset) {
|
|
||||||
@@ -1381,8 +1428,8 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
|
|
||||||
} else
|
|
||||||
strncpy(sb->set_name, info->name, sizeof(sb->set_name));
|
|
||||||
} else if (strcmp(update, "devicesize") == 0 &&
|
|
||||||
- __le64_to_cpu(sb->super_offset) <
|
|
||||||
- __le64_to_cpu(sb->data_offset)) {
|
|
||||||
+ __le64_to_cpu(sb->super_offset) <
|
|
||||||
+ __le64_to_cpu(sb->data_offset)) {
|
|
||||||
/* set data_size to device size less data_offset */
|
|
||||||
struct misc_dev_info *misc = (struct misc_dev_info*)
|
|
||||||
(st->sb + MAX_SB_SIZE + BM_SUPER_SIZE);
|
|
||||||
@@ -1390,7 +1437,8 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
|
|
||||||
misc->device_size - __le64_to_cpu(sb->data_offset));
|
|
||||||
} else if (strncmp(update, "revert-reshape", 14) == 0) {
|
|
||||||
rv = -2;
|
|
||||||
- if (!(sb->feature_map & __cpu_to_le32(MD_FEATURE_RESHAPE_ACTIVE)))
|
|
||||||
+ if (!(sb->feature_map &
|
|
||||||
+ __cpu_to_le32(MD_FEATURE_RESHAPE_ACTIVE)))
|
|
||||||
pr_err("No active reshape to revert on %s\n",
|
|
||||||
devname);
|
|
||||||
else {
|
|
||||||
@@ -1431,9 +1479,11 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
|
|
||||||
*/
|
|
||||||
if (__le32_to_cpu(sb->level) >= 4 &&
|
|
||||||
__le32_to_cpu(sb->level) <= 6) {
|
|
||||||
- reshape_sectors = __le64_to_cpu(sb->reshape_position);
|
|
||||||
+ reshape_sectors =
|
|
||||||
+ __le64_to_cpu(sb->reshape_position);
|
|
||||||
reshape_chunk = __le32_to_cpu(sb->new_chunk);
|
|
||||||
- reshape_chunk *= __le32_to_cpu(sb->raid_disks) - __le32_to_cpu(sb->delta_disks) -
|
|
||||||
+ reshape_chunk *= __le32_to_cpu(sb->raid_disks) -
|
|
||||||
+ __le32_to_cpu(sb->delta_disks) -
|
|
||||||
(__le32_to_cpu(sb->level)==6 ? 2 : 1);
|
|
||||||
if (reshape_sectors % reshape_chunk) {
|
|
||||||
pr_err("Reshape position is not suitably aligned.\n");
|
|
||||||
@@ -1441,8 +1491,9 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
- sb->raid_disks = __cpu_to_le32(__le32_to_cpu(sb->raid_disks) -
|
|
||||||
- __le32_to_cpu(sb->delta_disks));
|
|
||||||
+ sb->raid_disks =
|
|
||||||
+ __cpu_to_le32(__le32_to_cpu(sb->raid_disks) -
|
|
||||||
+ __le32_to_cpu(sb->delta_disks));
|
|
||||||
if (sb->delta_disks == 0)
|
|
||||||
sb->feature_map ^= __cpu_to_le32(MD_FEATURE_RESHAPE_BACKWARDS);
|
|
||||||
else
|
|
||||||
@@ -1456,19 +1507,21 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
|
|
||||||
sb->new_chunk = sb->chunksize;
|
|
||||||
sb->chunksize = temp;
|
|
||||||
|
|
||||||
- if (sb->feature_map & __cpu_to_le32(MD_FEATURE_NEW_OFFSET)) {
|
|
||||||
- long offset_delta = (int32_t)__le32_to_cpu(sb->new_offset);
|
|
||||||
+ if (sb->feature_map &
|
|
||||||
+ __cpu_to_le32(MD_FEATURE_NEW_OFFSET)) {
|
|
||||||
+ long offset_delta =
|
|
||||||
+ (int32_t)__le32_to_cpu(sb->new_offset);
|
|
||||||
sb->data_offset = __cpu_to_le64(__le64_to_cpu(sb->data_offset) + offset_delta);
|
|
||||||
sb->new_offset = __cpu_to_le32(-offset_delta);
|
|
||||||
sb->data_size = __cpu_to_le64(__le64_to_cpu(sb->data_size) - offset_delta);
|
|
||||||
}
|
|
||||||
done:;
|
|
||||||
}
|
|
||||||
- } else if (strcmp(update, "_reshape_progress")==0)
|
|
||||||
+ } else if (strcmp(update, "_reshape_progress") == 0)
|
|
||||||
sb->reshape_position = __cpu_to_le64(info->reshape_progress);
|
|
||||||
- else if (strcmp(update, "writemostly")==0)
|
|
||||||
+ else if (strcmp(update, "writemostly") == 0)
|
|
||||||
sb->devflags |= WriteMostly1;
|
|
||||||
- else if (strcmp(update, "readwrite")==0)
|
|
||||||
+ else if (strcmp(update, "readwrite") == 0)
|
|
||||||
sb->devflags &= ~WriteMostly1;
|
|
||||||
else if (strcmp(update, "failfast") == 0)
|
|
||||||
sb->devflags |= FailFast1;
|
|
||||||
@@ -1553,11 +1606,14 @@ static int init_super1(struct supertype *st, mdu_array_info_t *info,
|
|
||||||
sb->resync_offset = MaxSector;
|
|
||||||
else
|
|
||||||
sb->resync_offset = 0;
|
|
||||||
- sbsize = sizeof(struct mdp_superblock_1) + 2 * (info->raid_disks + spares);
|
|
||||||
+ sbsize = sizeof(struct mdp_superblock_1) +
|
|
||||||
+ 2 * (info->raid_disks + spares);
|
|
||||||
sbsize = ROUND_UP(sbsize, 512);
|
|
||||||
- sb->max_dev = __cpu_to_le32((sbsize - sizeof(struct mdp_superblock_1)) / 2);
|
|
||||||
+ sb->max_dev =
|
|
||||||
+ __cpu_to_le32((sbsize - sizeof(struct mdp_superblock_1)) / 2);
|
|
||||||
|
|
||||||
- memset(sb->dev_roles, 0xff, MAX_SB_SIZE - sizeof(struct mdp_superblock_1));
|
|
||||||
+ memset(sb->dev_roles, 0xff,
|
|
||||||
+ MAX_SB_SIZE - sizeof(struct mdp_superblock_1));
|
|
||||||
|
|
||||||
if (s->consistency_policy == CONSISTENCY_POLICY_PPL)
|
|
||||||
sb->feature_map |= __cpu_to_le32(MD_FEATURE_PPL);
|
|
||||||
@@ -1587,7 +1643,8 @@ static int add_to_super1(struct supertype *st, mdu_disk_info_t *dk,
|
|
||||||
if (bms->version == BITMAP_MAJOR_CLUSTERED && dlm_funs_ready()) {
|
|
||||||
rv = cluster_get_dlmlock(&lockid);
|
|
||||||
if (rv) {
|
|
||||||
- pr_err("Cannot get dlmlock in %s return %d\n", __func__, rv);
|
|
||||||
+ pr_err("Cannot get dlmlock in %s return %d\n",
|
|
||||||
+ __func__, rv);
|
|
||||||
cluster_release_dlmlock(lockid);
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
@@ -1599,7 +1656,8 @@ static int add_to_super1(struct supertype *st, mdu_disk_info_t *dk,
|
|
||||||
*rp = __cpu_to_le16(dk->raid_disk);
|
|
||||||
else if (dk_state & (1<<MD_DISK_JOURNAL))
|
|
||||||
*rp = MD_DISK_ROLE_JOURNAL;
|
|
||||||
- else if ((dk_state & ~(1<<MD_DISK_ACTIVE)) == 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;
|
|
||||||
@@ -1644,7 +1702,8 @@ static int store_super1(struct supertype *st, int fd)
|
|
||||||
if (bms->version == BITMAP_MAJOR_CLUSTERED && dlm_funs_ready()) {
|
|
||||||
rv = cluster_get_dlmlock(&lockid);
|
|
||||||
if (rv) {
|
|
||||||
- pr_err("Cannot get dlmlock in %s return %d\n", __func__, rv);
|
|
||||||
+ pr_err("Cannot get dlmlock in %s return %d\n",
|
|
||||||
+ __func__, rv);
|
|
||||||
cluster_release_dlmlock(lockid);
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
@@ -1911,7 +1970,8 @@ static int write_init_super1(struct supertype *st)
|
|
||||||
bm_space = calc_bitmap_size(bms, 4096) >> 9;
|
|
||||||
bm_offset = (long)__le32_to_cpu(sb->bitmap_offset);
|
|
||||||
} else if (sb->feature_map & __cpu_to_le32(MD_FEATURE_PPL)) {
|
|
||||||
- bm_space = choose_ppl_space(__le32_to_cpu(sb->chunksize));
|
|
||||||
+ bm_space =
|
|
||||||
+ choose_ppl_space(__le32_to_cpu(sb->chunksize));
|
|
||||||
if (bm_space > UINT16_MAX)
|
|
||||||
bm_space = UINT16_MAX;
|
|
||||||
if (st->minor_version == 0) {
|
|
||||||
@@ -1981,7 +2041,10 @@ static int write_init_super1(struct supertype *st)
|
|
||||||
rv = -EINVAL;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
- /* Disable badblock log on clusters, or when explicitly requested */
|
|
||||||
+ /*
|
|
||||||
+ * Disable badblock log on clusters, or when
|
|
||||||
+ * explicitly requested
|
|
||||||
+ */
|
|
||||||
if (st->nodes > 0 || conf_get_create_info()->bblist == 0) {
|
|
||||||
sb->bblog_size = 0;
|
|
||||||
sb->bblog_offset = 0;
|
|
||||||
@@ -1997,7 +2060,8 @@ static int write_init_super1(struct supertype *st)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rv == 0 &&
|
|
||||||
- (__le32_to_cpu(sb->feature_map) & MD_FEATURE_BITMAP_OFFSET)) {
|
|
||||||
+ (__le32_to_cpu(sb->feature_map) &
|
|
||||||
+ MD_FEATURE_BITMAP_OFFSET)) {
|
|
||||||
rv = st->ss->write_bitmap(st, di->fd, NodeNumUpdate);
|
|
||||||
} else if (rv == 0 &&
|
|
||||||
(__le32_to_cpu(sb->feature_map) & MD_FEATURE_PPL)) {
|
|
||||||
@@ -2014,8 +2078,7 @@ static int write_init_super1(struct supertype *st)
|
|
||||||
}
|
|
||||||
error_out:
|
|
||||||
if (rv)
|
|
||||||
- pr_err("Failed to write metadata to %s\n",
|
|
||||||
- di->devname);
|
|
||||||
+ pr_err("Failed to write metadata to %s\n", di->devname);
|
|
||||||
out:
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
@@ -2080,7 +2143,8 @@ static int load_super1(struct supertype *st, int fd, char *devname)
|
|
||||||
/* guess... choose latest ctime */
|
|
||||||
memset(&tst, 0, sizeof(tst));
|
|
||||||
tst.ss = &super1;
|
|
||||||
- for (tst.minor_version = 0; tst.minor_version <= 2 ; tst.minor_version++) {
|
|
||||||
+ for (tst.minor_version = 0; tst.minor_version <= 2;
|
|
||||||
+ tst.minor_version++) {
|
|
||||||
switch(load_super1(&tst, fd, devname)) {
|
|
||||||
case 0: super = tst.sb;
|
|
||||||
if (bestvers == -1 ||
|
|
||||||
@@ -2167,7 +2231,8 @@ static int load_super1(struct supertype *st, int fd, char *devname)
|
|
||||||
if (__le32_to_cpu(super->magic) != MD_SB_MAGIC) {
|
|
||||||
if (devname)
|
|
||||||
pr_err("No super block found on %s (Expected magic %08x, got %08x)\n",
|
|
||||||
- devname, MD_SB_MAGIC, __le32_to_cpu(super->magic));
|
|
||||||
+ devname, MD_SB_MAGIC,
|
|
||||||
+ __le32_to_cpu(super->magic));
|
|
||||||
free(super);
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
@@ -2190,7 +2255,8 @@ static int load_super1(struct supertype *st, int fd, char *devname)
|
|
||||||
|
|
||||||
bsb = (struct bitmap_super_s *)(((char*)super)+MAX_SB_SIZE);
|
|
||||||
|
|
||||||
- misc = (struct misc_dev_info*) (((char*)super)+MAX_SB_SIZE+BM_SUPER_SIZE);
|
|
||||||
+ misc = (struct misc_dev_info*)
|
|
||||||
+ (((char*)super)+MAX_SB_SIZE+BM_SUPER_SIZE);
|
|
||||||
misc->device_size = dsize;
|
|
||||||
if (st->data_offset == INVALID_SECTORS)
|
|
||||||
st->data_offset = __le64_to_cpu(super->data_offset);
|
|
||||||
@@ -2230,13 +2296,11 @@ static struct supertype *match_metadata_desc1(char *arg)
|
|
||||||
/* leading zeros can be safely ignored. --detail generates them. */
|
|
||||||
while (*arg == '0')
|
|
||||||
arg++;
|
|
||||||
- if (strcmp(arg, "1.0") == 0 ||
|
|
||||||
- strcmp(arg, "1.00") == 0) {
|
|
||||||
+ if (strcmp(arg, "1.0") == 0 || strcmp(arg, "1.00") == 0) {
|
|
||||||
st->minor_version = 0;
|
|
||||||
return st;
|
|
||||||
}
|
|
||||||
- if (strcmp(arg, "1.1") == 0 ||
|
|
||||||
- strcmp(arg, "1.01") == 0
|
|
||||||
+ if (strcmp(arg, "1.1") == 0 || strcmp(arg, "1.01") == 0
|
|
||||||
) {
|
|
||||||
st->minor_version = 1;
|
|
||||||
return st;
|
|
||||||
@@ -2249,8 +2313,7 @@ static struct supertype *match_metadata_desc1(char *arg)
|
|
||||||
st->minor_version = 2;
|
|
||||||
return st;
|
|
||||||
}
|
|
||||||
- if (strcmp(arg, "1") == 0 ||
|
|
||||||
- strcmp(arg, "default") == 0) {
|
|
||||||
+ if (strcmp(arg, "1") == 0 || strcmp(arg, "default") == 0) {
|
|
||||||
st->minor_version = -1;
|
|
||||||
return st;
|
|
||||||
}
|
|
||||||
@@ -2348,20 +2411,26 @@ add_internal_bitmap1(struct supertype *st,
|
|
||||||
int uuid[4];
|
|
||||||
|
|
||||||
if (__le64_to_cpu(sb->data_size) == 0)
|
|
||||||
- /* Must be creating the array, else data_size would be non-zero */
|
|
||||||
+ /*
|
|
||||||
+ * Must be creating the array, else data_size
|
|
||||||
+ * would be non-zero
|
|
||||||
+ */
|
|
||||||
creating = 1;
|
|
||||||
switch(st->minor_version) {
|
|
||||||
case 0:
|
|
||||||
- /* either 3K after the superblock (when hot-add),
|
|
||||||
+ /*
|
|
||||||
+ * either 3K after the superblock (when hot-add),
|
|
||||||
* or some amount of space before.
|
|
||||||
*/
|
|
||||||
if (creating) {
|
|
||||||
- /* We are creating array, so we *know* how much room has
|
|
||||||
+ /*
|
|
||||||
+ * We are creating array, so we *know* how much room has
|
|
||||||
* been left.
|
|
||||||
*/
|
|
||||||
offset = 0;
|
|
||||||
bbl_size = 8;
|
|
||||||
- room = choose_bm_space(__le64_to_cpu(sb->size)) + bbl_size;
|
|
||||||
+ room =
|
|
||||||
+ choose_bm_space(__le64_to_cpu(sb->size)) + bbl_size;
|
|
||||||
} else {
|
|
||||||
room = __le64_to_cpu(sb->super_offset)
|
|
||||||
- __le64_to_cpu(sb->data_offset)
|
|
||||||
@@ -2373,8 +2442,8 @@ add_internal_bitmap1(struct supertype *st,
|
|
||||||
if (bbl_size < -bbl_offset)
|
|
||||||
bbl_size = -bbl_offset;
|
|
||||||
|
|
||||||
- if (!may_change || (room < 3*2 &&
|
|
||||||
- __le32_to_cpu(sb->max_dev) <= 384)) {
|
|
||||||
+ if (!may_change ||
|
|
||||||
+ (room < 3*2 && __le32_to_cpu(sb->max_dev) <= 384)) {
|
|
||||||
room = 3*2;
|
|
||||||
offset = 1*2;
|
|
||||||
bbl_size = 0;
|
|
||||||
@@ -2388,13 +2457,15 @@ add_internal_bitmap1(struct supertype *st,
|
|
||||||
if (creating) {
|
|
||||||
offset = 4*2;
|
|
||||||
bbl_size = 8;
|
|
||||||
- room = choose_bm_space(__le64_to_cpu(sb->size)) + bbl_size;
|
|
||||||
+ room =
|
|
||||||
+ choose_bm_space(__le64_to_cpu(sb->size)) + bbl_size;
|
|
||||||
} else {
|
|
||||||
room = __le64_to_cpu(sb->data_offset)
|
|
||||||
- __le64_to_cpu(sb->super_offset);
|
|
||||||
bbl_size = __le16_to_cpu(sb->bblog_size);
|
|
||||||
if (bbl_size)
|
|
||||||
- room = __le32_to_cpu(sb->bblog_offset) + bbl_size;
|
|
||||||
+ room =
|
|
||||||
+ __le32_to_cpu(sb->bblog_offset) + bbl_size;
|
|
||||||
else
|
|
||||||
bbl_size = 8;
|
|
||||||
|
|
||||||
@@ -2453,8 +2524,8 @@ add_internal_bitmap1(struct supertype *st,
|
|
||||||
|
|
||||||
sb->bitmap_offset = (int32_t)__cpu_to_le32(offset);
|
|
||||||
|
|
||||||
- sb->feature_map = __cpu_to_le32(__le32_to_cpu(sb->feature_map)
|
|
||||||
- | MD_FEATURE_BITMAP_OFFSET);
|
|
||||||
+ sb->feature_map = __cpu_to_le32(__le32_to_cpu(sb->feature_map) |
|
|
||||||
+ MD_FEATURE_BITMAP_OFFSET);
|
|
||||||
memset(bms, 0, sizeof(*bms));
|
|
||||||
bms->magic = __cpu_to_le32(BITMAP_MAGIC);
|
|
||||||
bms->version = __cpu_to_le32(major);
|
|
||||||
@@ -2466,8 +2537,8 @@ add_internal_bitmap1(struct supertype *st,
|
|
||||||
bms->write_behind = __cpu_to_le32(write_behind);
|
|
||||||
bms->nodes = __cpu_to_le32(st->nodes);
|
|
||||||
if (st->nodes)
|
|
||||||
- sb->feature_map = __cpu_to_le32(__le32_to_cpu(sb->feature_map)
|
|
||||||
- | MD_FEATURE_BITMAP_VERSIONED);
|
|
||||||
+ sb->feature_map = __cpu_to_le32(__le32_to_cpu(sb->feature_map) |
|
|
||||||
+ MD_FEATURE_BITMAP_VERSIONED);
|
|
||||||
if (st->cluster_name) {
|
|
||||||
len = sizeof(bms->cluster_name);
|
|
||||||
strncpy((char *)bms->cluster_name, st->cluster_name, len);
|
|
||||||
@@ -2528,31 +2599,43 @@ static int write_bitmap1(struct supertype *st, int fd, enum bitmap_update update
|
|
||||||
break;
|
|
||||||
case NodeNumUpdate:
|
|
||||||
/* cluster md only supports superblock 1.2 now */
|
|
||||||
- if (st->minor_version != 2 && bms->version == BITMAP_MAJOR_CLUSTERED) {
|
|
||||||
+ if (st->minor_version != 2 &&
|
|
||||||
+ bms->version == BITMAP_MAJOR_CLUSTERED) {
|
|
||||||
pr_err("Warning: cluster md only works with superblock 1.2\n");
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bms->version == BITMAP_MAJOR_CLUSTERED) {
|
|
||||||
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 */
|
|
||||||
+ /*
|
|
||||||
+ * Since the nodes num is not increased, no
|
|
||||||
+ * need to check the space enough or not,
|
|
||||||
+ * just update bms->nodes
|
|
||||||
+ */
|
|
||||||
bms->nodes = __cpu_to_le32(st->nodes);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
- /* no need to change bms->nodes for other bitmap types */
|
|
||||||
+ /*
|
|
||||||
+ * no need to change bms->nodes for other
|
|
||||||
+ * bitmap types
|
|
||||||
+ */
|
|
||||||
if (st->nodes)
|
|
||||||
pr_err("Warning: --nodes option is only suitable for clustered bitmap\n");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
- /* Each node has an independent bitmap, it is necessary to calculate the
|
|
||||||
- * space is enough or not, first get how many bytes for the total bitmap */
|
|
||||||
+ /*
|
|
||||||
+ * Each node has an independent bitmap, it is necessary to
|
|
||||||
+ * calculate the space is enough or not, first get how many
|
|
||||||
+ * bytes for the total bitmap
|
|
||||||
+ */
|
|
||||||
bm_space_per_node = calc_bitmap_size(bms, 4096);
|
|
||||||
|
|
||||||
- total_bm_space = 512 * (__le64_to_cpu(sb->data_offset) - __le64_to_cpu(sb->super_offset));
|
|
||||||
- total_bm_space = total_bm_space - 4096; /* leave another 4k for superblock */
|
|
||||||
+ total_bm_space = 512 * (__le64_to_cpu(sb->data_offset) -
|
|
||||||
+ __le64_to_cpu(sb->super_offset));
|
|
||||||
+ /* leave another 4k for superblock */
|
|
||||||
+ total_bm_space = total_bm_space - 4096;
|
|
||||||
|
|
||||||
if (bm_space_per_node * st->nodes > total_bm_space) {
|
|
||||||
pr_err("Warning: The max num of nodes can't exceed %llu\n",
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
@ -1,65 +0,0 @@
|
|||||||
From 5e13ef714df4734c455b5e4389352c8ab7902038 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jes Sorensen <jsorensen@fb.com>
|
|
||||||
Date: Wed, 12 Apr 2017 14:48:10 -0400
|
|
||||||
Subject: [PATCH] Detail: Remove pre-2.6 code for printing info on rebuilding
|
|
||||||
Git-commit: 5e13ef714df4734c455b5e4389352c8ab7902038
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
Since we no longer support anything pre-2.6.15, there is no point in
|
|
||||||
keeping this around.
|
|
||||||
|
|
||||||
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
Detail.c | 19 +++----------------
|
|
||||||
1 file changed, 3 insertions(+), 16 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Detail.c b/Detail.c
|
|
||||||
index d4e6204..8f74832 100644
|
|
||||||
--- a/Detail.c
|
|
||||||
+++ b/Detail.c
|
|
||||||
@@ -64,8 +64,6 @@ int Detail(char *dev, struct context *c)
|
|
||||||
int max_devices = 0, n_devices = 0;
|
|
||||||
int spares = 0;
|
|
||||||
struct stat stb;
|
|
||||||
- int is_26 = get_linux_version() >= 2006000;
|
|
||||||
- int is_rebuilding = 0;
|
|
||||||
int failed = 0;
|
|
||||||
struct supertype *st;
|
|
||||||
char *subarray = NULL;
|
|
||||||
@@ -527,7 +525,6 @@ int Detail(char *dev, struct context *c)
|
|
||||||
"Reshape", "Check"};
|
|
||||||
printf(" %7s Status : %d%% complete\n",
|
|
||||||
sync_action[e->resync], e->percent);
|
|
||||||
- is_rebuilding = 1;
|
|
||||||
}
|
|
||||||
free_mdstat(ms);
|
|
||||||
|
|
||||||
@@ -676,19 +673,9 @@ This is pretty boring
|
|
||||||
|(1<<MD_DISK_REMOVED)|(1<<MD_DISK_FAULTY)|(1<<MD_DISK_JOURNAL)))
|
|
||||||
== 0) {
|
|
||||||
printf(" spare");
|
|
||||||
- if (is_26) {
|
|
||||||
- if (disk.raid_disk < array.raid_disks && disk.raid_disk >= 0)
|
|
||||||
- printf(" rebuilding");
|
|
||||||
- } else if (is_rebuilding && failed) {
|
|
||||||
- /* Taking a bit of a risk here, we remove the
|
|
||||||
- * device from the array, and then put it back.
|
|
||||||
- * If this fails, we are rebuilding
|
|
||||||
- */
|
|
||||||
- int err = ioctl(fd, HOT_REMOVE_DISK, makedev(disk.major, disk.minor));
|
|
||||||
- if (err == 0) ioctl(fd, HOT_ADD_DISK, makedev(disk.major, disk.minor));
|
|
||||||
- if (err && errno == EBUSY)
|
|
||||||
- printf(" rebuilding");
|
|
||||||
- }
|
|
||||||
+ if (disk.raid_disk < array.raid_disks &&
|
|
||||||
+ disk.raid_disk >= 0)
|
|
||||||
+ printf(" rebuilding");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (disk.state == 0) spares++;
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
|||||||
From 0ef1043ce8dd3f36c7227aa4a260819c4c17c78d Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jes Sorensen <jsorensen@fb.com>
|
|
||||||
Date: Wed, 12 Apr 2017 14:50:02 -0400
|
|
||||||
Subject: [PATCH] Assemble: Remove obsolete test for kernels older than 2.4
|
|
||||||
Git-commit: 0ef1043ce8dd3f36c7227aa4a260819c4c17c78d
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
We only support 2.6.15+ at this point
|
|
||||||
|
|
||||||
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
Assemble.c | 7 -------
|
|
||||||
1 file changed, 7 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Assemble.c b/Assemble.c
|
|
||||||
index 22596b5..d6beb23 100644
|
|
||||||
--- a/Assemble.c
|
|
||||||
+++ b/Assemble.c
|
|
||||||
@@ -1487,13 +1487,6 @@ try_again:
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
mddev = chosen_name;
|
|
||||||
- if (get_linux_version() < 2004000) {
|
|
||||||
- pr_err("Assemble requires Linux 2.4 or later, and\n"
|
|
||||||
- " md driver version 0.90.0 or later.\n"
|
|
||||||
- " Upgrade your kernel or try --build\n");
|
|
||||||
- close(mdfd);
|
|
||||||
- return 1;
|
|
||||||
- }
|
|
||||||
if (pre_exist == NULL) {
|
|
||||||
if (mddev_busy(fd2devnm(mdfd))) {
|
|
||||||
pr_err("%s already active, cannot restart it!\n",
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
|||||||
From 776b199e41d10e344efc47008366ca46715c5acc Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jes Sorensen <jsorensen@fb.com>
|
|
||||||
Date: Wed, 12 Apr 2017 17:05:55 -0400
|
|
||||||
Subject: [PATCH] Detail: Fixup ugly if () foo() abuse
|
|
||||||
Git-commit: 776b199e41d10e344efc47008366ca46715c5acc
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
Cosmetic change only
|
|
||||||
|
|
||||||
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
Detail.c | 8 +++++---
|
|
||||||
1 file changed, 5 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Detail.c b/Detail.c
|
|
||||||
index 8f74832..e40cd8f 100644
|
|
||||||
--- a/Detail.c
|
|
||||||
+++ b/Detail.c
|
|
||||||
@@ -141,13 +141,15 @@ int Detail(char *dev, struct context *c)
|
|
||||||
}
|
|
||||||
|
|
||||||
/* try to load a superblock. Try sra->devs first, then try ioctl */
|
|
||||||
- if (st && !info) for (d = 0, subdev = sra ? sra->devs : NULL;
|
|
||||||
- d < max_disks || subdev;
|
|
||||||
- subdev ? (void)(subdev = subdev->next) : (void)(d++)){
|
|
||||||
+ if (st && !info)
|
|
||||||
+ for (d = 0, subdev = sra ? sra->devs : NULL;
|
|
||||||
+ d < max_disks || subdev;
|
|
||||||
+ subdev ? (void)(subdev = subdev->next) : (void)(d++)){
|
|
||||||
mdu_disk_info_t disk;
|
|
||||||
char *dv;
|
|
||||||
int fd2;
|
|
||||||
int err;
|
|
||||||
+
|
|
||||||
if (subdev)
|
|
||||||
disk = subdev->disk;
|
|
||||||
else {
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
@ -1,77 +0,0 @@
|
|||||||
From 8d0cd09d73a9a9d57ee73b7a79114e881dad1507 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jes Sorensen <jsorensen@fb.com>
|
|
||||||
Date: Thu, 13 Apr 2017 11:53:21 -0400
|
|
||||||
Subject: [PATCH] Query: Handle error returned by fstat()
|
|
||||||
Git-commit: 8d0cd09d73a9a9d57ee73b7a79114e881dad1507
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
We shouldn't ignore any error returned by fstat() even if open() didn't
|
|
||||||
fail.
|
|
||||||
|
|
||||||
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
Query.c | 19 ++++++++++++-------
|
|
||||||
1 file changed, 12 insertions(+), 7 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Query.c b/Query.c
|
|
||||||
index bea273f..0d18da4 100644
|
|
||||||
--- a/Query.c
|
|
||||||
+++ b/Query.c
|
|
||||||
@@ -32,22 +32,21 @@ int Query(char *dev)
|
|
||||||
* whether it is an md device and whether it has
|
|
||||||
* a superblock
|
|
||||||
*/
|
|
||||||
- int fd = open(dev, O_RDONLY);
|
|
||||||
- int ioctlerr;
|
|
||||||
+ int fd;
|
|
||||||
+ int ioctlerr, staterr;
|
|
||||||
int superror;
|
|
||||||
struct mdinfo info;
|
|
||||||
mdu_array_info_t array;
|
|
||||||
struct supertype *st = NULL;
|
|
||||||
-
|
|
||||||
unsigned long long larray_size;
|
|
||||||
struct stat stb;
|
|
||||||
char *mddev;
|
|
||||||
mdu_disk_info_t disc;
|
|
||||||
char *activity;
|
|
||||||
|
|
||||||
+ fd = open(dev, O_RDONLY);
|
|
||||||
if (fd < 0){
|
|
||||||
- pr_err("cannot open %s: %s\n",
|
|
||||||
- dev, strerror(errno));
|
|
||||||
+ pr_err("cannot open %s: %s\n", dev, strerror(errno));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -56,9 +55,12 @@ int Query(char *dev)
|
|
||||||
else
|
|
||||||
ioctlerr = 0;
|
|
||||||
|
|
||||||
- fstat(fd, &stb);
|
|
||||||
+ if (fstat(fd, &stb) < 0)
|
|
||||||
+ staterr = errno;
|
|
||||||
+ else
|
|
||||||
+ staterr = 0;
|
|
||||||
|
|
||||||
- if (!ioctlerr) {
|
|
||||||
+ if (!ioctlerr && !staterr) {
|
|
||||||
if (!get_dev_size(fd, NULL, &larray_size))
|
|
||||||
larray_size = 0;
|
|
||||||
}
|
|
||||||
@@ -68,6 +70,9 @@ int Query(char *dev)
|
|
||||||
else if (ioctlerr)
|
|
||||||
printf("%s: is an md device, but gives \"%s\" when queried\n",
|
|
||||||
dev, strerror(ioctlerr));
|
|
||||||
+ else if (staterr)
|
|
||||||
+ printf("%s: is not a valid md device, returning %s\n",
|
|
||||||
+ dev, strerror(ioctlerr));
|
|
||||||
else {
|
|
||||||
printf("%s: %s %s %d devices, %d spare%s. Use mdadm --detail for more detail.\n",
|
|
||||||
dev,
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
@ -1,84 +0,0 @@
|
|||||||
From f22d6cde7c7e4be38230ac4c51c3af850ed1614e Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jes Sorensen <jsorensen@fb.com>
|
|
||||||
Date: Thu, 13 Apr 2017 12:20:46 -0400
|
|
||||||
Subject: [PATCH] Query: Use sysfs to obtain data if possible
|
|
||||||
Git-commit: f22d6cde7c7e4be38230ac4c51c3af850ed1614e
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
Use sysfs to obtain leve, raid_disks, and spare_disks. If sysfs fails,
|
|
||||||
fall back to calling the ioctl via md_get_array_info().
|
|
||||||
|
|
||||||
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
Query.c | 32 ++++++++++++++++++++++----------
|
|
||||||
1 file changed, 22 insertions(+), 10 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Query.c b/Query.c
|
|
||||||
index 0d18da4..b761c47 100644
|
|
||||||
--- a/Query.c
|
|
||||||
+++ b/Query.c
|
|
||||||
@@ -35,7 +35,9 @@ int Query(char *dev)
|
|
||||||
int fd;
|
|
||||||
int ioctlerr, staterr;
|
|
||||||
int superror;
|
|
||||||
+ int level, raid_disks, spare_disks;
|
|
||||||
struct mdinfo info;
|
|
||||||
+ struct mdinfo *sra;
|
|
||||||
mdu_array_info_t array;
|
|
||||||
struct supertype *st = NULL;
|
|
||||||
unsigned long long larray_size;
|
|
||||||
@@ -50,16 +52,28 @@ int Query(char *dev)
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (md_get_array_info(fd, &array) < 0)
|
|
||||||
- ioctlerr = errno;
|
|
||||||
- else
|
|
||||||
- ioctlerr = 0;
|
|
||||||
-
|
|
||||||
if (fstat(fd, &stb) < 0)
|
|
||||||
staterr = errno;
|
|
||||||
else
|
|
||||||
staterr = 0;
|
|
||||||
|
|
||||||
+ ioctlerr = 0;
|
|
||||||
+
|
|
||||||
+ sra = sysfs_read(fd, dev, GET_DISKS | GET_LEVEL | GET_DEVS | GET_STATE);
|
|
||||||
+ if (sra) {
|
|
||||||
+ level = sra->array.level;
|
|
||||||
+ raid_disks = sra->array.raid_disks;
|
|
||||||
+ spare_disks = sra->array.spare_disks;
|
|
||||||
+ } else {
|
|
||||||
+ if (md_get_array_info(fd, &array) < 0) {
|
|
||||||
+ ioctlerr = errno;
|
|
||||||
+ } else {
|
|
||||||
+ level = array.level;
|
|
||||||
+ raid_disks = array.raid_disks;
|
|
||||||
+ spare_disks = array.spare_disks;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
if (!ioctlerr && !staterr) {
|
|
||||||
if (!get_dev_size(fd, NULL, &larray_size))
|
|
||||||
larray_size = 0;
|
|
||||||
@@ -75,11 +89,9 @@ int Query(char *dev)
|
|
||||||
dev, strerror(ioctlerr));
|
|
||||||
else {
|
|
||||||
printf("%s: %s %s %d devices, %d spare%s. Use mdadm --detail for more detail.\n",
|
|
||||||
- dev,
|
|
||||||
- human_size_brief(larray_size,IEC),
|
|
||||||
- map_num(pers, array.level),
|
|
||||||
- array.raid_disks,
|
|
||||||
- array.spare_disks, array.spare_disks==1?"":"s");
|
|
||||||
+ dev, human_size_brief(larray_size,IEC),
|
|
||||||
+ map_num(pers, level), raid_disks,
|
|
||||||
+ spare_disks, spare_disks == 1 ? "" : "s");
|
|
||||||
}
|
|
||||||
st = guess_super(fd);
|
|
||||||
if (st && st->ss->compare_super != NULL)
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
@ -1,121 +0,0 @@
|
|||||||
From 5e4ca8bb82e98400c9258cb3d7e4d030576f21df Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jes Sorensen <jsorensen@fb.com>
|
|
||||||
Date: Wed, 19 Apr 2017 23:27:58 -0400
|
|
||||||
Subject: [PATCH] sysfs: Parse array_state in sysfs_read()
|
|
||||||
Git-commit: 5e4ca8bb82e98400c9258cb3d7e4d030576f21df
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
Rather than copying in the array_state string, parse it and use an
|
|
||||||
enum to indicate the state.
|
|
||||||
|
|
||||||
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
Manage.c | 2 +-
|
|
||||||
maps.c | 17 +++++++++++++++++
|
|
||||||
mdadm.h | 17 ++++++++++++++---
|
|
||||||
sysfs.c | 9 +++++----
|
|
||||||
4 files changed, 37 insertions(+), 8 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Manage.c b/Manage.c
|
|
||||||
index bb84d28..8966e33 100644
|
|
||||||
--- a/Manage.c
|
|
||||||
+++ b/Manage.c
|
|
||||||
@@ -929,7 +929,7 @@ int Manage_add(int fd, int tfd, struct mddev_dev *dv,
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (strncmp(mdp->sysfs_array_state, "readonly", 8) != 0) {
|
|
||||||
+ if (mdp->array_state != ARRAY_READONLY) {
|
|
||||||
sysfs_free(mdp);
|
|
||||||
pr_err("%s is not readonly, cannot add journal.\n", devname);
|
|
||||||
return -1;
|
|
||||||
diff --git a/maps.c b/maps.c
|
|
||||||
index d9ee7de..a8a4639 100644
|
|
||||||
--- a/maps.c
|
|
||||||
+++ b/maps.c
|
|
||||||
@@ -139,6 +139,23 @@ mapping_t consistency_policies[] = {
|
|
||||||
{ NULL, 0}
|
|
||||||
};
|
|
||||||
|
|
||||||
+mapping_t sysfs_array_states[] = {
|
|
||||||
+ /*
|
|
||||||
+ * Beware map_name() uses strcmp() so active-idle must come before
|
|
||||||
+ * active, to be detected correctly.
|
|
||||||
+ */
|
|
||||||
+ { "active-idle", ARRAY_ACTIVE_IDLE },
|
|
||||||
+ { "active", ARRAY_ACTIVE },
|
|
||||||
+ { "clear", ARRAY_CLEAR },
|
|
||||||
+ { "inactive", ARRAY_INACTIVE },
|
|
||||||
+ { "suspended", ARRAY_SUSPENDED },
|
|
||||||
+ { "readonly", ARRAY_READONLY },
|
|
||||||
+ { "read-auto", ARRAY_READ_AUTO },
|
|
||||||
+ { "clean", ARRAY_CLEAN },
|
|
||||||
+ { "write-pending", ARRAY_WRITE_PENDING },
|
|
||||||
+ { NULL, 0 }
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
char *map_num(mapping_t *map, int num)
|
|
||||||
{
|
|
||||||
while (map->name) {
|
|
||||||
diff --git a/mdadm.h b/mdadm.h
|
|
||||||
index f1f643c..a379973 100644
|
|
||||||
--- a/mdadm.h
|
|
||||||
+++ b/mdadm.h
|
|
||||||
@@ -335,8 +335,18 @@ struct mdinfo {
|
|
||||||
int prev_state, curr_state, next_state;
|
|
||||||
|
|
||||||
/* info read from sysfs */
|
|
||||||
- char sysfs_array_state[20];
|
|
||||||
-
|
|
||||||
+ enum {
|
|
||||||
+ ARRAY_CLEAR,
|
|
||||||
+ ARRAY_INACTIVE,
|
|
||||||
+ ARRAY_SUSPENDED,
|
|
||||||
+ ARRAY_READONLY,
|
|
||||||
+ ARRAY_READ_AUTO,
|
|
||||||
+ ARRAY_CLEAN,
|
|
||||||
+ ARRAY_ACTIVE,
|
|
||||||
+ ARRAY_WRITE_PENDING,
|
|
||||||
+ ARRAY_ACTIVE_IDLE,
|
|
||||||
+ ARRAY_UNKNOWN_STATE,
|
|
||||||
+ } array_state;
|
|
||||||
struct md_bb bb;
|
|
||||||
};
|
|
||||||
|
|
||||||
@@ -716,7 +726,8 @@ extern int restore_stripes(int *dest, unsigned long long *offsets,
|
|
||||||
|
|
||||||
extern char *map_num(mapping_t *map, int num);
|
|
||||||
extern int map_name(mapping_t *map, char *name);
|
|
||||||
-extern mapping_t r5layout[], r6layout[], pers[], modes[], faultylayout[], consistency_policies[];
|
|
||||||
+extern mapping_t r5layout[], r6layout[], pers[], modes[], faultylayout[];
|
|
||||||
+extern mapping_t consistency_policies[], sysfs_array_states[];
|
|
||||||
|
|
||||||
extern char *map_dev_preferred(int major, int minor, int create,
|
|
||||||
char *prefer);
|
|
||||||
diff --git a/sysfs.c b/sysfs.c
|
|
||||||
index 51deb23..c6df9b0 100644
|
|
||||||
--- a/sysfs.c
|
|
||||||
+++ b/sysfs.c
|
|
||||||
@@ -247,11 +247,12 @@ struct mdinfo *sysfs_read(int fd, char *devnm, unsigned long options)
|
|
||||||
|
|
||||||
if (options & GET_ARRAY_STATE) {
|
|
||||||
strcpy(base, "array_state");
|
|
||||||
- if (load_sys(fname, sra->sysfs_array_state,
|
|
||||||
- sizeof(sra->sysfs_array_state)))
|
|
||||||
+ if (load_sys(fname, buf, sizeof(buf)))
|
|
||||||
goto abort;
|
|
||||||
- } else
|
|
||||||
- sra->sysfs_array_state[0] = 0;
|
|
||||||
+ sra->array_state = map_name(sysfs_array_states, buf);
|
|
||||||
+ if (sra->array_state == UnSet)
|
|
||||||
+ sra->array_state = ARRAY_UNKNOWN_STATE;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
if (options & GET_CONSISTENCY_POLICY) {
|
|
||||||
strcpy(base, "consistency_policy");
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
@ -1,104 +0,0 @@
|
|||||||
From 3ab8f4bf33d906cb1084f7b4036556bfb4bb73ec Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jes Sorensen <jsorensen@fb.com>
|
|
||||||
Date: Thu, 13 Apr 2017 13:30:17 -0400
|
|
||||||
Subject: [PATCH] util: Introduce md_array_active() helper
|
|
||||||
Git-commit: 3ab8f4bf33d906cb1084f7b4036556bfb4bb73ec
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
Rather than querying md_get_array_info() to determine whether an array
|
|
||||||
is valid, do the work in md_array_active() using sysfs, and fall back
|
|
||||||
on md_get_array_info() if sysfs fails.
|
|
||||||
|
|
||||||
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
Query.c | 5 +++--
|
|
||||||
mdadm.h | 1 +
|
|
||||||
util.c | 27 +++++++++++++++++++++++++++
|
|
||||||
3 files changed, 31 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Query.c b/Query.c
|
|
||||||
index b761c47..4dec9f5 100644
|
|
||||||
--- a/Query.c
|
|
||||||
+++ b/Query.c
|
|
||||||
@@ -38,7 +38,6 @@ int Query(char *dev)
|
|
||||||
int level, raid_disks, spare_disks;
|
|
||||||
struct mdinfo info;
|
|
||||||
struct mdinfo *sra;
|
|
||||||
- mdu_array_info_t array;
|
|
||||||
struct supertype *st = NULL;
|
|
||||||
unsigned long long larray_size;
|
|
||||||
struct stat stb;
|
|
||||||
@@ -65,6 +64,8 @@ int Query(char *dev)
|
|
||||||
raid_disks = sra->array.raid_disks;
|
|
||||||
spare_disks = sra->array.spare_disks;
|
|
||||||
} else {
|
|
||||||
+ mdu_array_info_t array;
|
|
||||||
+
|
|
||||||
if (md_get_array_info(fd, &array) < 0) {
|
|
||||||
ioctlerr = errno;
|
|
||||||
} else {
|
|
||||||
@@ -111,7 +112,7 @@ int Query(char *dev)
|
|
||||||
disc.number = info.disk.number;
|
|
||||||
activity = "undetected";
|
|
||||||
if (mddev && (fd = open(mddev, O_RDONLY))>=0) {
|
|
||||||
- if (md_get_array_info(fd, &array) >= 0) {
|
|
||||||
+ if (md_array_active(fd)) {
|
|
||||||
if (md_get_disk_info(fd, &disc) >= 0 &&
|
|
||||||
makedev((unsigned)disc.major,(unsigned)disc.minor) == stb.st_rdev)
|
|
||||||
activity = "active";
|
|
||||||
diff --git a/mdadm.h b/mdadm.h
|
|
||||||
index a379973..f6e97fd 100644
|
|
||||||
--- a/mdadm.h
|
|
||||||
+++ b/mdadm.h
|
|
||||||
@@ -1415,6 +1415,7 @@ extern int Dump_metadata(char *dev, char *dir, struct context *c,
|
|
||||||
extern int Restore_metadata(char *dev, char *dir, struct context *c,
|
|
||||||
struct supertype *st, int only);
|
|
||||||
|
|
||||||
+int md_array_active(int fd);
|
|
||||||
int md_get_array_info(int fd, struct mdu_array_info_s *array);
|
|
||||||
int md_set_array_info(int fd, struct mdu_array_info_s *array);
|
|
||||||
int md_get_disk_info(int fd, struct mdu_disk_info_s *disk);
|
|
||||||
diff --git a/util.c b/util.c
|
|
||||||
index a695c45..3adc675 100644
|
|
||||||
--- a/util.c
|
|
||||||
+++ b/util.c
|
|
||||||
@@ -200,6 +200,33 @@ out:
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
+int md_array_active(int fd)
|
|
||||||
+{
|
|
||||||
+ struct mdinfo *sra;
|
|
||||||
+ struct mdu_array_info_s array;
|
|
||||||
+ int ret;
|
|
||||||
+
|
|
||||||
+ sra = sysfs_read(fd, NULL, GET_ARRAY_STATE);
|
|
||||||
+ if (sra) {
|
|
||||||
+ if (sra->array_state != ARRAY_CLEAR &&
|
|
||||||
+ sra->array_state != ARRAY_INACTIVE &&
|
|
||||||
+ sra->array_state != ARRAY_UNKNOWN_STATE)
|
|
||||||
+ ret = 0;
|
|
||||||
+ else
|
|
||||||
+ ret = -ENODEV;
|
|
||||||
+
|
|
||||||
+ free(sra);
|
|
||||||
+ } else {
|
|
||||||
+ /*
|
|
||||||
+ * GET_ARRAY_INFO doesn't provide access to the proper state
|
|
||||||
+ * information, so fallback to a basic check for raid_disks != 0
|
|
||||||
+ */
|
|
||||||
+ ret = ioctl(fd, GET_ARRAY_INFO, &array);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return !ret;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
/*
|
|
||||||
* Get array info from the kernel. Longer term we want to deprecate the
|
|
||||||
* ioctl and get it from sysfs.
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
@ -1,111 +0,0 @@
|
|||||||
From 5e8e35fb7e17495032e144f319517dcae38d1b56 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jes Sorensen <jsorensen@fb.com>
|
|
||||||
Date: Thu, 20 Apr 2017 00:19:44 -0400
|
|
||||||
Subject: [PATCH] maps: Use keyvalue for null terminator to indicate 'unset'
|
|
||||||
value
|
|
||||||
Git-commit: 5e8e35fb7e17495032e144f319517dcae38d1b56
|
|
||||||
Patch-mainline: mdadm-4.0+
|
|
||||||
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
||||||
|
|
||||||
This simplifies the code calling map_name() so it no longer has to
|
|
||||||
manually check for UnSet and convert the value manually.
|
|
||||||
|
|
||||||
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
maps.c | 17 +++++++++--------
|
|
||||||
sysfs.c | 2 --
|
|
||||||
2 files changed, 9 insertions(+), 10 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/maps.c b/maps.c
|
|
||||||
index a2d293b..11dd3d2 100644
|
|
||||||
--- a/maps.c
|
|
||||||
+++ b/maps.c
|
|
||||||
@@ -44,7 +44,7 @@ mapping_t r5layout[] = {
|
|
||||||
{ "ddf-N-restart", ALGORITHM_LEFT_ASYMMETRIC},
|
|
||||||
{ "ddf-N-continue", ALGORITHM_LEFT_SYMMETRIC},
|
|
||||||
|
|
||||||
- { NULL, 0}
|
|
||||||
+ { NULL, UnSet }
|
|
||||||
};
|
|
||||||
mapping_t r6layout[] = {
|
|
||||||
{ "left-asymmetric", ALGORITHM_LEFT_ASYMMETRIC},
|
|
||||||
@@ -70,7 +70,7 @@ mapping_t r6layout[] = {
|
|
||||||
{ "right-symmetric-6", ALGORITHM_RIGHT_SYMMETRIC_6},
|
|
||||||
{ "parity-first-6", ALGORITHM_PARITY_0_6},
|
|
||||||
|
|
||||||
- { NULL, 0}
|
|
||||||
+ { NULL, UnSet }
|
|
||||||
};
|
|
||||||
|
|
||||||
mapping_t pers[] = {
|
|
||||||
@@ -93,7 +93,7 @@ mapping_t pers[] = {
|
|
||||||
{ "10", 10},
|
|
||||||
{ "faulty", LEVEL_FAULTY},
|
|
||||||
{ "container", LEVEL_CONTAINER},
|
|
||||||
- { NULL, 0}
|
|
||||||
+ { NULL, UnSet }
|
|
||||||
};
|
|
||||||
|
|
||||||
mapping_t modes[] = {
|
|
||||||
@@ -106,7 +106,7 @@ mapping_t modes[] = {
|
|
||||||
{ "grow", GROW},
|
|
||||||
{ "incremental", INCREMENTAL},
|
|
||||||
{ "auto-detect", AUTODETECT},
|
|
||||||
- { NULL, 0 }
|
|
||||||
+ { NULL, UnSet }
|
|
||||||
};
|
|
||||||
|
|
||||||
mapping_t faultylayout[] = {
|
|
||||||
@@ -127,7 +127,7 @@ mapping_t faultylayout[] = {
|
|
||||||
{ "flush", ClearFaults},
|
|
||||||
{ "none", ClearErrors},
|
|
||||||
{ "default", ClearErrors},
|
|
||||||
- { NULL, 0}
|
|
||||||
+ { NULL, UnSet }
|
|
||||||
};
|
|
||||||
|
|
||||||
mapping_t consistency_policies[] = {
|
|
||||||
@@ -137,7 +137,7 @@ mapping_t consistency_policies[] = {
|
|
||||||
{ "bitmap", CONSISTENCY_POLICY_BITMAP},
|
|
||||||
{ "journal", CONSISTENCY_POLICY_JOURNAL},
|
|
||||||
{ "ppl", CONSISTENCY_POLICY_PPL},
|
|
||||||
- { NULL, 0}
|
|
||||||
+ { NULL, UnSet }
|
|
||||||
};
|
|
||||||
|
|
||||||
mapping_t sysfs_array_states[] = {
|
|
||||||
@@ -154,7 +154,7 @@ mapping_t sysfs_array_states[] = {
|
|
||||||
{ "read-auto", ARRAY_READ_AUTO },
|
|
||||||
{ "clean", ARRAY_CLEAN },
|
|
||||||
{ "write-pending", ARRAY_WRITE_PENDING },
|
|
||||||
- { NULL, 0 }
|
|
||||||
+ { NULL, ARRAY_UNKNOWN_STATE }
|
|
||||||
};
|
|
||||||
|
|
||||||
char *map_num(mapping_t *map, int num)
|
|
||||||
@@ -174,5 +174,6 @@ int map_name(mapping_t *map, char *name)
|
|
||||||
return map->num;
|
|
||||||
map++;
|
|
||||||
}
|
|
||||||
- return UnSet;
|
|
||||||
+
|
|
||||||
+ return map->num;
|
|
||||||
}
|
|
||||||
diff --git a/sysfs.c b/sysfs.c
|
|
||||||
index c6df9b0..712f8b3 100644
|
|
||||||
--- a/sysfs.c
|
|
||||||
+++ b/sysfs.c
|
|
||||||
@@ -250,8 +250,6 @@ struct mdinfo *sysfs_read(int fd, char *devnm, unsigned long options)
|
|
||||||
if (load_sys(fname, buf, sizeof(buf)))
|
|
||||||
goto abort;
|
|
||||||
sra->array_state = map_name(sysfs_array_states, buf);
|
|
||||||
- if (sra->array_state == UnSet)
|
|
||||||
- sra->array_state = ARRAY_UNKNOWN_STATE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (options & GET_CONSISTENCY_POLICY) {
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user