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

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