Comment 6 for bug 1043772

Revision history for this message
In , Martin Pitt (pitti) wrote :

When you have an udisks mount and shut down the computer, or just udisks (during a package upgrade, or due to a crash), the mount point (in /media/ or /run/media/user/) is not automatically cleaned up. This is not such a big deal for mount points in /run, but upstream supports the /media/ case as well, and for long-running systems the "clean /run on boot" only helps to some degree as well.

calculate_mount_point() only checks whether a mount point already exists, not if there is something mounted on it already. So in above situations, you end up with an unused /run/media/user/mylabel/, and the device is instead mounted to /run/media/user/mylabel1/.

I think it would be better to check G_FILE_ATTRIBUTE_UNIX_IS_MOUNTPOINT if the directory already exists, and re-use it if it's not a mount point and the directory is empty. An easier implementation might be to try and g_remove() the mount point, which will fail if it is non-empty or mounted. If that succeeds, we re-create the mountpoint with up-to-date permissions.