Working around collision with udev by closing and re-opening device file
This commit is contained in:
parent
555e687b36
commit
56e109bab2
@ -1 +1 @@
|
|||||||
#define Cdrskin_timestamP "2011.09.20.131602"
|
#define Cdrskin_timestamP "2011.09.20.131843"
|
||||||
|
@ -1553,6 +1553,21 @@ try_open:;
|
|||||||
|
|
||||||
fd = open(d->devname, open_mode);
|
fd = open(d->devname, open_mode);
|
||||||
os_errno = errno;
|
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) {
|
if (fd >= 0) {
|
||||||
sg_fcntl_lock(&fd, d->devname, F_WRLCK, 1);
|
sg_fcntl_lock(&fd, d->devname, F_WRLCK, 1);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user