]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
md-cluster: send BITMAP_NEEDS_SYNC message if reshaping is interrupted
authorGuoqing Jiang <gqjiang@suse.com>
Thu, 18 Oct 2018 08:37:47 +0000 (16:37 +0800)
committerShaohua Li <shli@fb.com>
Thu, 18 Oct 2018 16:40:48 +0000 (09:40 -0700)
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>
drivers/md/md-cluster.c
drivers/md/md.c

index 792e0218a42fceef998f372da58ba9920ab2a520..f1b870766deb91d9b456f165221938f489c549db 100644 (file)
@@ -333,6 +333,12 @@ static void recover_bitmaps(struct md_thread *thread)
                        }
                spin_unlock_irq(&cinfo->suspend_lock);
 
+               /* Kick off a reshape if needed */
+               if (test_bit(MD_RESYNCING_REMOTE, &mddev->recovery) &&
+                   test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery) &&
+                   mddev->reshape_position != MaxSector)
+                       md_wakeup_thread(mddev->sync_thread);
+
                if (hi > 0) {
                        if (lo < mddev->recovery_cp)
                                mddev->recovery_cp = lo;
@@ -1020,10 +1026,17 @@ static int leave(struct mddev *mddev)
        if (!cinfo)
                return 0;
 
-       /* BITMAP_NEEDS_SYNC message should be sent when node
+       /*
+        * BITMAP_NEEDS_SYNC message should be sent when node
         * is leaving the cluster with dirty bitmap, also we
-        * can only deliver it when dlm connection is available */
-       if (cinfo->slot_number > 0 && mddev->recovery_cp != MaxSector)
+        * can only deliver it when dlm connection is available.
+        *
+        * Also, we should send BITMAP_NEEDS_SYNC message in
+        * case reshaping is interrupted.
+        */
+       if ((cinfo->slot_number > 0 && mddev->recovery_cp != MaxSector) ||
+           (mddev->reshape_position != MaxSector &&
+            test_bit(MD_CLOSING, &mddev->flags)))
                resync_bitmap(mddev);
 
        set_bit(MD_CLUSTER_HOLDING_MUTEX_FOR_RECVD, &cinfo->state);
index fa2bbdec99556754deb688ce4c8859b7ac028c0c..390f410e51dd1c0711650178351684e6054a0544 100644 (file)
@@ -8370,9 +8370,17 @@ void md_do_sync(struct md_thread *thread)
                else if (!mddev->bitmap)
                        j = mddev->recovery_cp;
 
-       } else if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery))
+       } else if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery)) {
                max_sectors = mddev->resync_max_sectors;
-       else {
+               /*
+                * If the original node aborts reshaping then we continue the
+                * reshaping, so set j again to avoid restart reshape from the
+                * first beginning
+                */
+               if (mddev_is_clustered(mddev) &&
+                   mddev->reshape_position != MaxSector)
+                       j = mddev->reshape_position;
+       } else {
                /* recovery follows the physical size of devices */
                max_sectors = mddev->dev_sectors;
                j = MaxSector;