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>
This commit is contained in:
Lukasz Dorau 2012-11-16 17:24:36 +01:00 committed by NeilBrown
parent b20c8a502d
commit 066e92f017
1 changed files with 5 additions and 0 deletions

View File

@ -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."