dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

Blame SOURCES/0093-Monitor-stop-notifing-about-containers.patch

3c4af5
From 007087d0898a045901e4e120296e6d9b845b20a6 Mon Sep 17 00:00:00 2001
3c4af5
From: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com>
3c4af5
Date: Wed, 9 Sep 2020 10:31:18 +0200
3c4af5
Subject: [PATCH 093/108] Monitor: stop notifing about containers.
3c4af5
3c4af5
Stop reporting any events from container but still track them,
3c4af5
it is important for spare migration.
3c4af5
Stop mdmonitor if no redundant array is presented in mdstat.
3c4af5
There is nothing to follow.
3c4af5
3c4af5
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com>
3c4af5
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
3c4af5
---
3c4af5
 Monitor.c | 19 ++++++++++++++++---
3c4af5
 1 file changed, 16 insertions(+), 3 deletions(-)
3c4af5
3c4af5
diff --git a/Monitor.c b/Monitor.c
3c4af5
index 80a3200..aed7a69 100644
3c4af5
--- a/Monitor.c
3c4af5
+++ b/Monitor.c
3c4af5
@@ -212,15 +212,24 @@ int Monitor(struct mddev_dev *devlist,
3c4af5
 		int new_found = 0;
3c4af5
 		struct state *st, **stp;
3c4af5
 		int anydegraded = 0;
3c4af5
+		int anyredundant = 0;
3c4af5
 
3c4af5
 		if (mdstat)
3c4af5
 			free_mdstat(mdstat);
3c4af5
 		mdstat = mdstat_read(oneshot ? 0 : 1, 0);
3c4af5
 
3c4af5
-		for (st = statelist; st; st = st->next)
3c4af5
+		for (st = statelist; st; st = st->next) {
3c4af5
 			if (check_array(st, mdstat, c->test, &info,
3c4af5
 					increments, c->prefer))
3c4af5
 				anydegraded = 1;
3c4af5
+			/* for external arrays, metadata is filled for
3c4af5
+			 * containers only
3c4af5
+			 */
3c4af5
+			if (st->metadata && st->metadata->ss->external)
3c4af5
+				continue;
3c4af5
+			if (st->err == 0 && !anyredundant)
3c4af5
+				anyredundant = 1;
3c4af5
+		}
3c4af5
 
3c4af5
 		/* now check if there are any new devices found in mdstat */
3c4af5
 		if (c->scan)
3c4af5
@@ -236,6 +245,9 @@ int Monitor(struct mddev_dev *devlist,
3c4af5
 		if (!new_found) {
3c4af5
 			if (oneshot)
3c4af5
 				break;
3c4af5
+			else if (!anyredundant) {
3c4af5
+				break;
3c4af5
+			}
3c4af5
 			else {
3c4af5
 				mdstat_wait(c->delay);
3c4af5
 				mdstat_close();
3c4af5
@@ -542,7 +554,8 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
3c4af5
 		st->err = 0;
3c4af5
 		st->percent = RESYNC_NONE;
3c4af5
 		new_array = 1;
3c4af5
-		alert("NewArray", st->devname, NULL, ainfo);
3c4af5
+		if (!is_container)
3c4af5
+			alert("NewArray", st->devname, NULL, ainfo);
3c4af5
 	}
3c4af5
 
3c4af5
 	if (st->utime == array.utime && st->failed == sra->array.failed_disks &&
3c4af5
@@ -676,7 +689,7 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
3c4af5
 	return retval;
3c4af5
 
3c4af5
  disappeared:
3c4af5
-	if (!st->err)
3c4af5
+	if (!st->err && !is_container)
3c4af5
 		alert("DeviceDisappeared", dev, NULL, ainfo);
3c4af5
 	st->err++;
3c4af5
 	goto out;
3c4af5
-- 
3c4af5
2.7.5
3c4af5