Linux RAID subsystem development
 help / color / mirror / Atom feed
* [PATCH] Create.c: check if freesize is equal 0
@ 2012-11-16 16:24 Lukasz Dorau
  2012-11-18 23:56 ` NeilBrown
  0 siblings, 1 reply; 2+ messages in thread
From: Lukasz Dorau @ 2012-11-16 16:24 UTC (permalink / raw)
  To: neilb; +Cc: linux-raid, maciej.patelczyk

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-11-18 23:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-16 16:24 [PATCH] Create.c: check if freesize is equal 0 Lukasz Dorau
2012-11-18 23:56 ` NeilBrown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox