[gvfs/wip/oholy/mount-info-invalidation] client: Fix mount info cache invalidation
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs/wip/oholy/mount-info-invalidation] client: Fix mount info cache invalidation
- Date: Thu, 28 Feb 2019 16:15:00 +0000 (UTC)
commit caedfe8b544611113ef7aefeedabd6821a2c5469
Author: Ondrej Holy <oholy redhat com>
Date: Thu Feb 28 16:48:51 2019 +0100
client: Fix mount info cache invalidation
Mount info cache invalidation is not handled properly and thus client
can get "Cache invalid, retry (internally handled)" internal error, which
should not be passed to the client. This can happen if mount was unmounted
and another mount for the some location is mounted. This is now more
common with introducing stable URIs for MTP backend. G_VFS_ERROR_RETRY
error handling was probably lost as a consequence of GDBus port by commit
622a5c0d. Let's retry the operation internally again if G_VFS_ERROR_RETRY
is returned.
https://gitlab.gnome.org/GNOME/gvfs/merge_requests/30
client/gdaemonfile.c | 26 ++++++++++++--------------
client/gvfsiconloadable.c | 16 +++++++++++-----
2 files changed, 23 insertions(+), 19 deletions(-)
---
diff --git a/client/gdaemonfile.c b/client/gdaemonfile.c
index 485698b2..e5e0cc25 100644
--- a/client/gdaemonfile.c
+++ b/client/gdaemonfile.c
@@ -400,19 +400,21 @@ create_proxy_for_file2 (GFile *file1,
GDaemonFile *daemon_file2 = G_DAEMON_FILE (file2);
GMountInfo *mount_info1, *mount_info2;
GDBusConnection *connection;
+ GError *local_error = NULL;
if (path1_out)
*path1_out = NULL;
if (path2_out)
*path2_out = NULL;
+retry:
proxy = NULL;
mount_info2 = NULL;
mount_info1 = _g_daemon_vfs_get_mount_info_sync (daemon_file1->mount_spec,
daemon_file1->path,
cancellable,
- error);
+ &local_error);
if (mount_info1 == NULL)
goto out;
@@ -422,7 +424,7 @@ create_proxy_for_file2 (GFile *file1,
mount_info2 = _g_daemon_vfs_get_mount_info_sync (daemon_file2->mount_spec,
daemon_file2->path,
cancellable,
- error);
+ &local_error);
if (mount_info2 == NULL)
goto out;
@@ -435,7 +437,7 @@ create_proxy_for_file2 (GFile *file1,
}
}
- connection = _g_dbus_connection_get_sync (mount_info1->dbus_id, cancellable, error);
+ connection = _g_dbus_connection_get_sync (mount_info1->dbus_id, cancellable, &local_error);
if (connection == NULL)
goto out;
@@ -444,7 +446,7 @@ create_proxy_for_file2 (GFile *file1,
mount_info1->dbus_id,
mount_info1->object_path,
cancellable,
- error);
+ &local_error);
if (proxy == NULL)
goto out;
@@ -468,8 +470,12 @@ create_proxy_for_file2 (GFile *file1,
g_mount_info_unref (mount_info1);
if (mount_info2)
g_mount_info_unref (mount_info2);
- if (error && *error)
- g_dbus_error_strip_remote_error (*error);
+ if (g_error_matches (local_error, G_VFS_ERROR, G_VFS_ERROR_RETRY))
+ {
+ g_clear_error (&local_error);
+ goto retry;
+ }
+ _g_propagate_error_stripped (error, local_error);
return proxy;
}
@@ -2571,7 +2577,6 @@ g_daemon_file_set_attribute (GFile *file,
if (g_str_has_prefix (attribute, "metadata::"))
return set_metadata_attribute (file, attribute, type, value_p, cancellable, error);
- retry:
proxy = create_proxy_for_file (file, NULL, &path, NULL, cancellable, error);
if (proxy == NULL)
return FALSE;
@@ -2589,13 +2594,6 @@ g_daemon_file_set_attribute (GFile *file,
{
if (g_error_matches (my_error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
_g_dbus_send_cancelled_sync (g_dbus_proxy_get_connection (G_DBUS_PROXY (proxy)));
- else
- if (g_error_matches (my_error, G_VFS_ERROR, G_VFS_ERROR_RETRY))
- {
- g_clear_error (&my_error);
- g_object_unref (proxy);
- goto retry;
- }
_g_propagate_error_stripped (error, my_error);
return FALSE;
}
diff --git a/client/gvfsiconloadable.c b/client/gvfsiconloadable.c
index 7a9bf97b..76b0a360 100644
--- a/client/gvfsiconloadable.c
+++ b/client/gvfsiconloadable.c
@@ -44,18 +44,20 @@ create_proxy_for_icon (GVfsIcon *vfs_icon,
GVfsDBusMount *proxy;
GMountInfo *mount_info;
GDBusConnection *connection;
+ GError *local_error = NULL;
+retry:
proxy = NULL;
mount_info = _g_daemon_vfs_get_mount_info_sync (vfs_icon->mount_spec,
"/",
cancellable,
- error);
+ &local_error);
if (mount_info == NULL)
goto out;
- connection = _g_dbus_connection_get_sync (mount_info->dbus_id, cancellable, error);
+ connection = _g_dbus_connection_get_sync (mount_info->dbus_id, cancellable, &local_error);
if (connection == NULL)
goto out;
@@ -64,14 +66,18 @@ create_proxy_for_icon (GVfsIcon *vfs_icon,
mount_info->dbus_id,
mount_info->object_path,
cancellable,
- error);
+ &local_error);
out:
if (mount_info)
g_mount_info_unref (mount_info);
- if (error && *error)
- g_dbus_error_strip_remote_error (*error);
+ if (g_error_matches (local_error, G_VFS_ERROR, G_VFS_ERROR_RETRY))
+ {
+ g_clear_error (&local_error);
+ goto retry;
+ }
+ _g_propagate_error_stripped (error, local_error);
return proxy;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]