- Fix sftp poll timeout

This commit is contained in:
Tomas Bzatek 2010-10-04 14:40:15 +02:00
parent 0a44d66900
commit 0a7db7a5b6
3 changed files with 42 additions and 155 deletions

View File

@ -1,154 +0,0 @@
From 5c060227daefafb6c0751422fa585483fc861515 Mon Sep 17 00:00:00 2001
From: Tomas Bzatek <tbzatek@redhat.com>
Date: Wed, 08 Sep 2010 16:13:20 +0000
Subject: Move GConf initialization from backend constructor
Solve the deadlock described in bug 628889
---
diff --git a/daemon/gvfsbackendsmb.c b/daemon/gvfsbackendsmb.c
index 88dac26..a4010c5 100644
--- a/daemon/gvfsbackendsmb.c
+++ b/daemon/gvfsbackendsmb.c
@@ -121,6 +121,27 @@ g_vfs_backend_smb_finalize (GObject *object)
static void
g_vfs_backend_smb_init (GVfsBackendSmb *backend)
{
+#ifdef HAVE_GCONF
+ GConfClient *gclient;
+#endif
+
+#ifdef HAVE_GCONF
+ gclient = gconf_client_get_default ();
+ if (gclient)
+ {
+ char *workgroup;
+
+ workgroup = gconf_client_get_string (gclient,
+ PATH_GCONF_GNOME_VFS_SMB_WORKGROUP, NULL);
+
+ if (workgroup && workgroup[0])
+ default_workgroup = workgroup;
+ else
+ g_free (workgroup);
+
+ g_object_unref (gclient);
+ }
+#endif
}
/**
@@ -2109,9 +2130,6 @@ g_vfs_backend_smb_class_init (GVfsBackendSmbClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GVfsBackendClass *backend_class = G_VFS_BACKEND_CLASS (klass);
-#ifdef HAVE_GCONF
- GConfClient *gclient;
-#endif
gobject_class->finalize = g_vfs_backend_smb_finalize;
@@ -2138,25 +2156,6 @@ g_vfs_backend_smb_class_init (GVfsBackendSmbClass *klass)
backend_class->move = do_move;
backend_class->try_query_settable_attributes = try_query_settable_attributes;
backend_class->set_attribute = do_set_attribute;
-
-#ifdef HAVE_GCONF
- gclient = gconf_client_get_default ();
- if (gclient)
- {
- char *workgroup;
-
- workgroup = gconf_client_get_string (gclient,
- PATH_GCONF_GNOME_VFS_SMB_WORKGROUP, NULL);
-
- if (workgroup && workgroup[0])
- default_workgroup = workgroup;
- else
- g_free (workgroup);
-
- g_object_unref (gclient);
- }
-#endif
-
}
void
diff --git a/daemon/gvfsbackendsmbbrowse.c b/daemon/gvfsbackendsmbbrowse.c
index 97d3c99..dd3dc2a 100644
--- a/daemon/gvfsbackendsmbbrowse.c
+++ b/daemon/gvfsbackendsmbbrowse.c
@@ -247,11 +247,35 @@ g_vfs_backend_smb_browse_finalize (GObject *object)
static void
g_vfs_backend_smb_browse_init (GVfsBackendSmbBrowse *backend)
{
+#ifdef HAVE_GCONF
+ GConfClient *gclient;
+#endif
+
backend->entries_lock = g_mutex_new ();
backend->update_cache_lock = g_mutex_new ();
if (mount_tracker == NULL)
mount_tracker = g_mount_tracker_new (NULL);
+
+#ifdef HAVE_GCONF
+ gclient = gconf_client_get_default ();
+ if (gclient)
+ {
+ char *workgroup;
+
+ workgroup = gconf_client_get_string (gclient,
+ PATH_GCONF_GNOME_VFS_SMB_WORKGROUP, NULL);
+
+ if (workgroup && workgroup[0])
+ default_workgroup = workgroup;
+ else
+ g_free (workgroup);
+
+ g_object_unref (gclient);
+ }
+#endif
+
+ DEBUG ("g_vfs_backend_smb_browse_init: default workgroup = '%s'\n", default_workgroup ? default_workgroup : "NULL");
}
/**
@@ -1456,9 +1480,6 @@ g_vfs_backend_smb_browse_class_init (GVfsBackendSmbBrowseClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GVfsBackendClass *backend_class = G_VFS_BACKEND_CLASS (klass);
-#ifdef HAVE_GCONF
- GConfClient *gclient;
-#endif
gobject_class->finalize = g_vfs_backend_smb_browse_finalize;
@@ -1475,26 +1496,6 @@ g_vfs_backend_smb_browse_class_init (GVfsBackendSmbBrowseClass *klass)
backend_class->try_query_info = try_query_info;
backend_class->enumerate = do_enumerate;
backend_class->try_enumerate = try_enumerate;
-
-#ifdef HAVE_GCONF
- gclient = gconf_client_get_default ();
- if (gclient)
- {
- char *workgroup;
-
- workgroup = gconf_client_get_string (gclient,
- PATH_GCONF_GNOME_VFS_SMB_WORKGROUP, NULL);
-
- if (workgroup && workgroup[0])
- default_workgroup = workgroup;
- else
- g_free (workgroup);
-
- g_object_unref (gclient);
- }
-#endif
-
- DEBUG ("g_vfs_backend_smb_browse_class_init - default workgroup = '%s'\n", default_workgroup ? default_workgroup : "NULL");
}
void
--
cgit v0.8.3.1

View File

@ -0,0 +1,30 @@
From 4033907045abcf498686c1b34be7b0160260088d Mon Sep 17 00:00:00 2001
From: Andreas Henriksson <andreas@fatal.se>
Date: Sat, 02 Oct 2010 12:51:54 +0000
Subject: sftp: fix poll() timeout.
When switching from select() to poll() in commit
"sftp: Use poll() to cope with openssh-5.6 changes" (c6be45c8934)
the difference in seconds vs milliseconds for select/poll timeout
argument was missed.
SFTP_READ_TIMEOUT is defined in seconds, so multiply it with 1000
when using it with poll().
https://bugzilla.gnome.org/show_bug.cgi?id=631169
---
diff --git a/daemon/gvfsbackendsftp.c b/daemon/gvfsbackendsftp.c
index 9fecf6a..f6b7785 100644
--- a/daemon/gvfsbackendsftp.c
+++ b/daemon/gvfsbackendsftp.c
@@ -869,7 +869,7 @@ handle_login (GVfsBackend *backend,
fds[1].fd = prompt_fd;
fds[1].events = POLLIN;
- ret = poll(fds, 2, SFTP_READ_TIMEOUT);
+ ret = poll(fds, 2, SFTP_READ_TIMEOUT * 1000);
if (ret <= 0)
{
--
cgit v0.8.3.1

View File

@ -1,7 +1,7 @@
Summary: Backends for the gio framework in GLib
Name: gvfs
Version: 1.6.4
Release: 1%{?dist}
Release: 2%{?dist}
License: LGPLv2+
Group: System Environment/Libraries
URL: http://www.gtk.org
@ -40,6 +40,12 @@ Patch0: gvfs-archive-integration.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=552856
Patch15: gvfs-1.5.1-gphoto2-no-storageinfo-support.patch
# from upstream
Patch16: gvfs-1.6.2-stringv-dbus.patch
# from upstream
Patch17: gvfs-1.6.5-sftp-poll-timeout.patch
Obsoletes: gnome-mount <= 0.8
Obsoletes: gnome-mount-nautilus-properties <= 0.8
@ -137,6 +143,8 @@ including phones and music players to applications using gvfs.
%setup -q
%patch0 -p1 -b .archive-integration
%patch15 -p1 -b .gphoto2-storageinfo
%patch16 -p1 -b .stringv-dbus
%patch17 -p1 -b .sftp-timeout
%build
@ -306,6 +314,9 @@ killall -USR1 gvfsd >&/dev/null || :
%endif
%changelog
* Mon Oct 4 2010 Tomas Bzatek <tbzatek@redhat.com> - 1.6.4-2
- Fix sftp poll timeout
* Wed Sep 29 2010 Matthias Clasen <mclasen@redhat.com> - 1.6.4-1
- Update to 1.6.4