NeilBrown: Allow --incremental to add spares to an array.

Martin F. Krafft madduck at alioth.debian.org
Fri Sep 3 09:55:16 UTC 2010


Module: mdadm
Branch: debian/conffile-location
Commit: ef83fe7cba7355d3da330325e416747b0696baef
URL:    http://git.debian.org/?p=pkg-mdadm/mdadm.git;a=commit;h=ef83fe7cba7355d3da330325e416747b0696baef

Author: NeilBrown <neilb at suse.de>
Date:   Thu Aug 12 11:41:41 2010 +1000

Allow --incremental to add spares to an array.

Commit 3a6ec29ad56 stopped us from adding apparently-working devices
to an active array with --incremental as there is a good chance that they
are actually old/failed devices.

Unfortunately it also stopped spares from being added to an active
array, which is wrong.  This patch refines the test to be more
careful.

Reported-by: <fibreraid at gmail.com>
Analysed-by: Dan Williams <dan.j.williams at intel.com>
Signed-off-by: NeilBrown <neilb at suse.de>

---

 Incremental.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/Incremental.c b/Incremental.c
index e4b6196..4d3d181 100644
--- a/Incremental.c
+++ b/Incremental.c
@@ -370,14 +370,15 @@ int Incremental(char *devname, int verbose, int runstop,
 		else
 			strcpy(chosen_name, devnum2devname(mp->devnum));
 
-		/* It is generally not OK to add drives to a running array
-		 * as they are probably missing because they failed.
-		 * However if runstop is 1, then the array was possibly
-		 * started early and our best be is to add this anyway.
-		 * It would probably be good to allow explicit policy
-		 * statement about this.
+		/* It is generally not OK to add non-spare drives to a
+		 * running array as they are probably missing because
+		 * they failed.  However if runstop is 1, then the
+		 * array was possibly started early and our best be is
+		 * to add this anyway.  It would probably be good to
+		 * allow explicit policy statement about this.
 		 */
-		if (runstop < 1) {
+		if ((info.disk.state & (1<<MD_DISK_SYNC)) != 0
+		    && runstop < 1) {
 			int active = 0;
 			
 			if (st->ss->external) {




More information about the pkg-mdadm-commits mailing list