[PATCH 3/3] Hold the map lock while performing Assemble to avoid races with udev
From: <hidden>
Date: 2011-10-20 10:06:18
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: <hidden>
Date: 2011-10-20 10:06:18
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: Jes Sorensen <redacted> Signed-off-by: Jes Sorensen <redacted> --- mdadm.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/mdadm.c b/mdadm.c
index ebf1c46..56de7b7 100644
--- a/mdadm.c
+++ b/mdadm.c@@ -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:
--
1.7.6.4