]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
md: don't set In_sync if array is frozen
authorGuoqing Jiang <jgq516@gmail.com>
Wed, 24 Jul 2019 09:09:20 +0000 (11:09 +0200)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 16 Oct 2019 09:55:22 +0000 (11:55 +0200)
BugLink: https://bugs.launchpad.net/bugs/1847155
[ Upstream commit 062f5b2ae12a153644c765e7ba3b0f825427be1d ]

When a disk is added to array, the following path is called in mdadm.

Manage_subdevs -> sysfs_freeze_array
               -> Manage_add
               -> sysfs_set_str(&info, NULL, "sync_action","idle")

Then from kernel side, Manage_add invokes the path (add_new_disk ->
validate_super = super_1_validate) to set In_sync flag.

Since In_sync means "device is in_sync with rest of array", and the new
added disk need to resync thread to help the synchronization of data.
And md_reap_sync_thread would call spare_active to set In_sync for the
new added disk finally. So don't set In_sync if array is in frozen.

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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/md/md.c

index 9ce49d4abee32b6d4d3a909dd94a9630ac942ba5..4dfea8b25573cb84d6cb656b75d268d2b70fe9ec 100644 (file)
@@ -1781,8 +1781,15 @@ static int super_1_validate(struct mddev *mddev, struct md_rdev *rdev)
                                if (!(le32_to_cpu(sb->feature_map) &
                                      MD_FEATURE_RECOVERY_BITMAP))
                                        rdev->saved_raid_disk = -1;
-                       } else
-                               set_bit(In_sync, &rdev->flags);
+                       } else {
+                               /*
+                                * If the array is FROZEN, then the device can't
+                                * be in_sync with rest of array.
+                                */
+                               if (!test_bit(MD_RECOVERY_FROZEN,
+                                             &mddev->recovery))
+                                       set_bit(In_sync, &rdev->flags);
+                       }
                        rdev->raid_disk = role;
                        break;
                }