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

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