[PATCH 28/34] Take in mind takeover during disk add

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

 



Reduce disk number of added disks if disk number was increased by takeover.

Signed-off-by: Adam Kwolek <adam.kwolek@xxxxxxxxx>
---

 Grow.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/Grow.c b/Grow.c
index 0b151f1..3814579 100644
--- a/Grow.c
+++ b/Grow.c
@@ -1694,10 +1694,12 @@ static int reshape_array(char *container, int fd, char *devname,
 			st->ss->container_content(st, subarray);
 		struct mdinfo *d;
 
-		if (info2)
+		if (info2) {
+			int before_raid_disks = reshape.before.raid_disks;
+			if (orig_level == 0)
+				before_raid_disks--;
 			for (d = info2->devs; d; d = d->next) {
-				if (d->disk.raid_disk >=
-				    reshape.before.raid_disks) {
+				if (d->disk.raid_disk >= before_raid_disks) {
 					/* This is a spare that wants to
 					 * be part of the array.
 					 */
@@ -1705,7 +1707,8 @@ static int reshape_array(char *container, int fd, char *devname,
 					add_disk(fd, st, info2, d);
 				}
 			}
-		sysfs_free(info2);
+			sysfs_free(info2);
+		}
 	}
 
 	if (reshape.blocks == 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