linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guoqing Jiang <gqjiang@suse.com>
To: Jes.Sorensen@redhat.com
Cc: linux-raid@vger.kernel.org, Guoqing Jiang <gqjiang@suse.com>
Subject: [PATCH 1/2] Create: check the node nums when create clustered raid
Date: Wed,  4 May 2016 16:33:43 +0800	[thread overview]
Message-ID: <1462350824-9872-2-git-send-email-gqjiang@suse.com> (raw)
In-Reply-To: <1462350824-9872-1-git-send-email-gqjiang@suse.com>

It doesn't make sense to create a clustered raid
with only 1 node.

Reported-by: Zhilong Liu <zlliu@suse.com>
Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
---
 Create.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/Create.c b/Create.c
index 1e4a6ee..717086b 100644
--- a/Create.c
+++ b/Create.c
@@ -114,8 +114,13 @@ int Create(struct supertype *st, char *mddev,
 	unsigned long long newsize;
 
 	int major_num = BITMAP_MAJOR_HI;
-	if (s->bitmap_file && strcmp(s->bitmap_file, "clustered") == 0)
+	if (s->bitmap_file && strcmp(s->bitmap_file, "clustered") == 0) {
 		major_num = BITMAP_MAJOR_CLUSTERED;
+		if (c->nodes <= 1) {
+			pr_err("At least 2 nodes are needed for cluster-md\n");
+			return 1;
+		}
+	}
 
 	memset(&info, 0, sizeof(info));
 	if (s->level == UnSet && st && st->ss->default_geometry)
-- 
2.6.2


  reply	other threads:[~2016-05-04  8:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-04  8:33 [PATCH 0/2] Check node nums for cluster raid Guoqing Jiang
2016-05-04  8:33 ` Guoqing Jiang [this message]
2016-05-04  8:33 ` [PATCH 2/2] super1: don't update node nums if it is not more than 1 Guoqing Jiang
2016-05-04 15:12 ` [PATCH 0/2] Check node nums for cluster raid Jes Sorensen
2016-05-04 15:19   ` Doug Ledford
2016-05-04 15:25     ` Jes Sorensen
2016-05-04 15:28       ` Doug Ledford
2016-05-05  3:03   ` Guoqing Jiang
2016-05-05 20:28     ` 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=1462350824-9872-2-git-send-email-gqjiang@suse.com \
    --to=gqjiang@suse.com \
    --cc=Jes.Sorensen@redhat.com \
    --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;
as well as URLs for NNTP newsgroup(s).