Linux RAID subsystem development
 help / color / mirror / Atom feed
From: Lukasz Dorau <lukasz.dorau@intel.com>
To: neilb@suse.de
Cc: linux-raid@vger.kernel.org, maciej.patelczyk@intel.com
Subject: [PATCH] Create.c: check if freesize is equal 0
Date: Fri, 16 Nov 2012 17:24:36 +0100	[thread overview]
Message-ID: <20121116162436.11415.87524.stgit@gklab-128-085.igk.intel.com> (raw)

"freesize" can be equal 0 after rounding to the chunk's size.
Creating should be aborted in such case.

Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
---
 Create.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/Create.c b/Create.c
index afcf1a5..f5b7194 100644
--- a/Create.c
+++ b/Create.c
@@ -399,6 +399,11 @@ int Create(struct supertype *st, char *mddev,
 		if (s->chunk && s->chunk != UnSet) {
 			/* round to chunk size */
 			freesize = freesize & ~(s->chunk-1);
+			if (!freesize) {
+				pr_err("no free space left on %s\n", dname);
+				fail = 1;
+				continue;
+			}
 			if (do_default_chunk) {
 				/* default chunk was just set */
 				if (c->verbose > 0)


             reply	other threads:[~2012-11-16 16:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-16 16:24 Lukasz Dorau [this message]
2012-11-18 23:56 ` [PATCH] Create.c: check if freesize is equal 0 NeilBrown

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=20121116162436.11415.87524.stgit@gklab-128-085.igk.intel.com \
    --to=lukasz.dorau@intel.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=maciej.patelczyk@intel.com \
    --cc=neilb@suse.de \
    /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