Why upstream udisks authors refuse integrating theses important patches?
Without them, udisks never works with some devices.
When you open a decice with O_EXECL and it's mounted, you'll get EBUSY error.
So when we get EBUSY, we check if it's mounted. If it is, we open it without 
O_EXECL.
Otherwise, that means other programs, such as cd burner, are using the device 
and we shouldn't touch it.
That's basically why is_mounted() is called here.

Personally, I think the correct way to integrate these two patches is
like this:

 In the original patch, you can find this:

                } else if (errno == EBUSY && device->is_ide_cdrom) {
                        // TODO: check if media is mounted
                        // in that case mounting with O_EXCL should be safe
                        fd = open (device->dev_path, O_RDONLY | O_NONBLOCK);
                        if (fd != -1) {
                                poller_check_ide_cdrom (fd, device);
                                close (fd);
                        }
                 }

change it to:

                } else if (errno == EBUSY) {           // no need to check for 
ide_cd here
+          /* From hal/hald/linux/addons/addon-storage.c: */
+          /* this means the disc is mounted or some other app,
+           * like a cd burner, has already opened O_EXCL */
+
+          /* HOWEVER, when starting hald, a disc may be
+           * mounted; so check /etc/mtab to see if it
+           * actually is mounted. If it is we retry to open
+           * without O_EXCL
+           */
+          if (is_mounted (device->dev_path))
+            {
+              fd = open (device->dev_path, O_RDONLY | O_NONBLOCK);
+            }
                        if (fd != -1 && device->is_ide_cdrom) {                 
// only IDE cd needs this.
                                poller_check_ide_cdrom (fd, device);
                                close (fd);
                        }
                 }

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/711549

Title:
  pressing physical eject button on CD/DVD drive causes icon to remain
  on desktop after eject

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to