diff options
-rw-r--r-- | Grow.c | 2 | ||||
-rw-r--r-- | Incremental.c | 3 | ||||
-rw-r--r-- | mapfile.c | 12 | ||||
-rw-r--r-- | mdadm.h | 1 |
4 files changed, 18 insertions, 0 deletions
@@ -2265,6 +2265,7 @@ started: default: return 0; case 0: + map_fork(); break; } @@ -2421,6 +2422,7 @@ int reshape_container(char *container, char *devname, printf(Name ": multi-array reshape continues in background\n"); return 0; case 0: /* child */ + map_fork(); break; } diff --git a/Incremental.c b/Incremental.c index 791ad85a..a3e05a7c 100644 --- a/Incremental.c +++ b/Incremental.c @@ -1469,6 +1469,7 @@ static int Incremental_container(struct supertype *st, char *devname, "Cannot activate array(s).\n"); /* free container data and exit */ sysfs_free(list); + map_unlock(&map); return 2; } @@ -1532,6 +1533,7 @@ static int Incremental_container(struct supertype *st, char *devname, fprintf(stderr, Name ": array %s/%s is " "explicitly ignored by mdadm.conf\n", match->container, match->member); + map_unlock(&map); return 2; } if (match) @@ -1547,6 +1549,7 @@ static int Incremental_container(struct supertype *st, char *devname, if (mdfd < 0) { fprintf(stderr, Name ": failed to open %s: %s.\n", chosen_name, strerror(errno)); + map_unlock(&map); return 2; } @@ -159,6 +159,18 @@ void map_unlock(struct map_ent **melp) lf = NULL; } +void map_fork(void) +{ + /* We are forking, so must close the lock file. + * Don't risk flushing anything though. + */ + if (lf) { + close(fileno(lf)); + fclose(lf); + lf = NULL; + } +} + void map_add(struct map_ent **melp, int devnum, char *metadata, int uuid[4], char *path) { @@ -427,6 +427,7 @@ extern void map_add(struct map_ent **melp, int devnum, char *metadata, int uuid[4], char *path); extern int map_lock(struct map_ent **melp); extern void map_unlock(struct map_ent **melp); +extern void map_fork(void); /* various details can be requested */ enum sysfs_read_flags { |