GNOME Bugzilla – Bug 794154
udisks2: Improve bind mount handling
Last modified: 2018-09-21 18:18:53 UTC
There is no way to detect bind mounts over UDisks2/GLib APIs currently if mount point (i.e. fstab entry) doesn't exists. However, we can improve handling of bind mounts with existing mount points. If device path of the correspoing mount point resides on another mount, it is supposedly a bind mount and it can be joined with corresponding fstab volume, not with udisks volume. New APIs for UDisks2/GLib are needed in order to fix this also for mounts without fstab entries... So for the following fstab: /dev/sda1 / ext4 defaults 1 1 /mnt/foo /foo none bind,x-gvfs-show 0 0 Output from "gio mount -l" will be: Drive(0): drive Type: GProxyDrive (GProxyVolumeMonitorUDisks2) Volume(1): foo Type: GProxyVolume (GProxyVolumeMonitorUDisks2) Mount(0): foo -> file:///mnt/foo Type: GProxyMount (GProxyVolumeMonitorUDisks2) Instead of the current: Drive(0): drive Type: GProxyDrive (GProxyVolumeMonitorUDisks2) Volume(0): root Type: GProxyVolume (GProxyVolumeMonitorUDisks2) Mount(0): root -> file:///mnt/foo Type: GProxyMount (GProxyVolumeMonitorUDisks2) Volume(1): foo Type: GProxyVolume (GProxyVolumeMonitorUDisks2)
Created attachment 369407 [details] [review] udisks2: Improve bind mount handling
This change depends on patch to not filter out bind mount points from Bug 782814...
Created attachment 371470 [details] [review] udisks2: Do not ignore mounts without volumes gvfs_udisks2_mount_new returns NULL if volume is not specified and mount is considered as internal by g_unix_mount_is_system_internal. This prevents mount creation in certain cases even if x-gvfs-show is manually specified. Mounts are already filtered out by should_include_mounts, so I don't see much reason for additional check. It is true that should_include_mount doesn't use g_unix_mount_is_system_internal, but just g_unix_is_mount_path_system_internal, however, we can change this in future if needed.
Created attachment 371471 [details] [review] udisks2: Improve handling of mounts which doesn't point into fs root UDisks2 handling of mounts which doesn't point into fs root (created over bind operation, or btrfs subvolumes) is not optimal, see: https://github.com/storaged-project/udisks/issues/478 Also GIO API doesn't expect that one GVolume can have multiple mountpoints. Thus don't try to match UDisksBlock with mount which doesn't point into fs root and create standalone GVfsUDisks2Mount for it (or use GVfsUDisks2Volume corresponding with fstab entry).
Created attachment 371933 [details] [review] udisks2: Improve handling of mounts which doesn't point into fs root Fixed usage of uninitialized value...
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gvfs/issues/330.