X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=mapfile.c;h=9e2c89368c9cc2a0f997cbbc35e6165fa2dafe0d;hb=ae2416e7b6937b9414321c5239e2ad415f7c1988;hp=1cc61d1b82aa702437768fbdfaa2dbb0b6028452;hpb=1d54f2867b928bb1c3374f269599b8cbcb293193;p=thirdparty%2Fmdadm.git diff --git a/mapfile.c b/mapfile.c index 1cc61d1b..9e2c8936 100644 --- a/mapfile.c +++ b/mapfile.c @@ -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) { @@ -234,6 +246,7 @@ int map_update(struct map_ent **mpp, int devnum, char *metadata, memcpy(mp->uuid, uuid, 16); free(mp->path); mp->path = path ? strdup(path) : NULL; + mp->bad = 0; break; } if (!mp) @@ -380,7 +393,7 @@ void RebuildMap(void) int dfd; int ok; struct supertype *st; - char *subarray; + char *subarray = NULL; char *path; struct mdinfo *info; @@ -419,7 +432,9 @@ void RebuildMap(void) * find a unique name based on metadata name. * */ - struct mddev_ident *match = conf_match(info, st); + struct mddev_ident *match = conf_match(st, info, + NULL, 0, + NULL); struct stat stb; if (match && match->devname && match->devname[0] == '/') { path = match->devname;