Fix thread-safety issues in gvfs-fuse-daemon
This commit is contained in:
parent
beaa046b51
commit
e50becb745
85
gvfs-fuse-threading.patch
Normal file
85
gvfs-fuse-threading.patch
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
Index: client/gvfsfusedaemon.c
|
||||||
|
===================================================================
|
||||||
|
--- client/gvfsfusedaemon.c (revision 1744)
|
||||||
|
+++ client/gvfsfusedaemon.c (working copy)
|
||||||
|
@@ -71,6 +71,8 @@
|
||||||
|
} FileOp;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
+ gint refcount;
|
||||||
|
+
|
||||||
|
GMutex *mutex;
|
||||||
|
FileOp op;
|
||||||
|
gpointer stream;
|
||||||
|
@@ -188,12 +190,26 @@
|
||||||
|
FileHandle *file_handle;
|
||||||
|
|
||||||
|
file_handle = g_new0 (FileHandle, 1);
|
||||||
|
+ file_handle->refcount = 1;
|
||||||
|
file_handle->mutex = g_mutex_new ();
|
||||||
|
file_handle->op = FILE_OP_NONE;
|
||||||
|
|
||||||
|
return file_handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static FileHandle *
|
||||||
|
+file_handle_ref (FileHandle *file_handle)
|
||||||
|
+{
|
||||||
|
+ g_atomic_int_inc (&file_handle->refcount);
|
||||||
|
+ return file_handle;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static gboolean
|
||||||
|
+file_handle_unref (FileHandle *file_handle)
|
||||||
|
+{
|
||||||
|
+ return g_atomic_int_dec_and_test (&file_handle->refcount);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static void
|
||||||
|
file_handle_close_stream (FileHandle *file_handle)
|
||||||
|
{
|
||||||
|
@@ -278,21 +294,19 @@
|
||||||
|
g_static_mutex_unlock (&global_mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
-static gboolean
|
||||||
|
+static void
|
||||||
|
free_file_handle_for_path (const gchar *path)
|
||||||
|
{
|
||||||
|
FileHandle *fh;
|
||||||
|
|
||||||
|
- fh = get_file_handle_for_path (path);
|
||||||
|
+ g_static_mutex_lock (&global_mutex);
|
||||||
|
+ fh = g_hash_table_lookup (global_fh_table, path);
|
||||||
|
if (fh)
|
||||||
|
{
|
||||||
|
- g_static_mutex_lock (&global_mutex);
|
||||||
|
- g_hash_table_remove (global_fh_table, path);
|
||||||
|
- g_static_mutex_unlock (&global_mutex);
|
||||||
|
- return TRUE;
|
||||||
|
+ if (file_handle_unref (fh))
|
||||||
|
+ g_hash_table_remove (global_fh_table, path);
|
||||||
|
}
|
||||||
|
-
|
||||||
|
- return FALSE;
|
||||||
|
+ g_static_mutex_unlock (&global_mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
static MountRecord *
|
||||||
|
@@ -923,6 +937,7 @@
|
||||||
|
|
||||||
|
/* File exists */
|
||||||
|
|
||||||
|
+ file_handle_ref (fh);
|
||||||
|
SET_FILE_HANDLE (fi, fh);
|
||||||
|
|
||||||
|
debug_print ("vfs_open: flags=%o\n", fi->flags);
|
||||||
|
@@ -1013,6 +1028,7 @@
|
||||||
|
|
||||||
|
/* Success */
|
||||||
|
|
||||||
|
+ file_handle_ref (fh);
|
||||||
|
SET_FILE_HANDLE (fi, fh);
|
||||||
|
|
||||||
|
g_assert (fh->stream == NULL);
|
||||||
|
|
11
gvfs.spec
11
gvfs.spec
@ -1,7 +1,7 @@
|
|||||||
Summary: Backends for the gio framework in GLib
|
Summary: Backends for the gio framework in GLib
|
||||||
Name: gvfs
|
Name: gvfs
|
||||||
Version: 0.2.3
|
Version: 0.2.3
|
||||||
Release: 7%{?dist}
|
Release: 8%{?dist}
|
||||||
License: LGPLv2+
|
License: LGPLv2+
|
||||||
Group: System Environment/Libraries
|
Group: System Environment/Libraries
|
||||||
URL: http://www.gtk.org
|
URL: http://www.gtk.org
|
||||||
@ -41,6 +41,9 @@ Patch5: gphoto-unmount-hang.patch
|
|||||||
Patch6: gvfs-gphoto-automount.patch
|
Patch6: gvfs-gphoto-automount.patch
|
||||||
Patch7: gvfs-unmount-scheme.patch
|
Patch7: gvfs-unmount-scheme.patch
|
||||||
|
|
||||||
|
# http://mail.gnome.org/archives/gvfs-list/2008-April/msg00017.html
|
||||||
|
Patch8: gvfs-fuse-threading.patch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
The gvfs package provides backend implementations for the gio
|
The gvfs package provides backend implementations for the gio
|
||||||
framework in GLib. It includes ftp, sftp, cifs.
|
framework in GLib. It includes ftp, sftp, cifs.
|
||||||
@ -75,6 +78,7 @@ to access the gvfs filesystems.
|
|||||||
%patch5 -p1 -b .gphoto-unmount-hang
|
%patch5 -p1 -b .gphoto-unmount-hang
|
||||||
%patch6 -p1 -b .gphoto-automount
|
%patch6 -p1 -b .gphoto-automount
|
||||||
%patch7 -p1 -b .unmount-scheme
|
%patch7 -p1 -b .unmount-scheme
|
||||||
|
%patch8 -p0 -b .fuse-threading
|
||||||
|
|
||||||
%build
|
%build
|
||||||
|
|
||||||
@ -180,7 +184,7 @@ update-desktop-database &> /dev/null ||:
|
|||||||
%dir %{_includedir}/gvfs-client/gvfs
|
%dir %{_includedir}/gvfs-client/gvfs
|
||||||
%{_includedir}/gvfs-client/gvfs/gvfsurimapper.h
|
%{_includedir}/gvfs-client/gvfs/gvfsurimapper.h
|
||||||
%{_includedir}/gvfs-client/gvfs/gvfsuriutils.h
|
%{_includedir}/gvfs-client/gvfs/gvfsuriutils.h
|
||||||
%{_libdir}/libgvfscommon.so
|
|
||||||
|
|
||||||
%files fuse
|
%files fuse
|
||||||
%defattr(-, root, root, -)
|
%defattr(-, root, root, -)
|
||||||
@ -188,6 +192,9 @@ update-desktop-database &> /dev/null ||:
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Apr 18 2008 Matthias Clasen <mclasen@redhat.com> - 0.2.3-8
|
||||||
|
- Fix thread-safety issues in gvfs-fuse-daemon
|
||||||
|
|
||||||
* Thu Apr 17 2008 David Zeuthen <davidz@redhat.com> - 0.2.3-7
|
* Thu Apr 17 2008 David Zeuthen <davidz@redhat.com> - 0.2.3-7
|
||||||
- Put X-Gnome-Vfs-System=gio into mount-archarive.desktop (See #442835)
|
- Put X-Gnome-Vfs-System=gio into mount-archarive.desktop (See #442835)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user