public inbox for linux-raid@vger.kernel.org
 help / color / mirror / Atom feed
From: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
To: jes@trained-monkey.org
Cc: linux-raid@vger.kernel.org
Subject: [PATCH] Prevent user from using --stop with ambiguous args
Date: Wed,  5 May 2021 13:01:02 +0200	[thread overview]
Message-ID: <20210505110102.16947-1-mariusz.tkaczyk@linux.intel.com> (raw)

From: Norbert Szulc <norbert.szulc@intel.com>

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.

Signed-off-by: Norbert Szulc <norbert.szulc@intel.com>
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
---
 mdadm.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/mdadm.c b/mdadm.c
index 493d70e4..9f5f7934 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -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':
-- 
2.26.2


             reply	other threads:[~2021-05-05 11:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-05 11:01 Mariusz Tkaczyk [this message]
2021-05-06 21:09 ` [PATCH] Prevent user from using --stop with ambiguous args Jes Sorensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210505110102.16947-1-mariusz.tkaczyk@linux.intel.com \
    --to=mariusz.tkaczyk@linux.intel.com \
    --cc=jes@trained-monkey.org \
    --cc=linux-raid@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox