GNOME Bugzilla – Bug 719423
Optical disc volumes/mounts are not properly removed if drive disappears
Last modified: 2018-04-13 08:34:13 UTC
I have been doing some work on udisksd lately and whenever I kill and restart it, the "audio disc" is duplicated, leading to it appearing many times after a while. Killing gvfs-udisks2-volume-monitor cleans up the mess.
This affects empty and audio disks if the corresponding drive is unplugged without ejecting (or the corresponding UDisksDrive object simply disappears from D-Bus for example due to udisksd termination). Just a note that "service udisks2 restart" works nicely, but "service udisks2 stop && service udisks2 start" or "pkill udisksd && /usr/libexec/udisks2/udisksd" triggers this issue.
Created attachment 370249 [details] [review] udisks2: Remove optical disc volumes/mounts if drive disappears If an optical drive is hard-unplugged without ejecting a media first (or the corresponding UDisksDrive object simply disappears from D-Bus for example due to the udisksd termination) and an audio disk or an empty media is inside, corresponding volumes/mounts are not properly removed. Consequently, the number of the volumes/mounts increase when plugging and unplugging such drive. This happens because those kinds of volumes/ mounts are handled by their drives in the monitor. Unfortunately, the drive is removed before processing them and the mounts/volumes without the drives are ignored consequently. Let's do not rely on the drives and handle those volumes/mounts over corresponding UDisksBlock objects, same as it is done for other kinds of volumes.
Attachment 370249 [details] pushed as 0024e34 - udisks2: Remove optical disc volumes/mounts if drive disappears