|
|
c0f891 |
From 6c9d9260633f2c8491985b0782cf0fbd7e51651b Mon Sep 17 00:00:00 2001
|
|
|
c0f891 |
From: Logan Gunthorpe <logang@deltatee.com>
|
|
|
c0f891 |
Date: Wed, 22 Jun 2022 14:25:11 -0600
|
|
|
37f2b0 |
Subject: [PATCH 36/83] mdadm: Fix mdadm -r remove option regression
|
|
|
c0f891 |
|
|
|
c0f891 |
The commit noted below globally adds a parameter to the -r option but missed
|
|
|
c0f891 |
the fact that -r is used for another purpose: --remove.
|
|
|
c0f891 |
|
|
|
c0f891 |
After that commit, a command such as:
|
|
|
c0f891 |
|
|
|
c0f891 |
mdadm /dev/md0 -r /dev/loop0
|
|
|
c0f891 |
|
|
|
c0f891 |
will do nothing seeing the device parameter will be consumed as a
|
|
|
c0f891 |
argument to the -r option; thus, there will only be one device
|
|
|
c0f891 |
seen one the command line, devs_found will only be 1 and nothing will
|
|
|
c0f891 |
happen.
|
|
|
c0f891 |
|
|
|
c0f891 |
This caused the 01r5integ and 01raid6integ tests to hang indefinitely
|
|
|
c0f891 |
as mdadm did not remove the failed device. With the device not removed,
|
|
|
c0f891 |
it would not be readded. Then the loop waiting for the array status to
|
|
|
c0f891 |
change would loop forever.
|
|
|
c0f891 |
|
|
|
c0f891 |
This commit was recently reverted, but the legitimate fix for the
|
|
|
c0f891 |
monitor operations was still not fixed. So add specific monitor
|
|
|
c0f891 |
short ops to re-fix the --monitor -r option.
|
|
|
c0f891 |
|
|
|
c0f891 |
Fixes: 546047688e1c ("mdadm: fix coredump of mdadm --monitor -r")
|
|
|
c0f891 |
Fixes: 190dc029b141 ("Revert "mdadm: fix coredump of mdadm --monitor -r"")
|
|
|
c0f891 |
Cc: Wu Guanghao <wuguanghao3@huawei.com>
|
|
|
c0f891 |
Cc: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
|
|
|
c0f891 |
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
|
|
|
c0f891 |
Acked-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
|
|
|
c0f891 |
Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
|
|
|
c0f891 |
---
|
|
|
c0f891 |
ReadMe.c | 1 +
|
|
|
c0f891 |
mdadm.c | 1 +
|
|
|
c0f891 |
mdadm.h | 1 +
|
|
|
c0f891 |
3 files changed, 3 insertions(+)
|
|
|
c0f891 |
|
|
|
c0f891 |
diff --git a/ReadMe.c b/ReadMe.c
|
|
|
c0f891 |
index bec1be9a..7518a32a 100644
|
|
|
c0f891 |
--- a/ReadMe.c
|
|
|
c0f891 |
+++ b/ReadMe.c
|
|
|
c0f891 |
@@ -82,6 +82,7 @@ char Version[] = "mdadm - v" VERSION " - " VERS_DATE EXTRAVERSION "\n";
|
|
|
c0f891 |
*/
|
|
|
c0f891 |
|
|
|
c0f891 |
char short_options[]="-ABCDEFGIQhVXYWZ:vqbc:i:l:p:m:n:x:u:c:d:z:U:N:sarfRSow1tye:k:";
|
|
|
c0f891 |
+char short_monitor_options[]="-ABCDEFGIQhVXYWZ:vqbc:i:l:p:m:r:n:x:u:c:d:z:U:N:safRSow1tye:k:";
|
|
|
c0f891 |
char short_bitmap_options[]=
|
|
|
c0f891 |
"-ABCDEFGIQhVXYWZ:vqb:c:i:l:p:m:n:x:u:c:d:z:U:N:sarfRSow1tye:k:";
|
|
|
c0f891 |
char short_bitmap_auto_options[]=
|
|
|
c0f891 |
diff --git a/mdadm.c b/mdadm.c
|
|
|
c0f891 |
index be40686c..d0c5e6de 100644
|
|
|
c0f891 |
--- a/mdadm.c
|
|
|
c0f891 |
+++ b/mdadm.c
|
|
|
c0f891 |
@@ -227,6 +227,7 @@ int main(int argc, char *argv[])
|
|
|
c0f891 |
shortopt = short_bitmap_auto_options;
|
|
|
c0f891 |
break;
|
|
|
c0f891 |
case 'F': newmode = MONITOR;
|
|
|
c0f891 |
+ shortopt = short_monitor_options;
|
|
|
c0f891 |
break;
|
|
|
c0f891 |
case 'G': newmode = GROW;
|
|
|
c0f891 |
shortopt = short_bitmap_options;
|
|
|
c0f891 |
diff --git a/mdadm.h b/mdadm.h
|
|
|
c0f891 |
index 974415b9..163f4a49 100644
|
|
|
c0f891 |
--- a/mdadm.h
|
|
|
c0f891 |
+++ b/mdadm.h
|
|
|
c0f891 |
@@ -419,6 +419,7 @@ enum mode {
|
|
|
c0f891 |
};
|
|
|
c0f891 |
|
|
|
c0f891 |
extern char short_options[];
|
|
|
c0f891 |
+extern char short_monitor_options[];
|
|
|
c0f891 |
extern char short_bitmap_options[];
|
|
|
c0f891 |
extern char short_bitmap_auto_options[];
|
|
|
c0f891 |
extern struct option long_options[];
|
|
|
c0f891 |
--
|
|
|
37f2b0 |
2.38.1
|
|
|
c0f891 |
|