Working around collision with udev by closing and re-opening device file

This commit is contained in:
Thomas Schmitt 2011-09-20 13:19:47 +00:00
parent fe812ffde2
commit 35e553a808
2 changed files with 16 additions and 1 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2011.09.20.131602"
#define Cdrskin_timestamP "2011.09.20.131843"

View File

@ -1553,6 +1553,21 @@ try_open:;
fd = open(d->devname, open_mode);
os_errno = errno;
if (fd >= 0) {
/* ts B10920 : workaround for udev which might get
a kernel event from open() and might
remove links if it cannot inspect the
drive.
*/
libdax_msgs_submit(libdax_messenger, -1, 0x00000002,
LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_HIGH,
"Waiting 2 seconds to avoid collision with udev",
0, 0);
close(fd);
usleep(2000000);
fd = open(d->devname, open_mode);
os_errno = errno;
}
if (fd >= 0) {
sg_fcntl_lock(&fd, d->devname, F_WRLCK, 1);
if (fd < 0)