pressing physical eject button on CD/DVD drive causes icon to remain on desktop after eject
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
udisks |
Fix Released
|
High
|
|||
udisks (Ubuntu) |
Fix Released
|
Medium
|
Martin Pitt |
Bug Description
Binary package hint: udisks
Steps to reproduce:
1. log in to Gnome desktop
2. Insert CD or DVD in drive and wait for icon to appear on desktop
3. Press the physical eject button on the DVD/CD drive(do NOT click the software eject by right clicking the icon)
Expected results:
CD or DVD is ejected and desktop (and places menu) Icon disappear for the CD or DVD
Actual results:
CD or DVD is ejected and the desktop icon remains on the desktop (The DVD or CD remains in the 'Places' menu as well)
ProblemType: Bug
DistroRelease: Ubuntu 10.10
Package: udisks 1.0.1+git20100614-3
ProcVersionSign
Uname: Linux 2.6.35-
Architecture: i386
Date: Tue Feb 1 17:46:13 2011
DistributionCha
# This is a distribution channel descriptor
# For more information see http://
canonical-
ExecutablePath: /usr/lib/
InstallationMedia: Ubuntu 10.10 "Maverick" - Build i386 LIVE Binary 20110124-21:10
MachineType: LENOVO 0199RXU
ProcCmdLine: BOOT_IMAGE=
ProcEnviron:
SourcePackage: udisks
dmi.bios.date: 12/07/2010
dmi.bios.vendor: LENOVO
dmi.bios.version: 82ET71WW (2.11 )
dmi.board.name: 0199RXU
dmi.board.vendor: LENOVO
dmi.board.version: Not Available
dmi.chassis.
dmi.chassis.type: 10
dmi.chassis.vendor: LENOVO
dmi.chassis.
dmi.modalias: dmi:bvnLENOVO:
dmi.product.name: 0199RXU
dmi.product.
dmi.sys.vendor: LENOVO
Related branches
Changed in udisks: | |
importance: | Unknown → High |
status: | Unknown → Confirmed |
tags: | added: patch |
Changed in udisks: | |
status: | Confirmed → In Progress |
Changed in udisks: | |
status: | In Progress → Fix Released |
I found the possible cause of the bug and reported this upstream. /bugs.freedeskt op.org/ show_bug. cgi?id= 34710
https:/
Quote the bug report on fd.o here so more people can see it.
UDisks failed to perform ForceUnmount when I press the physical eject button on
my CDROM.
So I downloaded udisks source code from git and traced it for a while and then
I found the problem.
Here are the related properties of my device. ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ----- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ----
-------
device-file: /dev/sr0
removable: 1
has media: 1 (detected at Fri Feb 25 19:16:23 2011)
detects change: 1
detection by polling: 1 <--- I have no SATA AN, so polling is
performed.
detection inhibitable: 1
detection inhibited: 0 <-- polling of the device is not inhibited.
is read only: 0
is mounted: 1
drive:
vendor: HL-DT-ST
model: HL-DT-ST DVDRAM GMA-4082N
revision: CX08
serial: M0573JA3106
detachable: 0
ejectable: 1
media: optical_cd
interface: scsi
-------
I tested udisks on a clean system in a clean xsession + terminal emulator so
there shouldn't be other programs interfering with udisks.
In src/poller.c, poller_ poll_device( ) :
fd = open (device_file, O_RDONLY | O_NONBLOCK | O_EXCL);
if (fd != -1)
close (fd);
When I inserted a CD, this call to open() succeeded and returned a valid fd. I
enabled POLL_SHOW_DEBUG, and according to the debug message, the device was
polled every 2 seconds as expected.
However, after the device is mounted, either by udisks --mount or by calling
sudo mount myself, open(device_file) always returns -1 here.
Then, I press the physical eject button on my CDROM to get its tray opened. The
polling code should let udisks detect the media removal and then invokes
ForceUnmount, but this is not the case. The call to open() kept returning -1
every 2 seconds and udisks didn't detect the media change at all. Checking
errno, "Device is busy" is reported.
Then I remove the O_EXCL flag and perform the whole test again. This time,
after the CD is removed by pressing physical eject button, the open() call
succeeded and returned a valid fd. Then, udisks detects the media change and
gracefully perform ForceUnmount for it. Everything works fine as expected.
In addition, when "Device is busy", I tried fuser and lsof, but none of them
demonstrates other process using the device. However, if I unmount the device
either by calling sudo umount or udisks --unmount, this error is gone and
open() can return a valid fd. Then everything works.
Removing O_EXCL from this open() call seems to fix the issue, but this of
course is not the correct way to fix it.
Another interesting thing I found is, if I call udisks --poll-for-media change
manually after forced removal of CD with physical eject ...