Skip to contentSkip to conversation

Prevent user from using --stop with ambiguous args

PATCH Applied Mariusz Tkaczyk 2 participants 2 messages May 5, 2021 – May 6, 2021 MD RAID

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Prevent user from using --stop with ambiguous args

From: Norbert Szulc <[email protected]>

When both --scan and device name is passed to --stop action, then is executed only for given device. Scan is ignored.

Block the operation when both --scan and device name are passed.

---
 mdadm.c | 5 +++++
 1 file changed, 5 insertions(+)
mdadm.c +5 -0
index 493d70e4..9f5f7934 100644
@@ -2039,6 +2039,11 @@ static int misc_list(struct mddev_dev *devlist,
 				rv |= Manage_run(dv->devname, mdfd, c);
 				break;
 			case 'S':
+				if (c->scan) {
+					pr_err("--stop not meaningful with both a --scan assembly and a device name.\n");
+					rv |= 1;
+					break;
+				}
 				rv |= Manage_stop(dv->devname, mdfd, c->verbose, 0);
 				break;
 			case 'o':
Signature · 1 line
2.26.2