From 7eee461e91df702d8f588955b03e5bbb07e1f88d Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Wed, 29 Jul 2015 14:38:37 +1000 Subject: [PATCH 1/4] Assemble: don't assemble IMSM array without OROM. If someone has an IMSM array, and disables RAID in the BIOS and uses the devices for some other purpose, then they really don't want mdadm to start syncing the array. So don't assemble if OROM doesn't confirm it is OK. There can still be problems for crash-dump not being able to find the OROM. Some explicit work-around might be needed for that rather than a more general workaround that can corrupt data. Signed-off-by: NeilBrown --- Assemble.c | 2 +- Incremental.c | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Assemble.c b/Assemble.c index 245e213..06e122d 100644 --- a/Assemble.c +++ b/Assemble.c @@ -1337,7 +1337,7 @@ try_again: mddev ? mddev : "further assembly"); content = &info; - if (st) + if (st && c->force) st->ignore_hw_compat = 1; num_devs = select_devices(devlist, ident, &st, &content, c, inargv, auto_assem); diff --git a/Incremental.c b/Incremental.c index c766ea0..8857619 100644 --- a/Incremental.c +++ b/Incremental.c @@ -130,8 +130,6 @@ int Incremental(struct mddev_dev *devlist, struct context *c, if (must_be_container(dfd)) { if (!st) st = super_by_fd(dfd, NULL); - if (st) - st->ignore_hw_compat = 1; if (st && st->ss->load_container) rv = st->ss->load_container(st, dfd, NULL); @@ -204,7 +202,8 @@ int Incremental(struct mddev_dev *devlist, struct context *c, NULL, c->verbose); goto out; } - st->ignore_hw_compat = 1; + st->ignore_hw_compat = 0; + if (st->ss->compare_super == NULL || st->ss->load_super(st, dfd, NULL)) { if (c->verbose >= 0) @@ -1123,6 +1122,7 @@ static int partition_try_spare(char *devname, int *dfdp, struct dev_policy *pol, if (st2 == NULL || st2->ss->load_super(st2, fd, NULL) < 0) goto next; + st2->ignore_hw_compat = 0; if (!st) { /* Check domain policy again, this time referring to metadata */ @@ -1349,8 +1349,7 @@ restart: struct supertype *st = super_by_fd(mdfd, NULL); int ret = 0; struct map_ent *map = NULL; - if (st) - st->ignore_hw_compat = 1; + if (st && st->ss->load_container) ret = st->ss->load_container(st, mdfd, NULL); close(mdfd); From 187f157bf0b6903a1c72d969550af2dc4fb4fe9b Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Mon, 3 Aug 2015 11:54:16 +1000 Subject: [PATCH 2/4] mdassemble: include mapfile support. This does make mdassemble a bit bigger, but it also means it actually works properly with named arrays. Ref: https://bbs.archlinux.org/viewtopic.php?id=198196 Signed-off-by: NeilBrown --- Makefile | 2 +- mdadm.h | 10 ---------- mdassemble.c | 12 ------------ 3 files changed, 1 insertion(+), 23 deletions(-) diff --git a/Makefile b/Makefile index a7d8c5c..d82e30f 100644 --- a/Makefile +++ b/Makefile @@ -145,7 +145,7 @@ 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 + platform-intel.c probe_roms.c sysfs.c super-mbr.c super-gpt.c mapfile.c ASSEMBLE_AUTO_SRCS := mdopen.c ASSEMBLE_FLAGS:= $(CFLAGS) -DMDASSEMBLE ifdef MDASSEMBLE_AUTO diff --git a/mdadm.h b/mdadm.h index 9df43d4..b597658 100644 --- a/mdadm.h +++ b/mdadm.h @@ -490,18 +490,8 @@ extern int map_update(struct map_ent **mpp, char *devnm, char *metadata, int uuid[4], char *path); extern void map_remove(struct map_ent **map, char *devnm); extern struct map_ent *map_by_uuid(struct map_ent **map, int uuid[4]); -#ifdef MDASSEMBLE -static inline struct map_ent *map_by_devnm(struct map_ent **map, char *name) -{ - return NULL; -} -static inline void map_free(struct map_ent *map) -{ -} -#else extern struct map_ent *map_by_devnm(struct map_ent **map, char *devnm); extern void map_free(struct map_ent *map); -#endif extern struct map_ent *map_by_name(struct map_ent **map, char *name); extern void map_read(struct map_ent **melp); extern int map_write(struct map_ent *mel); diff --git a/mdassemble.c b/mdassemble.c index 667b247..78d363a 100644 --- a/mdassemble.c +++ b/mdassemble.c @@ -50,18 +50,6 @@ int create_mddev(char *dev, char *name, int autof/*unused*/, int trustworthy, return open_mddev(dev, 0); } #endif -int map_update(struct map_ent **mpp, char *devnm, char *metadata, - int *uuid, char *path) -{ - return 0; -} -struct map_ent *map_by_name(struct map_ent **mpp, char *name) -{ - return NULL; -} -int map_lock(struct map_ent **melp){return 0;} -void map_unlock(struct map_ent **melp){} -struct map_ent *map_by_uuid(struct map_ent **map, int uuid[4]){return NULL;} int rv; int mdfd = -1; From 8360760457860206e2719c069b30552e79018c59 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Mon, 3 Aug 2015 16:06:51 +1000 Subject: [PATCH 3/4] Assemble: really don't assemble IMSM array without OROM. Previous patch missed on case. Also print more useful information when rejecting a device with IMSM metadata. Signed-off-by: NeilBrown --- Assemble.c | 4 +++- Incremental.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Assemble.c b/Assemble.c index 06e122d..2925733 100644 --- a/Assemble.c +++ b/Assemble.c @@ -250,7 +250,9 @@ static int select_devices(struct mddev_dev *devlist, pr_err("no recogniseable superblock on %s\n", devname); tmpdev->used = 2; - } else if (tst->ss->load_super(tst,dfd, NULL)) { + } else if ((tst->ignore_hw_compat = 0), + tst->ss->load_super(tst, dfd, + report_mismatch ? devname : NULL)) { if (report_mismatch) pr_err("no RAID superblock on %s\n", devname); diff --git a/Incremental.c b/Incremental.c index 8857619..41876b9 100644 --- a/Incremental.c +++ b/Incremental.c @@ -205,7 +205,7 @@ int Incremental(struct mddev_dev *devlist, struct context *c, st->ignore_hw_compat = 0; if (st->ss->compare_super == NULL || - st->ss->load_super(st, dfd, NULL)) { + st->ss->load_super(st, dfd, c->verbose >= 0 ? devname : NULL)) { if (c->verbose >= 0) pr_err("no RAID superblock on %s.\n", devname); From 69818a5c75ba5982e9d866f94239a2f5975f988e Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Mon, 3 Aug 2015 16:17:13 +1000 Subject: [PATCH 4/4] Release mdadm-3.3.4 Important bugfix release. Signed-off-by: NeilBrown --- ANNOUNCE-3.3.4 | 37 +++++++++++++++++++++++++++++++++++++ ReadMe.c | 4 ++-- inventory | 1 + mdadm.8.in | 2 +- mdadm.spec | 2 +- mdassemble.8 | 2 +- mdmon.8 | 2 +- 7 files changed, 44 insertions(+), 6 deletions(-) create mode 100644 ANNOUNCE-3.3.4 diff --git a/ANNOUNCE-3.3.4 b/ANNOUNCE-3.3.4 new file mode 100644 index 0000000..52b9456 --- /dev/null +++ b/ANNOUNCE-3.3.4 @@ -0,0 +1,37 @@ +Subject: ANNOUNCE: mdadm 3.3.4 - A tool for managing md Soft RAID under Linux + +I am somewhat disappointed to have to announce the availability of + mdadm version 3.3.4 + +It is available at the usual places: + http://www.kernel.org/pub/linux/utils/raid/mdadm/ +and via git at + git://github.com/neilbrown/mdadm + git://neil.brown.name/mdadm + http://git.neil.brown.name/git/mdadm.git + +In mdadm-3.3 a change was made to how IMSM (Intel Matrix Storage +Manager) metadata was handled. Previously an IMSM array would only +be assembled if it was attached to an IMSM controller. + +In 3.3 this was relaxed as there are circumstances where the +controller is not properly detected. Unfortunately this has negative +consequences which have only just come to light. + +If you have an IMSM RAID1 configured and then disable RAID in the +BIOS, the metadata will remain on the devices. If you then install +some other OS on one device and then install Linux on the other, Linux +might eventually start noticing the IMSM metadata (depending a bit on whether +mdadm is included in the initramfs) and might start up the RAID1. This could +copy one device over the other, thus trashing one of the installations. + +Not good. + +So with this release IMSM arrays will only be assembled if attached to +an IMSM controller, or if "--force" is given to --assemble, or if the +environment variable IMSM_NO_PLATFORM is set (used primarily for +testing). + +I strongly recommend upgrading to 3.3.4 if you are using 3.3 or later. + +NeilBrown 3rd August 2015. diff --git a/ReadMe.c b/ReadMe.c index 8af8cd0..386d7a0 100644 --- a/ReadMe.c +++ b/ReadMe.c @@ -25,10 +25,10 @@ #include "mdadm.h" #ifndef VERSION -#define VERSION "3.3.3" +#define VERSION "3.3.4" #endif #ifndef VERS_DATE -#define VERS_DATE "24th July 2015" +#define VERS_DATE "3rd August 2015" #endif char Version[] = "mdadm - v" VERSION " - " VERS_DATE "\n"; diff --git a/inventory b/inventory index 36f2e94..a9fc3c0 100755 --- a/inventory +++ b/inventory @@ -21,6 +21,7 @@ ANNOUNCE-3.3 ANNOUNCE-3.3.1 ANNOUNCE-3.3.2 ANNOUNCE-3.3.3 +ANNOUNCE-3.3.4 Assemble.c Build.c COPYING diff --git a/mdadm.8.in b/mdadm.8.in index 912ee4c..c25ac6c 100644 --- a/mdadm.8.in +++ b/mdadm.8.in @@ -5,7 +5,7 @@ .\" the Free Software Foundation; either version 2 of the License, or .\" (at your option) any later version. .\" See file COPYING in distribution for details. -.TH MDADM 8 "" v3.3.3 +.TH MDADM 8 "" v3.3.4 .SH NAME mdadm \- manage MD devices .I aka diff --git a/mdadm.spec b/mdadm.spec index b5e0b69..293cb19 100644 --- a/mdadm.spec +++ b/mdadm.spec @@ -1,6 +1,6 @@ Summary: mdadm is used for controlling Linux md devices (aka RAID arrays) Name: mdadm -Version: 3.3.3 +Version: 3.3.4 Release: 1 Source: http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}.tar.gz URL: http://neil.brown.name/blog/mdadm diff --git a/mdassemble.8 b/mdassemble.8 index 9a00938..7601b1a 100644 --- a/mdassemble.8 +++ b/mdassemble.8 @@ -1,5 +1,5 @@ .\" -*- nroff -*- -.TH MDASSEMBLE 8 "" v3.3.3 +.TH MDASSEMBLE 8 "" v3.3.4 .SH NAME mdassemble \- assemble MD devices .I aka diff --git a/mdmon.8 b/mdmon.8 index 86fbb15..beb82e0 100644 --- a/mdmon.8 +++ b/mdmon.8 @@ -1,5 +1,5 @@ .\" See file COPYING in distribution for details. -.TH MDMON 8 "" v3.3.3 +.TH MDMON 8 "" v3.3.4 .SH NAME mdmon \- monitor MD external metadata arrays