aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuoqing Jiang <gqjiang@suse.com>2018-10-18 04:37:47 -0400
committerShaohua Li <shli@fb.com>2018-10-18 12:40:48 -0400
commitcb9ee154317b084a96a7c2b771d1688f39fc714c (patch)
treed6388ae05edc17fde448963052bb3b0edd61fb7d
parentcbce6863b6d04f6eac6b144bcfaaf11a189d6533 (diff)
md-cluster: send BITMAP_NEEDS_SYNC message if reshaping is interrupted
We need to continue the reshaping if it was interrupted in original node. So original node should call resync_bitmap in case reshaping is aborted. Then BITMAP_NEEDS_SYNC message is broadcasted to other nodes, node which continues the reshaping should restart reshape from mddev->reshape_position instead of from the first beginning. Reviewed-by: NeilBrown <neilb@suse.com> Signed-off-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: Shaohua Li <shli@fb.com>
-rw-r--r--drivers/md/md-cluster.c19
-rw-r--r--drivers/md/md.c12
2 files changed, 26 insertions, 5 deletions
diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c
index 792e0218a42f..f1b870766deb 100644
--- a/drivers/md/md-cluster.c
+++ b/drivers/md/md-cluster.c
@@ -333,6 +333,12 @@ static void recover_bitmaps(struct md_thread *thread)
333 } 333 }
334 spin_unlock_irq(&cinfo->suspend_lock); 334 spin_unlock_irq(&cinfo->suspend_lock);
335 335
336 /* Kick off a reshape if needed */
337 if (test_bit(MD_RESYNCING_REMOTE, &mddev->recovery) &&
338 test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery) &&
339 mddev->reshape_position != MaxSector)
340 md_wakeup_thread(mddev->sync_thread);
341
336 if (hi > 0) { 342 if (hi > 0) {
337 if (lo < mddev->recovery_cp) 343 if (lo < mddev->recovery_cp)
338 mddev->recovery_cp = lo; 344 mddev->recovery_cp = lo;
@@ -1020,10 +1026,17 @@ static int leave(struct mddev *mddev)
1020 if (!cinfo) 1026 if (!cinfo)
1021 return 0; 1027 return 0;
1022 1028
1023 /* BITMAP_NEEDS_SYNC message should be sent when node 1029 /*
1030 * BITMAP_NEEDS_SYNC message should be sent when node
1024 * is leaving the cluster with dirty bitmap, also we 1031 * is leaving the cluster with dirty bitmap, also we
1025 * can only deliver it when dlm connection is available */ 1032 * can only deliver it when dlm connection is available.
1026 if (cinfo->slot_number > 0 && mddev->recovery_cp != MaxSector) 1033 *
1034 * Also, we should send BITMAP_NEEDS_SYNC message in
1035 * case reshaping is interrupted.
1036 */
1037 if ((cinfo->slot_number > 0 && mddev->recovery_cp != MaxSector) ||
1038 (mddev->reshape_position != MaxSector &&
1039 test_bit(MD_CLOSING, &mddev->flags)))
1027 resync_bitmap(mddev); 1040 resync_bitmap(mddev);
1028 1041
1029 set_bit(MD_CLUSTER_HOLDING_MUTEX_FOR_RECVD, &cinfo->state); 1042 set_bit(MD_CLUSTER_HOLDING_MUTEX_FOR_RECVD, &cinfo->state);
diff --git a/drivers/md/md.c b/drivers/md/md.c
index fa2bbdec9955..390f410e51dd 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -8370,9 +8370,17 @@ void md_do_sync(struct md_thread *thread)
8370 else if (!mddev->bitmap) 8370 else if (!mddev->bitmap)
8371 j = mddev->recovery_cp; 8371 j = mddev->recovery_cp;
8372 8372
8373 } else if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery)) 8373 } else if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery)) {
8374 max_sectors = mddev->resync_max_sectors; 8374 max_sectors = mddev->resync_max_sectors;
8375 else { 8375 /*
8376 * If the original node aborts reshaping then we continue the
8377 * reshaping, so set j again to avoid restart reshape from the
8378 * first beginning
8379 */
8380 if (mddev_is_clustered(mddev) &&
8381 mddev->reshape_position != MaxSector)
8382 j = mddev->reshape_position;
8383 } else {
8376 /* recovery follows the physical size of devices */ 8384 /* recovery follows the physical size of devices */
8377 max_sectors = mddev->dev_sectors; 8385 max_sectors = mddev->dev_sectors;
8378 j = MaxSector; 8386 j = MaxSector;