Patch "md: fix data corruption for raid456 when reshape restart while grow up" has been added to the 4.19-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    md: fix data corruption for raid456 when reshape restart while grow up

to the 4.19-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     md-fix-data-corruption-for-raid456-when-reshape-rest.patch
and it can be found in the queue-4.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 8c977d8f9a4252e9b335230eb09b5cc3f52e6db1
Author: Yu Kuai <yukuai3@xxxxxxxxxx>
Date:   Fri May 12 09:56:07 2023 +0800

    md: fix data corruption for raid456 when reshape restart while grow up
    
    [ Upstream commit 873f50ece41aad5c4f788a340960c53774b5526e ]
    
    Currently, if reshape is interrupted, echo "reshape" to sync_action will
    restart reshape from scratch, for example:
    
    echo frozen > sync_action
    echo reshape > sync_action
    
    This will corrupt data before reshape_position if the array is growing,
    fix the problem by continue reshape from reshape_position.
    
    Reported-by: Peter Neuwirth <reddunur@xxxxxxxxx>
    Link: https://lore.kernel.org/linux-raid/e2f96772-bfbc-f43b-6da1-f520e5164536@xxxxxxxxx/
    Signed-off-by: Yu Kuai <yukuai3@xxxxxxxxxx>
    Signed-off-by: Song Liu <song@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230512015610.821290-3-yukuai1@xxxxxxxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/md/md.c b/drivers/md/md.c
index 2e23a898fc978..6b074c2202d5a 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -4639,11 +4639,21 @@ action_store(struct mddev *mddev, const char *page, size_t len)
 			return -EINVAL;
 		err = mddev_lock(mddev);
 		if (!err) {
-			if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery))
+			if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery)) {
 				err =  -EBUSY;
-			else {
+			} else if (mddev->reshape_position == MaxSector ||
+				   mddev->pers->check_reshape == NULL ||
+				   mddev->pers->check_reshape(mddev)) {
 				clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery);
 				err = mddev->pers->start_reshape(mddev);
+			} else {
+				/*
+				 * If reshape is still in progress, and
+				 * md_check_recovery() can continue to reshape,
+				 * don't restart reshape because data can be
+				 * corrupted for raid456.
+				 */
+				clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery);
 			}
 			mddev_unlock(mddev);
 		}



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux