File 0003-Fix-incremental-to-not-create-an-array-but-add-to-ex.patch of Package mdadm

From faa2b99b77f16b027eabf4345e0031ec88d0450e Mon Sep 17 00:00:00 2001
From: Goldwyn Rodrigues <rgoldwyn@suse.com>
Date: Wed, 26 Aug 2015 11:35:21 -0500
Subject: [PATCH 3/3] Fix incremental to not create an array, but add to
 existing

06bd679317a2a514aa7d51b54b5ad2a01742e42e disabled incremental completely.
What we really want is that mdadm should not start or create
a clustered array but still be able to add or readd to an existing
device. This would enable udev scripts to automatically add
or re-add a device after transient errors.
---
 Incremental.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

--- a/Incremental.c
+++ b/Incremental.c
@@ -234,11 +234,6 @@ int Incremental(struct mddev_dev *devlis
 				devname);
 		goto out;
 	}
-	/* Skip the clustered ones. This should be started by
-	 * clustering resource agents
-	 */
-	if (info.array.state & (1 << MD_SB_CLUSTERED))
-		goto out;
 
 	/* 3a/ if not, check for homehost match.  If no match, continue
 	 * but don't trust the 'name' in the array. Thus a 'random' minor
@@ -322,6 +317,12 @@ int Incremental(struct mddev_dev *devlis
 
 	if (mdfd < 0) {
 
+		/* Skip the clustered ones. This should be started by
+		 * clustering resource agents
+		 */
+		if (info.array.state & (1 << MD_SB_CLUSTERED))
+			goto out;
+
 		/* Couldn't find an existing array, maybe make a new one */
 		mdfd = create_mddev(match ? match->devname : NULL,
 				    name_to_use, c->autof, trustworthy, chosen_name);
openSUSE Build Service is sponsored by