[PATCH 07/23] Disable rebuild during Online Capacity Expansion

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

 



(Online Capacity Expansion for IMSM)
When Online Capacity Expansion is started mdmon cannot initiate rebuild. This would cause operation (rebuild/reshape) conflict.
To avoid this, function activate_spare() disables rebuild action and returns NULL. This causes managemon not to initiate rebuild.
This happens when reshape_delta_disks in active_array structure is greater than 0. It is set by managemon when reshape with changed disks number is detected).
When reshape finishes his job monitor clears reshape_delta_disks variable in active array and allow for future rebuilds.

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

 managemon.c   |    2 ++
 mdmon.h       |    2 ++
 monitor.c     |   20 ++++++++++++++++++++
 super-intel.c |    2 ++
 4 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/managemon.c b/managemon.c
index 7288aa8..8a4e089 100644
--- a/managemon.c
+++ b/managemon.c
@@ -406,6 +406,7 @@ static void manage_member(struct mdstat_ent *mdstat,
 					int to_add;
 					to_add = a->container->ss->grow_array(newa, mdstat->raid_disks);
 					if (to_add) {
+						newa->reshape_delta_disks = mdstat->raid_disks - 
+newa->info.array.raid_disks;
 						replace_array(a->container, a, newa);
 						a = newa;
 					} else {
@@ -581,6 +582,7 @@ static void manage_new(struct mdstat_ent *mdstat,
 	new->info.state_fd = sysfs_open(new->devnum, NULL, "array_state");
 	new->resync_start_fd = sysfs_open(new->devnum, NULL, "resync_start");
 	new->metadata_fd = sysfs_open(new->devnum, NULL, "metadata_version");
+	new->reshape_delta_disks = 0;
 
 	dprintf("%s: inst: %d action: %d state: %d\n", __func__, atoi(inst),
 		new->action_fd, new->info.state_fd);
diff --git a/mdmon.h b/mdmon.h
index 20a0a01..78b8e7e 100644
--- a/mdmon.h
+++ b/mdmon.h
@@ -38,6 +38,8 @@ struct active_array {
 
 	int check_degraded; /* flag set by mon, read by manage */
 
+	int reshape_delta_disks;
+
 	int devnum;
 };
 
diff --git a/monitor.c b/monitor.c
index 3c99dff..b8fab5c 100644
--- a/monitor.c
+++ b/monitor.c
@@ -235,6 +235,26 @@ static int read_and_act(struct active_array *a)
 		}
 	}
 
+	if (!deactivate) {
+		/* start reshape detection
+		 */
+		if ((a->curr_action == reshape) &&
+		    (a->prev_action != reshape)) {
+			/* set zero to allow for future rebuilds
+			 */
+			a->reshape_delta_disks = 0;
+		}
+
+		/* finalize reshape detection
+		 */
+		if ((a->curr_action != reshape) &&
+		    (a->prev_action == reshape)) {
+			/* set zero to allow for future rebuilds
+			 */
+			a->reshape_delta_disks = 0;
+		}
+	}
+
 	/* Check for failures and if found:
 	 * 1/ Record the failure in the metadata and unblock the device.
 	 *    FIXME update the kernel to stop notifying on failed drives when
diff --git a/super-intel.c b/super-intel.c index 6683ef8..ab26c98 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -4992,6 +4992,8 @@ static struct mdinfo *imsm_activate_spare(struct active_array *a,
 
 	dprintf("imsm: activate spare: inst=%d failed=%d (%d) level=%d\n",
 		inst, failed, a->info.array.raid_disks, a->info.array.level);
+	if (a->reshape_delta_disks > 0)
+		return NULL;
 	if (imsm_check_degraded(super, dev, failed) != IMSM_T_STATE_DEGRADED)
 		return NULL;
 

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