diff options
author | NeilBrown <neilb@suse.de> | 2008-11-04 21:01:56 +1100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2008-11-04 21:01:56 +1100 |
commit | ffb3e4945d247663fb49ebcead96c3c134833a86 (patch) | |
tree | 843188223738829b6d035a878db9d889e63ee662 /Incremental.c | |
parent | 678a4a36b07b2b526e6de41149673e4475ad7d9f (diff) | |
download | mdadm-ffb3e4945d247663fb49ebcead96c3c134833a86.tar.gz mdadm-ffb3e4945d247663fb49ebcead96c3c134833a86.tar.xz mdadm-ffb3e4945d247663fb49ebcead96c3c134833a86.zip |
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 <neilb@suse.de>
Diffstat (limited to 'Incremental.c')
-rw-r--r-- | Incremental.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Incremental.c b/Incremental.c index 054040d..29cbca3 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); |