Print concrete error when creating mddev
Example from my testing: ``` mdadm: unexpected failure opening /dev/md127: No such device or address ``` Before it would just print: ``` mdadm: unexpected failure opening /dev/md127 ```
This commit is contained in:
parent
52c67fcdd6
commit
3add974b54
4
mdopen.c
4
mdopen.c
|
@ -444,8 +444,8 @@ int create_mddev(char *dev, char *name, int autof, int trustworthy,
|
|||
}
|
||||
mdfd = open_dev_excl(devnm);
|
||||
if (mdfd < 0)
|
||||
pr_err("unexpected failure opening %s\n",
|
||||
devname);
|
||||
pr_err("unexpected failure opening %s: %s\n",
|
||||
devname, strerror(errno));
|
||||
return mdfd;
|
||||
}
|
||||
|
||||
|
|
5
util.c
5
util.c
|
@ -1088,8 +1088,9 @@ int open_dev_excl(char *devnm)
|
|||
long delay = 1000;
|
||||
|
||||
sprintf(buf, "%d:%d", major(devid), minor(devid));
|
||||
int fd = -1;
|
||||
for (i = 0; i < 25; i++) {
|
||||
int fd = dev_open(buf, flags|O_EXCL);
|
||||
fd = dev_open(buf, flags|O_EXCL);
|
||||
if (fd >= 0)
|
||||
return fd;
|
||||
if (errno == EACCES && flags == O_RDWR) {
|
||||
|
@ -1102,7 +1103,7 @@ int open_dev_excl(char *devnm)
|
|||
if (delay < 200000)
|
||||
delay *= 2;
|
||||
}
|
||||
return -1;
|
||||
return fd;
|
||||
}
|
||||
|
||||
int same_dev(char *one, char *two)
|
||||
|
|
Loading…
Reference in New Issue