File 0160-Monitor-Include-containers-in-spare-migration.patch of Package mdadm.7989

From 2dab69c9e3acace828bbb6a00514fa820f8ca64f Mon Sep 17 00:00:00 2001
From: Mariusz Tkaczyk <>
Date: Wed, 16 Aug 2017 14:59:46 +0200
Subject: [PATCH] Monitor: Include containers in spare migration
Git-commit: 2dab69c9e3acace828bbb6a00514fa820f8ca64f
Patch-mainline: mdadm-4.0+
References: bsc#1069165, bsc#1069167, bsc#1068030

Spare migration doesn't work for external metadata. mdadm skips
a container with spare device because it is inactive. It used to work
because GET_ARRAY_INFO ioctl returned valid structure for a container
and mdadm treated such response as active container. Current
implementation checks it in sysfs where container is shown as inactive.

Adapt sysfs implementation to work the same way as ioctl.

Signed-off-by: Mariusz Tkaczyk <>
Signed-off-by: Jes Sorensen <>
Signed-off-by: Coly Li <>

 Monitor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Monitor.c b/Monitor.c
index f70e5b5..497e364 100644
--- a/Monitor.c
+++ b/Monitor.c
@@ -497,7 +497,7 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
 	if (mse->level == NULL)
 		is_container = 1;
-	if (!md_array_active(fd))
+	if (!is_container && !md_array_active(fd))
 		goto disappeared;
 	fcntl(fd, F_SETFD, FD_CLOEXEC);
openSUSE Build Service is sponsored by