- Fix smb daemons deadlock due to GConf initialization

This commit is contained in:
Tomas Bzatek 2010-09-08 18:41:30 +02:00
parent 7faa838c9a
commit 8250fd9e7b
2 changed files with 162 additions and 1 deletions

View File

@ -0,0 +1,154 @@
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

@ -1,7 +1,7 @@
Summary: Backends for the gio framework in GLib
Name: gvfs
Version: 1.6.3
Release: 2%{?dist}
Release: 3%{?dist}
License: LGPLv2+
Group: System Environment/Libraries
URL: http://www.gtk.org
@ -44,6 +44,9 @@ Patch15: gvfs-1.5.1-gphoto2-no-storageinfo-support.patch
# https://bugzilla.gnome.org/show_bug.cgi?id=614544
Patch16: gvfs-1.6.2-stringv-dbus.patch
# from upstream
# https://bugzilla.gnome.org/show_bug.cgi?id=628889
Patch17: gvfs-1.6.4-gconf-deadlock.patch
Obsoletes: gnome-mount <= 0.8
Obsoletes: gnome-mount-nautilus-properties <= 0.8
@ -143,6 +146,7 @@ including phones and music players to applications using gvfs.
%patch0 -p1 -b .archive-integration
%patch15 -p1 -b .gphoto2-storageinfo
%patch16 -p1 -b .stringv-dbus
%patch17 -p1 -b .gconf-daemons
%build
@ -312,6 +316,9 @@ killall -USR1 gvfsd >&/dev/null || :
%endif
%changelog
* Wed Sep 8 2010 Tomas Bzatek <tbzatek@redhat.com> - 1.6.3-3
- Fix smb daemons deadlock due to GConf initialization
* Mon Jul 12 2010 Dan Horák <dan[at]danny.cz> - 1.6.3-2
- s390(x) machines can't connect mobile phones or players