3010f9bec6
which resolves issues when booting off sysvinit based system. Resolves: bz736387 (Fedora 15) bz744217 (Fedora 16) Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
89 lines
2.7 KiB
Diff
89 lines
2.7 KiB
Diff
commit 5fc8cff3a4177dfbab594947283117620b4b8c9c
|
|
Author: Jes Sorensen <Jes.Sorensen@redhat.com>
|
|
Date: Sat Oct 22 11:29:47 2011 +1100
|
|
|
|
Remove race for starting container devices.
|
|
|
|
This moves the lock handling out of Incremental_container() and relies
|
|
on the caller holding the lock. This prevents conflict with a
|
|
follow-on mdadm comment which may try and launch the device in
|
|
parallel.
|
|
|
|
This involves replacing a call to "Incremental" with an
|
|
unrolled version with just the case that calls Incremental_container
|
|
and so needs a call to ->load_container.
|
|
|
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
|
|
Signed-off-by: NeilBrown <neilb@suse.de>
|
|
|
|
---
|
|
Incremental.c | 22 ++++++++++++----------
|
|
1 files changed, 12 insertions(+), 10 deletions(-)
|
|
|
|
diff --git a/Incremental.c b/Incremental.c
|
|
index 14184da..9fa6800 100644
|
|
--- a/Incremental.c
|
|
+++ b/Incremental.c
|
|
@@ -138,9 +138,15 @@
|
|
rv = st->ss->load_container(st, dfd, NULL);
|
|
|
|
close(dfd);
|
|
- if (!rv && st->ss->container_content)
|
|
- return Incremental_container(st, devname, homehost,
|
|
- verbose, runstop, autof);
|
|
+ if (!rv && st->ss->container_content) {
|
|
+ if (map_lock(&map))
|
|
+ fprintf(stderr, Name ": failed to get "
|
|
+ "exclusive lock on mapfile\n");
|
|
+ rv = Incremental_container(st, devname, homehost,
|
|
+ verbose, runstop, autof);
|
|
+ map_unlock(&map);
|
|
+ return rv;
|
|
+ }
|
|
|
|
fprintf(stderr, Name ": %s is not part of an md array.\n",
|
|
devname);
|
|
@@ -438,7 +444,6 @@
|
|
if (info.array.level == LEVEL_CONTAINER) {
|
|
int devnum = devnum; /* defined and used iff ->external */
|
|
/* Try to assemble within the container */
|
|
- map_unlock(&map);
|
|
sysfs_uevent(&info, "change");
|
|
if (verbose >= 0)
|
|
fprintf(stderr, Name
|
|
@@ -447,10 +452,14 @@
|
|
wait_for(chosen_name, mdfd);
|
|
if (st->ss->external)
|
|
devnum = fd2devnum(mdfd);
|
|
+ if (st->ss->load_container)
|
|
+ rv = st->ss->load_container(st, mdfd, NULL);
|
|
close(mdfd);
|
|
sysfs_free(sra);
|
|
- rv = Incremental(chosen_name, verbose, runstop,
|
|
- NULL, homehost, require_homehost, autof);
|
|
+ if (!rv)
|
|
+ rv = Incremental_container(st, chosen_name, homehost,
|
|
+ verbose, runstop, autof);
|
|
+ map_unlock(&map);
|
|
if (rv == 1)
|
|
/* Don't fail the whole -I if a subarray didn't
|
|
* have enough devices to start yet
|
|
@@ -1460,9 +1469,6 @@
|
|
trustworthy = FOREIGN;
|
|
|
|
list = st->ss->container_content(st, NULL);
|
|
- if (map_lock(&map))
|
|
- fprintf(stderr, Name ": failed to get exclusive lock on "
|
|
- "mapfile\n");
|
|
/* do not assemble arrays that might have bad blocks */
|
|
if (list->array.state & (1<<MD_SB_BBM_ERRORS)) {
|
|
fprintf(stderr, Name ": BBM log found in metadata. "
|
|
@@ -1600,7 +1606,6 @@
|
|
close(sfd);
|
|
}
|
|
domain_free(domains);
|
|
- map_unlock(&map);
|
|
return 0;
|
|
}
|
|
|