Not all errors coming from diskmap should be overwritten.
In particular, if we get EBUSY, that doesn't mean "try again with
accessing /dev/foo, fail and return ENOENT instead".
Maybe we should add more errors to this list, or even invert the
filtering logic - I'm: 1) not an expert in this area; 2) open
for improvements.
How to reproduce: tunefs /
Before patch:
tunefs: /dev/r286cb876606dc1e0.l: No such file or directory
After patch:
tunefs: /dev/sd0l: Device busy
Okay?
--
WBR,
Vadim Zhukov
Index: opendev.c
===
RCS file: /cvs/src/lib/libutil/opendev.c,v
retrieving revision 1.15
diff -u -p -r1.15 opendev.c
--- opendev.c 30 Jun 2011 15:04:58 - 1.15
+++ opendev.c 19 Jan 2016 22:05:12 -
@@ -79,7 +79,8 @@ opendev(const char *path, int oflags, in
if (ioctl(fd, DIOCMAP, ) == -1) {
close(fd);
fd = -1;
- errno = ENOENT;
+ if (errno != EBUSY)
+ errno = ENOENT;
}
}
}