|
|
2c1b57 |
commit a44c262abc49b3c69ee80c97813388e5d021d20b
|
|
|
2c1b57 |
Author: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
|
|
|
2c1b57 |
Date: Thu Dec 7 10:23:54 2017 +0100
|
|
|
2c1b57 |
|
|
|
2c1b57 |
managemon: Don't add disk to the array after it has started
|
|
|
2c1b57 |
|
|
|
2c1b57 |
If disk has disappeared from the system and appears again, it is added to the
|
|
|
2c1b57 |
corresponding container as long the metadata matches and disk number is set.
|
|
|
2c1b57 |
This code had no effect on imsm until commit 20dc76d15b40 ("imsm: Set disk slot
|
|
|
2c1b57 |
number"). Now the disk is added to container but not to the array - it is
|
|
|
2c1b57 |
correct as the disk is out-of-sync. Rebuild should start for the disk but it
|
|
|
2c1b57 |
doesn't. There is the same behaviour for both imsm and ddf metadata.
|
|
|
2c1b57 |
|
|
|
2c1b57 |
There is no point to handle out-of-sync disk as "good member of array" so
|
|
|
2c1b57 |
remove that part of code. There are no scenarios when monitor is already
|
|
|
2c1b57 |
running and disk can be safely added to the array. Just write initial metadata
|
|
|
2c1b57 |
to the disk so it's taken for rebuild.
|
|
|
2c1b57 |
|
|
|
2c1b57 |
Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
|
|
|
2c1b57 |
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
|
|
2c1b57 |
|
|
|
2c1b57 |
diff --git a/managemon.c b/managemon.c
|
|
|
2c1b57 |
index 4e85398..101231c 100644
|
|
|
2c1b57 |
--- a/managemon.c
|
|
|
2c1b57 |
+++ b/managemon.c
|
|
|
2c1b57 |
@@ -266,9 +266,7 @@ static void add_disk_to_container(struct supertype *st, struct mdinfo *sd)
|
|
|
2c1b57 |
{
|
|
|
2c1b57 |
int dfd;
|
|
|
2c1b57 |
char nm[20];
|
|
|
2c1b57 |
- struct supertype *st2;
|
|
|
2c1b57 |
struct metadata_update *update = NULL;
|
|
|
2c1b57 |
- struct mdinfo info;
|
|
|
2c1b57 |
mdu_disk_info_t dk = {
|
|
|
2c1b57 |
.number = -1,
|
|
|
2c1b57 |
.major = sd->disk.major,
|
|
|
2c1b57 |
@@ -287,25 +285,6 @@ static void add_disk_to_container(struct supertype *st, struct mdinfo *sd)
|
|
|
2c1b57 |
if (dfd < 0)
|
|
|
2c1b57 |
return;
|
|
|
2c1b57 |
|
|
|
2c1b57 |
- /* Check the metadata and see if it is already part of this
|
|
|
2c1b57 |
- * array
|
|
|
2c1b57 |
- */
|
|
|
2c1b57 |
- st2 = dup_super(st);
|
|
|
2c1b57 |
- if (st2->ss->load_super(st2, dfd, NULL) == 0) {
|
|
|
2c1b57 |
- st2->ss->getinfo_super(st2, &info, NULL);
|
|
|
2c1b57 |
- if (st->ss->compare_super(st, st2) == 0 &&
|
|
|
2c1b57 |
- info.disk.raid_disk >= 0) {
|
|
|
2c1b57 |
- /* Looks like a good member of array.
|
|
|
2c1b57 |
- * Just accept it.
|
|
|
2c1b57 |
- * mdadm will incorporate any parts into
|
|
|
2c1b57 |
- * active arrays.
|
|
|
2c1b57 |
- */
|
|
|
2c1b57 |
- st2->ss->free_super(st2);
|
|
|
2c1b57 |
- return;
|
|
|
2c1b57 |
- }
|
|
|
2c1b57 |
- }
|
|
|
2c1b57 |
- st2->ss->free_super(st2);
|
|
|
2c1b57 |
-
|
|
|
2c1b57 |
st->update_tail = &update;
|
|
|
2c1b57 |
st->ss->add_to_super(st, &dk, dfd, NULL, INVALID_SECTORS);
|
|
|
2c1b57 |
st->ss->write_init_super(st);
|