From: Xiao Ni <xni@redhat.com>
To: linux-raid@vger.kernel.org, jes@trained-monkey.org
Cc: ncroxon@redhat.com, heinzm@redhat.com
Subject: [PATCH v2 mdadm 1/1] Specify nodes number when updating cluster nodes
Date: Thu, 23 Jul 2020 19:20:05 +0800 [thread overview]
Message-ID: <1595503205-11129-1-git-send-email-xni@redhat.com> (raw)
Now it allow updating cluster nodes without specify --nodes. It can write superblock
with zero nodes. It can break the current cluster. Add this check to avoid this problem.
v2: It needs check c.update first to void NULL pointer reference
Signed-off-by: Xiao Ni <xni@redhat.com>
---
mdadm.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/mdadm.c b/mdadm.c
index 51e16f3..e6f0e0b 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -1341,6 +1341,11 @@ int main(int argc, char *argv[])
}
}
+ if (c.update && strcmp(c.update, "nodes") == 0 && c.nodes == 0) {
+ pr_err("Please specify nodes number with --nodes\n");
+ exit(1);
+ }
+
if (c.backup_file && data_offset != INVALID_SECTORS) {
pr_err("--backup-file and --data-offset are incompatible\n");
exit(2);
--
2.7.5
next reply other threads:[~2020-07-23 11:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-23 11:20 Xiao Ni [this message]
2020-07-26 9:05 ` [PATCH v2 mdadm 1/1] Specify nodes number when updating cluster nodes Wols Lists
2020-07-26 13:44 ` Xiao Ni
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=1595503205-11129-1-git-send-email-xni@redhat.com \
--to=xni@redhat.com \
--cc=heinzm@redhat.com \
--cc=jes@trained-monkey.org \
--cc=linux-raid@vger.kernel.org \
--cc=ncroxon@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).