Blame SOURCES/0061-Mdmonitor-Omit-non-md-devices.patch

2b63fb
From 8b668d4aa3305af5963162b7499b128bd71f8f29 Mon Sep 17 00:00:00 2001
2b63fb
From: Lukasz Florczak <lukasz.florczak@linux.intel.com>
2b63fb
Date: Thu, 22 Sep 2022 08:29:50 +0200
2b63fb
Subject: [PATCH 61/83] Mdmonitor: Omit non-md devices
2b63fb
2b63fb
Fix segfault commit [1] introduced check whether given device is
2b63fb
mddevice, but it happend to terminate Mdmonitor if at least one of given
2b63fb
devices didn't fulfill that condition. In result Mdmonitor service was
2b63fb
no longer started on boot (with --scan option) when config contained some
2b63fb
non-existent array entry.
2b63fb
2b63fb
This commit introduces ommiting non-md devices so scan option can still
2b63fb
be used when config is wrong and allow Mdmonitor service to run on boot.
2b63fb
2b63fb
Giving a list of devices to monitor containing non-existing or
2b63fb
non-md devices will result in monitoring only confirmed mddevices.
2b63fb
2b63fb
[1] https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/commit/?id=e702f392959d1c2ad2089e595b52235ed97b4e18
2b63fb
2b63fb
Signed-off-by: Lukasz Florczak <lukasz.florczak@linux.intel.com>
2b63fb
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
2b63fb
---
2b63fb
 Monitor.c | 12 ++++--------
2b63fb
 1 file changed, 4 insertions(+), 8 deletions(-)
2b63fb
2b63fb
diff --git a/Monitor.c b/Monitor.c
2b63fb
index b4e954c6..7d7dc4d2 100644
2b63fb
--- a/Monitor.c
2b63fb
+++ b/Monitor.c
2b63fb
@@ -185,10 +185,8 @@ int Monitor(struct mddev_dev *devlist,
2b63fb
 				continue;
2b63fb
 			if (strcasecmp(mdlist->devname, "<ignore>") == 0)
2b63fb
 				continue;
2b63fb
-			if (!is_mddev(mdlist->devname)) {
2b63fb
-				free_statelist(statelist);
2b63fb
-				return 1;
2b63fb
-			}
2b63fb
+			if (!is_mddev(mdlist->devname))
2b63fb
+				continue;
2b63fb
 
2b63fb
 			st = xcalloc(1, sizeof *st);
2b63fb
 			snprintf(st->devname, MD_NAME_MAX + sizeof("/dev/md/"),
2b63fb
@@ -208,10 +206,8 @@ int Monitor(struct mddev_dev *devlist,
2b63fb
 		for (dv = devlist; dv; dv = dv->next) {
2b63fb
 			struct state *st;
2b63fb
 
2b63fb
-			if (!is_mddev(dv->devname)) {
2b63fb
-				free_statelist(statelist);
2b63fb
-				return 1;
2b63fb
-			}
2b63fb
+			if (!is_mddev(dv->devname))
2b63fb
+				continue;
2b63fb
 
2b63fb
 			st = xcalloc(1, sizeof *st);
2b63fb
 			mdlist = conf_get_ident(dv->devname);
2b63fb
-- 
2b63fb
2.38.1
2b63fb