From: NeilBrown Date: Tue, 4 Nov 2008 10:01:56 +0000 (+1100) Subject: Incrmental: cope with udev slowness and errors in map file. X-Git-Tag: mdadm-3.0-devel2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ffb3e4945d247663fb49ebcead96c3c134833a86;p=thirdparty%2Fmdadm.git Incrmental: cope with udev slowness and errors in map file. If udev hasn't created the array yet, we might still want to open it. So open directly by major:minor. Also, of array in map file doesn't appear to exist, do use the name associated with it. Signed-off-by: NeilBrown --- diff --git a/Incremental.c b/Incremental.c index 054040d6..29cbca38 100644 --- a/Incremental.c +++ b/Incremental.c @@ -247,9 +247,16 @@ int Incremental(char *devname, int verbose, int runstop, */ map_lock(&map); mp = map_by_uuid(&map, info.uuid); - if (mp) + if (mp) { mdfd = open_mddev(mp->path, 0); - else + if (mdfd < 0 && mddev_busy(mp->devnum)) { + /* maybe udev hasn't created it yet. */ + char buf[50]; + sprintf(buf, "%d:%d", dev2major(mp->devnum), + dev2minor(mp->devnum)); + mdfd = dev_open(buf, O_RDWR); + } + } else mdfd = -1; if (mdfd < 0) { @@ -257,7 +264,7 @@ int Incremental(char *devname, int verbose, int runstop, struct mdinfo dinfo; /* Couldn't find an existing array, maybe make a new one */ - mdfd = create_mddev(mp ? mp->path : match ? match->devname : NULL, + mdfd = create_mddev(match ? match->devname : NULL, info.name, autof, trustworthy, chosen_name);