From ffb3e4945d247663fb49ebcead96c3c134833a86 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Tue, 4 Nov 2008 21:01:56 +1100 Subject: [PATCH] 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 --- Incremental.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) 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); -- 2.47.2