[md PATCH 3/5] md: Use added disks for external metadata case in start_reshape()

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

 



(md: Online Capacity Expansion for IMSM)
Disks added by mdadm for external metadata are not taken for configuration check before reshape.
This causes configuration check fail.

For reshape, we should check if added disks to volume by mdadm, will satisfy degradation condition after operation (comparing difference of target disk number and available disks number to mddev->max_degraded field).
---

 drivers/md/raid5.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 546e23e..dc25a32 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -5411,6 +5411,7 @@ static int raid5_start_reshape(mddev_t *mddev)
 	int spares = 0;
 	int added_devices = 0;
 	unsigned long flags;
+	int disk_count = 0;
 
 	if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery))
 		return -EBUSY;
@@ -5422,12 +5423,20 @@ static int raid5_start_reshape(mddev_t *mddev)
 		if (rdev->raid_disk < 0 &&
 		    !test_bit(Faulty, &rdev->flags))
 			spares++;
+		else
+			/* check reshape condition/spares are added already
+			 */
+			disk_count++;
 
 	if (spares - mddev->degraded < mddev->delta_disks - conf->max_degraded)
 		/* Not enough devices even to make a degraded array
 		 * of that size
+		 * but check first if this is not reshape case
+		 * if not reshape on degraded array /takeover/ than exit
 		 */
-		return -EINVAL;
+		if ((conf->raid_disks + mddev->delta_disks)
+		    > (disk_count + conf->max_degraded))
+			return -EINVAL;
 
 	/* Refuse to reduce size of the array.  Any reductions in
 	 * array size must be through explicit setting of array_size

��.n��������+%������w��{.n�����{����w��ܨ}���Ơz�j:+v�����w����ޙ��&�)ߡ�a����z�ޗ���ݢj��w�f



[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