[PATCH] Grow.c: Block any level migration with chunk size change

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

 



Mixing level and chunk changes in one grow operation is not supported.
Mdadm performs level migration correctly and ignores new chunk, but
after migration it tries to write this chunk to sysfs properties.
This is dangerous and can cause unexpected behaviours.

Block it before level migration starts.

Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@xxxxxxxxx>
---
 Grow.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Grow.c b/Grow.c
index 3ee015b..8722969 100644
--- a/Grow.c
+++ b/Grow.c
@@ -1794,6 +1794,11 @@ int Grow_reshape(char *devname, int fd,
 			devname);
 		return 1;
 	}
+	if (s->level != UnSet && s->chunk) {
+		pr_err("Cannot change array level in the same operation as changing chunk size.\n");
+		return 1;
+	}
+
 	if (data_offset != INVALID_SECTORS && array.level != 10 &&
 	    (array.level < 4 || array.level > 6)) {
 		pr_err("--grow --data-offset not yet supported\n");
-- 
1.8.3.1

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