summaryrefslogtreecommitdiff
path: root/daemon
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@redhat.com>2013-02-05 18:23:52 +0100
committerTomas Bzatek <tbzatek@redhat.com>2013-02-05 18:23:52 +0100
commit62ba3def657a053c0a8aa805e7e3fe3a25d3759d (patch)
tree1fc6078960f66e51a56eea2baab00bd3e5c87d45 /daemon
parent267bb33e0e3586f078a0d38ee2ccc5bd1ccab911 (diff)
downloadgvfs-62ba3def657a053c0a8aa805e7e3fe3a25d3759d.tar.gz
daemon: Implement proper org.gtk.vfs.MountTracker.UnregisterMount()
A proper unmount method was missing from the daemon interface as it was basically not needed. The mount tracker was watching mounts on the bus and if child disappeared, that event was treated as unmount. With recent introduction of gvfs test suite we started using man-in-the-middle program for connecting to private SMB server. However, certain libsmbclient versions are forking gvfs backends (gvfsd-smb in this case) which makes d-bus confused and name owner tracking doesn't work as expected. Moreover the forked process got stuck due to internal samba LIBSMB_PROG handling after the original process did its job and unmount was triggered from user side. The original process exited just fine but the forked one was blocking the name on the bus probably and gvfs mount tracker was fooled. Eventually the stuck libsmbclient call times out and exits gracefully. This happens with samba-3.6.9 This patch adds proper unmount call to indicate the backend is going away so even if there are leftovers, user is indicated a proper unmount. https://bugzilla.gnome.org/show_bug.cgi?id=691568
Diffstat (limited to 'daemon')
-rw-r--r--daemon/mount.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/daemon/mount.c b/daemon/mount.c
index d1341f56..54b694b3 100644
--- a/daemon/mount.c
+++ b/daemon/mount.c
@@ -956,6 +956,31 @@ handle_register_fuse (GVfsDBusMountTracker *object,
return TRUE;
}
+static gboolean
+handle_unregister_mount (GVfsDBusMountTracker *object,
+ GDBusMethodInvocation *invocation,
+ const gchar *arg_obj_path,
+ gpointer user_data)
+{
+ VfsMount *mount;
+ const char *id;
+
+ id = g_dbus_method_invocation_get_sender (invocation);
+
+ if (find_vfs_mount (id, arg_obj_path) == NULL) {
+ g_dbus_method_invocation_return_error_literal (invocation,
+ G_IO_ERROR,
+ G_IO_ERROR_NOT_MOUNTED,
+ "Mountpoint not registered");
+ return TRUE;
+ }
+
+ dbus_client_disconnected (id);
+
+ gvfs_dbus_mount_tracker_complete_unregister_mount (object, invocation);
+
+ return TRUE;
+}
static int reload_pipes[2];
@@ -1026,7 +1051,7 @@ mount_init (void)
g_signal_connect (mount_tracker, "handle-list-mounts", G_CALLBACK (handle_list_mounts), NULL);
g_signal_connect (mount_tracker, "handle-list-mountable-info", G_CALLBACK (handle_list_mountable_info), NULL);
g_signal_connect (mount_tracker, "handle-list-mount-types", G_CALLBACK (handle_list_mount_types), NULL);
- /* FIXME: handle unregisterMount() */
+ g_signal_connect (mount_tracker, "handle-unregister-mount", G_CALLBACK (handle_unregister_mount), NULL);
error = NULL;
if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (mount_tracker), conn,