]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
md: don't call spare_active in md_reap_sync_thread if all member devices can't work
authorGuoqing Jiang <jgq516@gmail.com>
Wed, 24 Jul 2019 09:09:21 +0000 (11:09 +0200)
committerSong Liu <songliubraving@fb.com>
Wed, 7 Aug 2019 17:25:02 +0000 (10:25 -0700)
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>
drivers/md/md.c

index 1cdaa6ff9bd7b00afe52c496a9894400d523914c..daa885ee4d60bf5a455043b5ea0dbb624060fbb0 100644 (file)
@@ -9075,7 +9075,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)) {