summaryrefslogtreecommitdiff
path: root/Assemble.c
diff options
context:
space:
mode:
authorDimitri John Ledkov <xnox@ubuntu.com>2018-07-23 11:41:17 +0100
committerDimitri John Ledkov <xnox@ubuntu.com>2018-07-23 11:41:17 +0100
commit3bed5265f9c792edfcd593eeaa93675711e5e264 (patch)
tree60fcbcc5048f276f07022b12d9b34245a6e8ae8d /Assemble.c
parent9421e599c44cd50d3df4cd019cd3c53d9320e93d (diff)
Cherrypick master patches up to 20th of July 2018. LP: #1781427
Diffstat (limited to 'Assemble.c')
-rw-r--r--Assemble.c27
1 files changed, 5 insertions, 22 deletions
diff --git a/Assemble.c b/Assemble.c
index e83d550b..23892a37 100644
--- a/Assemble.c
+++ b/Assemble.c
@@ -281,6 +281,8 @@ static int select_devices(struct mddev_dev *devlist,
st->ss->free_super(st);
dev_policy_free(pol);
domain_free(domains);
+ if (tst)
+ tst->ss->free_super(tst);
return -1;
}
@@ -779,6 +781,8 @@ static int load_devices(struct devs *devices, char *devmap,
if (best[i] == -1 || (devices[best[i]].i.events
< devices[devcnt].i.events))
best[i] = devcnt;
+ else if (st->ss == &super_imsm)
+ best[i+1] = devcnt;
}
devcnt++;
}
@@ -1344,9 +1348,6 @@ int Assemble(struct supertype *st, char *mddev,
char chosen_name[1024];
struct map_ent *map = NULL;
struct map_ent *mp;
- int locked = 0;
- struct mdp_superblock_1 *sb;
- bitmap_super_t *bms;
/*
* If any subdevs are listed, then any that don't
@@ -1377,12 +1378,6 @@ try_again:
* set of devices failed. Those are now marked as ->used==2 and
* we ignore them and try again
*/
- if (locked)
- /*
- * if come back try_again is called, then need to unlock first,
- * and lock again since the metadate is re-read.
- */
- cluster_release_dlmlock();
if (!st && ident->st)
st = ident->st;
if (c->verbose>0)
@@ -1400,14 +1395,6 @@ try_again:
if (!st || !st->sb || !content)
return 2;
- sb = st->sb;
- bms = (bitmap_super_t*)(((char*)sb) + 4096);
- if (sb && bms->version == BITMAP_MAJOR_CLUSTERED) {
- locked = cluster_get_dlmlock();
- if (locked != 1)
- return 1;
- }
-
/* We have a full set of devices - we now need to find the
* array device.
* However there is a risk that we are racing with "mdadm -I"
@@ -1538,8 +1525,6 @@ try_again:
err = assemble_container_content(st, mdfd, content, c,
chosen_name, NULL);
close(mdfd);
- if (locked == 1)
- cluster_release_dlmlock();
return err;
}
@@ -1849,8 +1834,8 @@ try_again:
if (rv == 1 && !pre_exist)
ioctl(mdfd, STOP_ARRAY, NULL);
free(devices);
- map_unlock(&map);
out:
+ map_unlock(&map);
if (rv == 0) {
wait_for(chosen_name, mdfd);
close(mdfd);
@@ -1884,8 +1869,6 @@ out:
close(mdfd);
/* '2' means 'OK, but not started yet' */
- if (locked == 1)
- cluster_release_dlmlock();
if (rv == -1) {
free(devices);
return 1;