[gvfs/wip/oholy/mount-info-invalidation: 7/7] 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: 7/7] client: Fix mount info cache invalidation
- Date: Mon, 4 Mar 2019 11:34:33 +0000 (UTC)
commit 23603b0315cd5c8c3226d1474b3dcdbc58cabc4a
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 | 39 ++++++++++++++++-----------------------
client/gvfsiconloadable.c | 19 ++++++++++++++-----
2 files changed, 30 insertions(+), 28 deletions(-)
---
diff --git a/client/gdaemonfile.c b/client/gdaemonfile.c
index 485698b2..2a8c1511 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,20 +424,20 @@ 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;
if (! g_mount_info_equal (mount_info1, mount_info2))
{
/* For copy this will cause the fallback code to be involved */
- g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
+ g_set_error_literal (&local_error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
_("Operation not supported, files on different mounts"));
goto out;
}
}
- 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,15 @@ 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 (local_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 +2580,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 +2597,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;
}
@@ -2730,7 +2731,6 @@ file_transfer (GFile *source,
}
}
-retry:
my_error = NULL;
proxy = create_proxy_for_file2 (file1, file2,
@@ -2850,13 +2850,6 @@ retry:
_g_dbus_send_cancelled_with_serial_sync (g_dbus_proxy_get_connection (G_DBUS_PROXY (proxy)),
serial);
}
- else
- if (g_error_matches (my_error, G_VFS_ERROR, G_VFS_ERROR_RETRY))
- {
- g_clear_error (&my_error);
- g_clear_object (&proxy);
- goto retry;
- }
_g_propagate_error_stripped (error, my_error);
}
diff --git a/client/gvfsiconloadable.c b/client/gvfsiconloadable.c
index 7a9bf97b..e6a0a8f4 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,21 @@ 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 (local_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]