summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2018-04-27 12:56:42 +0200
committerOndrej Holy <oholy@redhat.com>2018-12-07 12:24:01 +0000
commitab82d984e7961516cd36d5c5e3450897f44cc46f (patch)
treeb40015c38f374cc1a353f6647c31104c9402991f
parent95fa60f5d2c9c10f43c799296a9736ca25218912 (diff)
downloadgvfs-ab82d984e7961516cd36d5c5e3450897f44cc46f.tar.gz
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). https://gitlab.gnome.org/GNOME/gvfs/issues/330
-rw-r--r--monitor/udisks2/gvfsudisks2volumemonitor.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/monitor/udisks2/gvfsudisks2volumemonitor.c b/monitor/udisks2/gvfsudisks2volumemonitor.c
index 57917b50..2b2285f9 100644
--- a/monitor/udisks2/gvfsudisks2volumemonitor.c
+++ b/monitor/udisks2/gvfsudisks2volumemonitor.c
@@ -760,7 +760,10 @@ should_include_volume_check_mount_points (GVfsUDisks2VolumeMonitor *monitor,
mount_entry = g_unix_mount_at (mount_point, NULL);
if (mount_entry != NULL)
{
- if (should_include_mount (monitor, mount_entry))
+ const gchar *root = g_unix_mount_get_root_path (mount_entry);
+
+ if ((root == NULL || g_strcmp0 (root, "/") == 0) &&
+ should_include_mount (monitor, mount_entry))
{
g_unix_mount_free (mount_entry);
ret = TRUE;
@@ -1706,7 +1709,11 @@ update_mounts (GVfsUDisks2VolumeMonitor *monitor,
for (l = added; l != NULL; l = l->next)
{
GUnixMountEntry *mount_entry = l->data;
- volume = find_volume_for_device (monitor, g_unix_mount_get_device_path (mount_entry));
+ const gchar *root = g_unix_mount_get_root_path (mount_entry);
+
+ volume = NULL;
+ if (root == NULL || g_strcmp0 (root, "/") == 0)
+ volume = find_volume_for_device (monitor, g_unix_mount_get_device_path (mount_entry));
if (volume == NULL)
volume = find_fstab_volume_for_mount_entry (monitor, mount_entry);
mount = gvfs_udisks2_mount_new (monitor, mount_entry, volume); /* adopts mount_entry */
@@ -1738,7 +1745,11 @@ update_mounts (GVfsUDisks2VolumeMonitor *monitor,
}
if (gvfs_udisks2_mount_get_volume (mount) == NULL)
{
- volume = find_volume_for_device (monitor, g_unix_mount_get_device_path (mount_entry));
+ const gchar *root = g_unix_mount_get_root_path (mount_entry);
+
+ volume = NULL;
+ if (root == NULL || g_strcmp0 (root, "/") == 0)
+ volume = find_volume_for_device (monitor, g_unix_mount_get_device_path (mount_entry));
if (volume == NULL)
volume = find_fstab_volume_for_mount_entry (monitor, mount_entry);
if (volume != NULL)