From 35e553a808f7084e31bc74d88765bb980a7413ea Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Tue, 20 Sep 2011 13:19:47 +0000 Subject: [PATCH] Working around collision with udev by closing and re-opening device file --- cdrskin/cdrskin_timestamp.h | 2 +- libburn/sg-linux.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index 3a2aca8..daf77e4 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2011.09.20.131602" +#define Cdrskin_timestamP "2011.09.20.131843" diff --git a/libburn/sg-linux.c b/libburn/sg-linux.c index 78c182e..d01370a 100644 --- a/libburn/sg-linux.c +++ b/libburn/sg-linux.c @@ -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)