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

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