diff options
author | Jes Sorensen <Jes.Sorensen@redhat.com> | 2011-10-22 11:30:43 +1100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2011-10-22 11:30:43 +1100 |
commit | eafa60fd6ec35ac7c0a01a17c3018af4c90046ef (patch) | |
tree | 5407287e57d711931fa3bf33ad6ff14e6f1ae827 /mdadm.c | |
parent | 382afe49b10cf3e5a4764cee74649d1cd8c91813 (diff) |
Hold the map lock while performing Assemble to avoid races with udev
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'mdadm.c')
-rw-r--r-- | mdadm.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -1279,6 +1279,7 @@ int main(int argc, char *argv[]) } else { struct mddev_ident *a, *array_list = conf_get_ident(NULL); struct mddev_dev *devlist = conf_get_devs(); + struct map_ent *map = NULL; int cnt = 0; int failures, successes; if (devlist == NULL) { @@ -1298,6 +1299,10 @@ int main(int argc, char *argv[]) if (a->autof == 0) a->autof = autof; } + if (map_lock(&map)) + fprintf(stderr, Name " %s: failed to get " + "exclusive lock on mapfile\n", + __func__); do { failures = 0; successes = 0; @@ -1364,6 +1369,7 @@ int main(int argc, char *argv[]) fprintf(stderr, Name ": No arrays found in config file\n"); rv = 1; } + map_unlock(&map); } break; case BUILD: |