[gvfs/wip/oholy/bind-mounts: 2/2] udisks2: Improve handling of mounts which doesn't point into fs root
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs/wip/oholy/bind-mounts: 2/2] udisks2: Improve handling of mounts which doesn't point into fs root
- Date: Thu, 6 Dec 2018 15:50:46 +0000 (UTC)
commit f5a463a6655e22035adfb0cba276b1755dc4de27
Author: Ondrej Holy <oholy redhat com>
Date: Fri Apr 27 12:56:42 2018 +0200
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
monitor/udisks2/gvfsudisks2volumemonitor.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/monitor/udisks2/gvfsudisks2volumemonitor.c b/monitor/udisks2/gvfsudisks2volumemonitor.c
index b3f3ce65..29055845 100644
--- a/monitor/udisks2/gvfsudisks2volumemonitor.c
+++ b/monitor/udisks2/gvfsudisks2volumemonitor.c
@@ -757,7 +757,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;
@@ -1703,7 +1706,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 */
@@ -1735,7 +1742,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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]