summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuoqing Jiang <jgq516@gmail.com>2019-07-24 11:09:21 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-10-05 15:11:36 +0200
commit9f356ce1bc6fd33e9bd953dafe3bc3424b63e50d (patch)
treea769f400711ac9d175a8e8a4a5fc90bc59e2a9f9
parent344242d50f468a250bf4b6136934392758412ed8 (diff)
downloadlinux-stable-9f356ce1bc6fd33e9bd953dafe3bc3424b63e50d.tar.gz
linux-stable-9f356ce1bc6fd33e9bd953dafe3bc3424b63e50d.tar.bz2
linux-stable-9f356ce1bc6fd33e9bd953dafe3bc3424b63e50d.zip
md: don't call spare_active in md_reap_sync_thread if all member devices can't work
[ Upstream commit 0d8ed0e9bf9643f27f4816dca61081784dedb38d ] When add one disk to array, the md_reap_sync_thread is responsible to activate the spare and set In_sync flag for the new member in spare_active(). But if raid1 has one member disk A, and disk B is added to the array. Then we offline A before all the datas are synchronized from A to B, obviously B doesn't have the latest data as A, but B is still marked with In_sync flag. So let's not call spare_active under the condition, otherwise B is still showed with 'U' state which is not correct. Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com> Signed-off-by: Song Liu <songliubraving@fb.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/md/md.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 24638ccedce4..fd62be3ca287 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -9043,7 +9043,8 @@ void md_reap_sync_thread(struct mddev *mddev)
/* resync has finished, collect result */
md_unregister_thread(&mddev->sync_thread);
if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery) &&
- !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) {
+ !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery) &&
+ mddev->degraded != mddev->raid_disks) {
/* success...*/
/* activate any spares */
if (mddev->pers->spare_active(mddev)) {