From: NeilBrown <neilb@suse.de>
To: Lukasz Dorau <lukasz.dorau@intel.com>
Cc: linux-raid@vger.kernel.org, maciej.patelczyk@intel.com
Subject: Re: [PATCH] Create.c: check if freesize is equal 0
Date: Mon, 19 Nov 2012 10:56:59 +1100 [thread overview]
Message-ID: <20121119105659.206a4487@notabene.brown> (raw)
In-Reply-To: <20121116162436.11415.87524.stgit@gklab-128-085.igk.intel.com>
[-- Attachment #1: Type: text/plain, Size: 1826 bytes --]
On Fri, 16 Nov 2012 17:24:36 +0100 Lukasz Dorau <lukasz.dorau@intel.com>
wrote:
> "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)
I think it would be best to have this test even if chunk is not set.
So I've applied the following.
Thanks,
NeilBrown
From 3339b154fdc9dcc70b9be1c5ab203d3d011f5434 Mon Sep 17 00:00:00 2001
From: Lukasz Dorau <lukasz.dorau@intel.com>
Date: Fri, 16 Nov 2012 17:24:36 +0100
Subject: [PATCH] Create.c: check if freesize is equal 0
"freesize" can be equal 0, particularly after rounding to the chunk's size.
Creating should be aborted in such case.
Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
diff --git a/Create.c b/Create.c
index 79fdec8..a4aab41 100644
--- a/Create.c
+++ b/Create.c
@@ -408,6 +408,11 @@ int Create(struct supertype *st, char *mddev,
do_default_chunk = 0;
}
}
+ if (!freesize) {
+ pr_err("no free space left on %s\n", dname);
+ fail = 1;
+ continue;
+ }
if (s->size && freesize < s->size) {
pr_err("%s is smaller than given size."
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
prev parent reply other threads:[~2012-11-18 23:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-16 16:24 [PATCH] Create.c: check if freesize is equal 0 Lukasz Dorau
2012-11-18 23:56 ` NeilBrown [this message]
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=20121119105659.206a4487@notabene.brown \
--to=neilb@suse.de \
--cc=linux-raid@vger.kernel.org \
--cc=lukasz.dorau@intel.com \
--cc=maciej.patelczyk@intel.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