[PATCH] Create.c: check if freesize is equal 0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"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@xxxxxxxxx>
---
 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)

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux