Blame SOURCES/0063-Monitor-block-if-monitor-modes-are-combined.patch

37f2b0
From f40ac0e7e6043361ad12e9db97c07e56c3977cf6 Mon Sep 17 00:00:00 2001
37f2b0
From: Blazej Kucman <blazej.kucman@intel.com>
37f2b0
Date: Mon, 19 Dec 2022 11:21:57 +0100
37f2b0
Subject: [PATCH 63/83] Monitor: block if monitor modes are combined.
37f2b0
37f2b0
Block monitoring start if --scan mode and MD devices list are combined.
37f2b0
37f2b0
Signed-off-by: Blazej Kucman <blazej.kucman@intel.com>
37f2b0
Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
37f2b0
---
37f2b0
 Monitor.c | 7 ++++++-
37f2b0
 1 file changed, 6 insertions(+), 1 deletion(-)
37f2b0
37f2b0
diff --git a/Monitor.c b/Monitor.c
37f2b0
index 0036e8cd..188cb8be 100644
37f2b0
--- a/Monitor.c
37f2b0
+++ b/Monitor.c
37f2b0
@@ -123,7 +123,7 @@ int Monitor(struct mddev_dev *devlist,
37f2b0
 	 *  and if we can get_disk_info and find a name
37f2b0
 	 *  Then we hot-remove and hot-add to the other array
37f2b0
 	 *
37f2b0
-	 * If devlist is NULL, then we can monitor everything because --scan
37f2b0
+	 * If devlist is NULL, then we can monitor everything if --scan
37f2b0
 	 * was given.  We get an initial list from config file and add anything
37f2b0
 	 * that appears in /proc/mdstat
37f2b0
 	 */
37f2b0
@@ -136,6 +136,11 @@ int Monitor(struct mddev_dev *devlist,
37f2b0
 	struct mddev_ident *mdlist;
37f2b0
 	int delay_for_event = c->delay;
37f2b0
 
37f2b0
+	if (devlist && c->scan) {
37f2b0
+		pr_err("Devices list and --scan option cannot be combined - not monitoring.\n");
37f2b0
+		return 1;
37f2b0
+	}
37f2b0
+
37f2b0
 	if (!mailaddr)
37f2b0
 		mailaddr = conf_get_mailaddr();
37f2b0
 
37f2b0
-- 
37f2b0
2.38.1
37f2b0