dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

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

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