mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
md: ensure resync is prioritized over recovery
If a new disk is added during resync, the resync process is interrupted,
and recovery is triggered, causing the previous resync to be lost. In
reality, disk addition should not terminate resync, fix it.
Steps to reproduce the issue:
mdadm -CR /dev/md0 -l1 -n3 -x1 /dev/sd[abcd]
mdadm --fail /dev/md0 /dev/sdc
Fixes: 24dd469d72
("[PATCH] md: allow a manual resync with md")
Signed-off-by: Li Nan <linan122@huawei.com>
Reviewed-by: Yu Kuai <yukuai3@huawei.com>
Link: https://lore.kernel.org/linux-raid/20250213131530.3698600-1-linan666@huaweicloud.com
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
This commit is contained in:
parent
a052bfa636
commit
4b10a3bc67
1 changed files with 7 additions and 7 deletions
|
@ -9460,6 +9460,13 @@ static bool md_choose_sync_action(struct mddev *mddev, int *spares)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check if resync is in progress. */
|
||||||
|
if (mddev->recovery_cp < MaxSector) {
|
||||||
|
set_bit(MD_RECOVERY_SYNC, &mddev->recovery);
|
||||||
|
clear_bit(MD_RECOVERY_RECOVER, &mddev->recovery);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Remove any failed drives, then add spares if possible. Spares are
|
* Remove any failed drives, then add spares if possible. Spares are
|
||||||
* also removed and re-added, to allow the personality to fail the
|
* also removed and re-added, to allow the personality to fail the
|
||||||
|
@ -9476,13 +9483,6 @@ static bool md_choose_sync_action(struct mddev *mddev, int *spares)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if recovery is in progress. */
|
|
||||||
if (mddev->recovery_cp < MaxSector) {
|
|
||||||
set_bit(MD_RECOVERY_SYNC, &mddev->recovery);
|
|
||||||
clear_bit(MD_RECOVERY_RECOVER, &mddev->recovery);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Delay to choose resync/check/repair in md_do_sync(). */
|
/* Delay to choose resync/check/repair in md_do_sync(). */
|
||||||
if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery))
|
if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery))
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue