|
|
3c4af5 |
From 69068584f9ed68b8b2736287a1c9863e11b741d5 Mon Sep 17 00:00:00 2001
|
|
|
3c4af5 |
From: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
|
|
|
3c4af5 |
Date: Fri, 11 Dec 2020 12:28:38 +0100
|
|
|
3c4af5 |
Subject: [PATCH 107/108] Incremental: Remove redundant spare movement logic
|
|
|
3c4af5 |
|
|
|
3c4af5 |
If policy is set then mdmonitor is responsible for moving spares.
|
|
|
3c4af5 |
This logic is reduntant and potentialy dangerus, spare could be moved at
|
|
|
3c4af5 |
initrd stage depending on drives appearance order.
|
|
|
3c4af5 |
|
|
|
3c4af5 |
Remove it.
|
|
|
3c4af5 |
|
|
|
3c4af5 |
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
|
|
|
3c4af5 |
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
|
|
3c4af5 |
---
|
|
|
3c4af5 |
Incremental.c | 62 -----------------------------------------------------------
|
|
|
3c4af5 |
1 file changed, 62 deletions(-)
|
|
|
3c4af5 |
|
|
|
3c4af5 |
diff --git a/Incremental.c b/Incremental.c
|
|
|
3c4af5 |
index ad9ec1c..e849bdd 100644
|
|
|
3c4af5 |
--- a/Incremental.c
|
|
|
3c4af5 |
+++ b/Incremental.c
|
|
|
3c4af5 |
@@ -1460,12 +1460,6 @@ static int Incremental_container(struct supertype *st, char *devname,
|
|
|
3c4af5 |
int trustworthy;
|
|
|
3c4af5 |
struct mddev_ident *match;
|
|
|
3c4af5 |
int rv = 0;
|
|
|
3c4af5 |
- struct domainlist *domains;
|
|
|
3c4af5 |
- struct map_ent *smp;
|
|
|
3c4af5 |
- int suuid[4];
|
|
|
3c4af5 |
- int sfd;
|
|
|
3c4af5 |
- int ra_blocked = 0;
|
|
|
3c4af5 |
- int ra_all = 0;
|
|
|
3c4af5 |
int result = 0;
|
|
|
3c4af5 |
|
|
|
3c4af5 |
st->ss->getinfo_super(st, &info, NULL);
|
|
|
3c4af5 |
@@ -1509,12 +1503,10 @@ static int Incremental_container(struct supertype *st, char *devname,
|
|
|
3c4af5 |
struct map_ent *mp;
|
|
|
3c4af5 |
struct mddev_ident *match = NULL;
|
|
|
3c4af5 |
|
|
|
3c4af5 |
- ra_all++;
|
|
|
3c4af5 |
/* do not activate arrays blocked by metadata handler */
|
|
|
3c4af5 |
if (ra->array.state & (1 << MD_SB_BLOCK_VOLUME)) {
|
|
|
3c4af5 |
pr_err("Cannot activate array %s in %s.\n",
|
|
|
3c4af5 |
ra->text_version, devname);
|
|
|
3c4af5 |
- ra_blocked++;
|
|
|
3c4af5 |
continue;
|
|
|
3c4af5 |
}
|
|
|
3c4af5 |
mp = map_by_uuid(&map, ra->uuid);
|
|
|
3c4af5 |
@@ -1617,60 +1609,6 @@ static int Incremental_container(struct supertype *st, char *devname,
|
|
|
3c4af5 |
}
|
|
|
3c4af5 |
printf("\n");
|
|
|
3c4af5 |
}
|
|
|
3c4af5 |
-
|
|
|
3c4af5 |
- /* don't move spares to container with volume being activated
|
|
|
3c4af5 |
- when all volumes are blocked */
|
|
|
3c4af5 |
- if (ra_all == ra_blocked)
|
|
|
3c4af5 |
- return 0;
|
|
|
3c4af5 |
-
|
|
|
3c4af5 |
- /* Now move all suitable spares from spare container */
|
|
|
3c4af5 |
- domains = domain_from_array(list, st->ss->name);
|
|
|
3c4af5 |
- memcpy(suuid, uuid_zero, sizeof(int[4]));
|
|
|
3c4af5 |
- if (domains &&
|
|
|
3c4af5 |
- (smp = map_by_uuid(&map, suuid)) != NULL &&
|
|
|
3c4af5 |
- (sfd = open(smp->path, O_RDONLY)) >= 0) {
|
|
|
3c4af5 |
- /* spare container found */
|
|
|
3c4af5 |
- struct supertype *sst =
|
|
|
3c4af5 |
- super_imsm.match_metadata_desc("imsm");
|
|
|
3c4af5 |
- struct mdinfo *sinfo;
|
|
|
3c4af5 |
-
|
|
|
3c4af5 |
- if (!sst->ss->load_container(sst, sfd, NULL)) {
|
|
|
3c4af5 |
- struct spare_criteria sc = {0, 0};
|
|
|
3c4af5 |
-
|
|
|
3c4af5 |
- if (st->ss->get_spare_criteria)
|
|
|
3c4af5 |
- st->ss->get_spare_criteria(st, &sc);
|
|
|
3c4af5 |
-
|
|
|
3c4af5 |
- close(sfd);
|
|
|
3c4af5 |
- sinfo = container_choose_spares(sst, &sc,
|
|
|
3c4af5 |
- domains, NULL,
|
|
|
3c4af5 |
- st->ss->name, 0);
|
|
|
3c4af5 |
- sst->ss->free_super(sst);
|
|
|
3c4af5 |
- if (sinfo){
|
|
|
3c4af5 |
- int count = 0;
|
|
|
3c4af5 |
- struct mdinfo *disks = sinfo->devs;
|
|
|
3c4af5 |
- while (disks) {
|
|
|
3c4af5 |
- /* move spare from spare
|
|
|
3c4af5 |
- * container to currently
|
|
|
3c4af5 |
- * assembled one
|
|
|
3c4af5 |
- */
|
|
|
3c4af5 |
- if (move_spare(
|
|
|
3c4af5 |
- smp->path,
|
|
|
3c4af5 |
- devname,
|
|
|
3c4af5 |
- makedev(disks->disk.major,
|
|
|
3c4af5 |
- disks->disk.minor)))
|
|
|
3c4af5 |
- count++;
|
|
|
3c4af5 |
- disks = disks->next;
|
|
|
3c4af5 |
- }
|
|
|
3c4af5 |
- if (count)
|
|
|
3c4af5 |
- pr_err("Added %d spare%s to %s\n",
|
|
|
3c4af5 |
- count, count>1?"s":"", devname);
|
|
|
3c4af5 |
- }
|
|
|
3c4af5 |
- sysfs_free(sinfo);
|
|
|
3c4af5 |
- } else
|
|
|
3c4af5 |
- close(sfd);
|
|
|
3c4af5 |
- }
|
|
|
3c4af5 |
- domain_free(domains);
|
|
|
3c4af5 |
- map_free(map);
|
|
|
3c4af5 |
return 0;
|
|
|
3c4af5 |
}
|
|
|
3c4af5 |
|
|
|
3c4af5 |
--
|
|
|
3c4af5 |
2.7.5
|
|
|
3c4af5 |
|