Blame SOURCES/0018-mdmon-don-t-attempt-to-manage-new-arrays-when-termin.patch

8fbece
From 69d084784de196acec8ab703cd1b379af211d624 Mon Sep 17 00:00:00 2001
8fbece
From: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
8fbece
Date: Fri, 22 Feb 2019 10:15:45 +0100
8fbece
Subject: [RHEL7.7 PATCH 18/24] mdmon: don't attempt to manage new arrays when
8fbece
 terminating
8fbece
8fbece
When mdmon gets a SIGTERM, it stops managing arrays that are clean. If
8fbece
there is more that one array in the container and one of them is dirty
8fbece
and the clean one is still present in mdstat, mdmon will treat it as a
8fbece
new array and start managing it again. This leads to a cycle of
8fbece
remove_old() / manage_new() calls for the clean array, until the other
8fbece
one also becomes clean.
8fbece
8fbece
Prevent this by not calling manage_new() if sigterm is set. Also, remove
8fbece
a check for sigterm in manage_new() because the condition will never be
8fbece
true.
8fbece
8fbece
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
8fbece
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
8fbece
---
8fbece
 managemon.c | 6 ++----
8fbece
 1 file changed, 2 insertions(+), 4 deletions(-)
8fbece
8fbece
diff --git a/managemon.c b/managemon.c
8fbece
index 101231c..29b91ba 100644
8fbece
--- a/managemon.c
8fbece
+++ b/managemon.c
8fbece
@@ -727,9 +727,7 @@ static void manage_new(struct mdstat_ent *mdstat,
8fbece
 	dprintf("inst: %s action: %d state: %d\n", inst,
8fbece
 		new->action_fd, new->info.state_fd);
8fbece
 
8fbece
-	if (sigterm)
8fbece
-		new->info.safe_mode_delay = 1;
8fbece
-	else if (mdi->safe_mode_delay >= 50)
8fbece
+	if (mdi->safe_mode_delay >= 50)
8fbece
 		/* Normal start, mdadm set this. */
8fbece
 		new->info.safe_mode_delay = mdi->safe_mode_delay;
8fbece
 	else
8fbece
@@ -803,7 +801,7 @@ void manage(struct mdstat_ent *mdstat, struct supertype *container)
8fbece
 				break;
8fbece
 			}
8fbece
 		}
8fbece
-		if (a == NULL || !a->container)
8fbece
+		if ((a == NULL || !a->container) && !sigterm)
8fbece
 			manage_new(mdstat, container, a);
8fbece
 	}
8fbece
 }
8fbece
-- 
8fbece
2.7.5
8fbece