r17351 - in /desktop/unstable/gvfs/debian: changelog patches/series patches/upstream_r1819 patches/upstream_r1822 patches/upstream_r1844 patches/upstream_r1854 patches/upstream_r2052 patches/upstream_r2056
joss at users.alioth.debian.org
joss at users.alioth.debian.org
Mon Oct 27 09:29:50 UTC 2008
Author: joss
Date: Mon Oct 27 09:29:49 2008
New Revision: 17351
URL: http://svn.debian.org/wsvn/pkg-gnome/?sc=1&rev=17351
Log:
* NMU
* Apply upstream SVN r1819 - "(reindex_file_handle_for_path): Steal the old
file handle record from the global hash table before replacing its path,
not after."
* Apply upstream SVN r1822: "(vfs_create): Hold the file handle lock while
opening the stream."
* Apply upstream SVN r1844: "Don't call statvfs on /."
* Apply upstream SVN r1854: "Avoid a race between the subthread and the
main thread in the case of dbus going bye-bye."
* Apply part of r2052: "Set st_blocks & co so that du works."
* Apply upstream SVN r2056: "Attempt to prevent potential race conditions in
the FUSE backend when file handles get closed while still in use in
another thread, if that ever happens." closes: #496269.
Added:
desktop/unstable/gvfs/debian/patches/upstream_r1819
desktop/unstable/gvfs/debian/patches/upstream_r1822
desktop/unstable/gvfs/debian/patches/upstream_r1844
desktop/unstable/gvfs/debian/patches/upstream_r1854
desktop/unstable/gvfs/debian/patches/upstream_r2052
desktop/unstable/gvfs/debian/patches/upstream_r2056
Modified:
desktop/unstable/gvfs/debian/changelog
desktop/unstable/gvfs/debian/patches/series
Modified: desktop/unstable/gvfs/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/gvfs/debian/changelog?rev=17351&op=diff
==============================================================================
--- desktop/unstable/gvfs/debian/changelog (original)
+++ desktop/unstable/gvfs/debian/changelog Mon Oct 27 09:29:49 2008
@@ -1,3 +1,21 @@
+gvfs (0.2.5-1.1) unstable; urgency=high
+
+ * NMU
+ * Apply upstream SVN r1819 - "(reindex_file_handle_for_path): Steal the old
+ file handle record from the global hash table before replacing its path,
+ not after."
+ * Apply upstream SVN r1822: "(vfs_create): Hold the file handle lock while
+ opening the stream."
+ * Apply upstream SVN r1844: "Don't call statvfs on /."
+ * Apply upstream SVN r1854: "Avoid a race between the subthread and the
+ main thread in the case of dbus going bye-bye."
+ * Apply part of r2052: "Set st_blocks & co so that du works."
+ * Apply upstream SVN r2056: "Attempt to prevent potential race conditions in
+ the FUSE backend when file handles get closed while still in use in
+ another thread, if that ever happens." closes: #496269.
+
+ -- Clint Adams <schizo at debian.org> Sat, 25 Oct 2008 09:29:53 -0400
+
gvfs (0.2.5-1) unstable; urgency=low
* New upstream bugfix release:
Modified: desktop/unstable/gvfs/debian/patches/series
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/gvfs/debian/patches/series?rev=17351&op=diff
==============================================================================
--- desktop/unstable/gvfs/debian/patches/series (original)
+++ desktop/unstable/gvfs/debian/patches/series Mon Oct 27 09:29:49 2008
@@ -1,0 +1,6 @@
+upstream_r1819
+upstream_r1822
+upstream_r1844
+upstream_r1854
+upstream_r2052
+upstream_r2056
Added: desktop/unstable/gvfs/debian/patches/upstream_r1819
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/gvfs/debian/patches/upstream_r1819?rev=17351&op=file
==============================================================================
--- desktop/unstable/gvfs/debian/patches/upstream_r1819 (added)
+++ desktop/unstable/gvfs/debian/patches/upstream_r1819 Mon Oct 27 09:29:49 2008
@@ -1,0 +1,15 @@
+--- trunk/client/gvfsfusedaemon.c 2008/05/23 03:21:17 1783
++++ trunk/client/gvfsfusedaemon.c 2008/07/18 03:21:34 1819
+@@ -311,9 +311,11 @@
+ (gpointer *) &fh))
+ goto out;
+
++ g_hash_table_steal (global_fh_table, old_path);
++
+ g_free (fh->path);
+ fh->path = g_strdup (new_path);
+- g_hash_table_steal (global_fh_table, old_path);
++
+ g_hash_table_insert (global_fh_table, fh->path, fh);
+
+ out:
Added: desktop/unstable/gvfs/debian/patches/upstream_r1822
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/gvfs/debian/patches/upstream_r1822?rev=17351&op=file
==============================================================================
--- desktop/unstable/gvfs/debian/patches/upstream_r1822 (added)
+++ desktop/unstable/gvfs/debian/patches/upstream_r1822 Mon Oct 27 09:29:49 2008
@@ -1,0 +1,34 @@
+--- trunk/client/gvfsfusedaemon.c 2008/07/18 03:21:34 1819
++++ trunk/client/gvfsfusedaemon.c 2008/07/18 23:18:52 1822
+@@ -959,11 +959,15 @@
+
+ /* Set up a stream here, so we can check for errors */
+
++ g_mutex_lock (fh->mutex);
++
+ if (fi->flags & O_WRONLY || fi->flags & O_RDWR)
+ result = setup_output_stream (file, fh);
+ else
+ result = setup_input_stream (file, fh);
+
++ g_mutex_unlock (fh->mutex);
++
+ /* The added reference to the file handle is released in vfs_release() */
+ }
+ else if (file_type == G_FILE_TYPE_DIRECTORY)
+@@ -1047,11 +1051,14 @@
+
+ SET_FILE_HANDLE (fi, fh);
+
+- g_assert (fh->stream == NULL);
++ g_mutex_lock (fh->mutex);
+
++ file_handle_close_stream (fh);
+ fh->stream = file_output_stream;
+ fh->op = FILE_OP_WRITE;
+
++ g_mutex_unlock (fh->mutex);
++
+ /* The added reference to the file handle is released in vfs_release() */
+ }
+ else
Added: desktop/unstable/gvfs/debian/patches/upstream_r1844
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/gvfs/debian/patches/upstream_r1844?rev=17351&op=file
==============================================================================
--- desktop/unstable/gvfs/debian/patches/upstream_r1844 (added)
+++ desktop/unstable/gvfs/debian/patches/upstream_r1844 Mon Oct 27 09:29:49 2008
@@ -1,0 +1,12 @@
+--- trunk/client/gvfsfusedaemon.c 2008/07/18 23:18:52 1822
++++ trunk/client/gvfsfusedaemon.c 2008/07/29 03:40:14 1844
+@@ -666,9 +666,6 @@
+ stbuf->f_flag = 0; /* Ignored by FUSE */
+ stbuf->f_namemax = 1024;
+
+- if (statvfs ("/", stbuf) != 0)
+- result = -errno;
+-
+ debug_print ("vfs_statfs: -> %s\n", strerror (-result));
+
+ return result;
Added: desktop/unstable/gvfs/debian/patches/upstream_r1854
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/gvfs/debian/patches/upstream_r1854?rev=17351&op=file
==============================================================================
--- desktop/unstable/gvfs/debian/patches/upstream_r1854 (added)
+++ desktop/unstable/gvfs/debian/patches/upstream_r1854 Mon Oct 27 09:29:49 2008
@@ -1,0 +1,20 @@
+--- trunk/client/gvfsfusedaemon.c 2008/07/29 03:40:14 1844
++++ trunk/client/gvfsfusedaemon.c 2008/08/03 08:31:14 1854
+@@ -2037,6 +2037,7 @@
+ g_signal_handlers_disconnect_by_func (volume_monitor, mount_tracker_unmounted_cb, NULL);
+
+ g_main_loop_unref (subthread_main_loop);
++ subthread_main_loop = NULL;
+
+ g_object_unref (volume_monitor);
+ volume_monitor = NULL;
+@@ -2148,7 +2149,8 @@
+ vfs_destroy (gpointer param)
+ {
+ mount_list_free ();
+- g_main_loop_quit (subthread_main_loop);
++ if (subthread_main_loop != NULL)
++ g_main_loop_quit (subthread_main_loop);
+ g_mutex_free (mount_list_mutex);
+ g_object_unref (gvfs);
+ }
Added: desktop/unstable/gvfs/debian/patches/upstream_r2052
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/gvfs/debian/patches/upstream_r2052?rev=17351&op=file
==============================================================================
--- desktop/unstable/gvfs/debian/patches/upstream_r2052 (added)
+++ desktop/unstable/gvfs/debian/patches/upstream_r2052 Mon Oct 27 09:29:49 2008
@@ -1,0 +1,16 @@
+--- trunk/client/gvfsfusedaemon.c 2008/10/16 12:59:39 2051
++++ trunk/client/gvfsfusedaemon.c 2008/10/16 16:54:31 2052
+@@ -744,6 +744,13 @@
+ if (g_file_info_has_attribute (file_info, G_FILE_ATTRIBUTE_TIME_ACCESS))
+ sbuf->st_atime = file_info_get_attribute_as_uint (file_info, G_FILE_ATTRIBUTE_TIME_ACCESS);
+
++ if (g_file_info_has_attribute (file_info, G_FILE_ATTRIBUTE_UNIX_BLOCK_SIZE))
++ sbuf->st_blksize = file_info_get_attribute_as_uint (file_info, G_FILE_ATTRIBUTE_UNIX_BLOCK_SIZE);
++ if (g_file_info_has_attribute (file_info, G_FILE_ATTRIBUTE_UNIX_BLOCKS))
++ sbuf->st_blocks = file_info_get_attribute_as_uint (file_info, G_FILE_ATTRIBUTE_UNIX_BLOCKS);
++ else /* fake it to make 'du' work like 'du --apparent'. */
++ sbuf->st_blocks = (sbuf->st_size + 1) / 512;
++
+ /* Setting st_nlink to 1 for directories makes 'find' work */
+ sbuf->st_nlink = 1;
+
Added: desktop/unstable/gvfs/debian/patches/upstream_r2056
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/gvfs/debian/patches/upstream_r2056?rev=17351&op=file
==============================================================================
--- desktop/unstable/gvfs/debian/patches/upstream_r2056 (added)
+++ desktop/unstable/gvfs/debian/patches/upstream_r2056 Mon Oct 27 09:29:49 2008
@@ -1,0 +1,427 @@
+--- trunk/client/gvfsfusedaemon.c 2008/10/16 16:54:31 2052
++++ trunk/client/gvfsfusedaemon.c 2008/10/17 06:55:20 2056
+@@ -79,22 +79,23 @@
+ size_t pos;
+ } FileHandle;
+
+-static GThread *subthread = NULL;
+-static GMainLoop *subthread_main_loop = NULL;
+-static GVfs *gvfs = NULL;
++static GThread *subthread = NULL;
++static GMainLoop *subthread_main_loop = NULL;
++static GVfs *gvfs = NULL;
+
+-static GVolumeMonitor *volume_monitor = NULL;
++static GVolumeMonitor *volume_monitor = NULL;
+
+ /* Contains pointers to MountRecord */
+-static GList *mount_list = NULL;
+-static GMutex *mount_list_mutex;
++static GList *mount_list = NULL;
++static GMutex *mount_list_mutex;
+
+-static time_t daemon_creation_time;
+-static uid_t daemon_uid;
+-static gid_t daemon_gid;
+-
+-static GStaticMutex global_mutex = G_STATIC_MUTEX_INIT;
+-static GHashTable *global_fh_table = NULL;
++static time_t daemon_creation_time;
++static uid_t daemon_uid;
++static gid_t daemon_gid;
++
++static GStaticMutex global_mutex = G_STATIC_MUTEX_INIT;
++static GHashTable *global_path_to_fh_map = NULL;
++static GHashTable *global_active_fh_map = NULL;
+
+ /* ------- *
+ * Helpers *
+@@ -194,6 +195,8 @@
+ file_handle->op = FILE_OP_NONE;
+ file_handle->path = g_strdup (path);
+
++ g_hash_table_insert (global_active_fh_map, file_handle, file_handle);
++
+ return file_handle;
+ }
+
+@@ -209,14 +212,18 @@
+ {
+ if (g_atomic_int_dec_and_test (&file_handle->refcount))
+ {
++ gint refs;
++
+ g_static_mutex_lock (&global_mutex);
+
+ /* Test again, since e.g. get_file_handle_for_path() might have
+ * snatched the global mutex and revived the file handle between
+- * g_atomic_int_dec_and_test() and us obtaining the lock. */
++ * g_atomic_int_dec_and_test() and us obtaining the global lock. */
++
++ refs = g_atomic_int_get (&file_handle->refcount);
+
+- if (g_atomic_int_get (&file_handle->refcount) == 0)
+- g_hash_table_remove (global_fh_table, file_handle->path);
++ if (refs == 0)
++ g_hash_table_remove (global_path_to_fh_map, file_handle->path);
+
+ g_static_mutex_unlock (&global_mutex);
+ }
+@@ -252,6 +259,8 @@
+ static void
+ file_handle_free (FileHandle *file_handle)
+ {
++ g_hash_table_remove (global_active_fh_map, file_handle);
++
+ file_handle_close_stream (file_handle);
+ g_mutex_free (file_handle->mutex);
+ g_free (file_handle->path);
+@@ -265,12 +274,12 @@
+
+ g_static_mutex_lock (&global_mutex);
+
+- fh = g_hash_table_lookup (global_fh_table, path);
++ fh = g_hash_table_lookup (global_path_to_fh_map, path);
++
+ if (fh)
+ file_handle_ref (fh);
+
+ g_static_mutex_unlock (&global_mutex);
+-
+ return fh;
+ }
+
+@@ -281,7 +290,7 @@
+
+ g_static_mutex_lock (&global_mutex);
+
+- fh = g_hash_table_lookup (global_fh_table, path);
++ fh = g_hash_table_lookup (global_path_to_fh_map, path);
+
+ if (fh)
+ {
+@@ -290,11 +299,30 @@
+ else
+ {
+ fh = file_handle_new (path);
+- g_hash_table_insert (global_fh_table, fh->path, fh);
++ g_hash_table_insert (global_path_to_fh_map, fh->path, fh);
+ }
+
+ g_static_mutex_unlock (&global_mutex);
++ return fh;
++}
++
++static FileHandle *
++get_file_handle_from_info (struct fuse_file_info *fi)
++{
++ FileHandle *fh;
+
++ g_static_mutex_lock (&global_mutex);
++
++ fh = GET_FILE_HANDLE (fi);
++
++ /* If the file handle is still valid, its value won't change. If
++ * invalid, it's set to NULL. */
++ fh = g_hash_table_lookup (global_active_fh_map, fh);
++
++ if (fh)
++ file_handle_ref (fh);
++
++ g_static_mutex_unlock (&global_mutex);
+ return fh;
+ }
+
+@@ -306,17 +334,17 @@
+
+ g_static_mutex_lock (&global_mutex);
+
+- if (!g_hash_table_lookup_extended (global_fh_table, old_path,
++ if (!g_hash_table_lookup_extended (global_path_to_fh_map, old_path,
+ (gpointer *) &old_path_internal,
+ (gpointer *) &fh))
+ goto out;
+
+- g_hash_table_steal (global_fh_table, old_path);
++ g_hash_table_steal (global_path_to_fh_map, old_path);
+
+ g_free (fh->path);
+ fh->path = g_strdup (new_path);
+
+- g_hash_table_insert (global_fh_table, fh->path, fh);
++ g_hash_table_insert (global_path_to_fh_map, fh->path, fh);
+
+ out:
+ g_static_mutex_unlock (&global_mutex);
+@@ -779,14 +807,9 @@
+ {
+ GFile *file;
+ gint result = 0;
+- FileHandle *fh;
+
+ debug_print ("vfs_getattr: %s\n", path);
+
+- fh = get_file_handle_for_path (path);
+- if (fh)
+- g_mutex_lock (fh->mutex);
+-
+ memset (sbuf, 0, sizeof (*sbuf));
+
+ sbuf->st_dev = 0; /* dev_t ID of device containing file */
+@@ -825,12 +848,6 @@
+ result = -ENOENT;
+ }
+
+- if (fh)
+- {
+- g_mutex_unlock (fh->mutex);
+- file_handle_unref (fh);
+- }
+-
+ debug_print ("vfs_getattr: -> %s\n", strerror (-result));
+
+ return result;
+@@ -954,7 +971,9 @@
+ if (file_type == G_FILE_TYPE_REGULAR)
+ {
+ FileHandle *fh = get_or_create_file_handle_for_path (path);
+-
++
++ g_mutex_lock (fh->mutex);
++
+ /* File exists */
+
+ SET_FILE_HANDLE (fi, fh);
+@@ -963,8 +982,6 @@
+
+ /* Set up a stream here, so we can check for errors */
+
+- g_mutex_lock (fh->mutex);
+-
+ if (fi->flags & O_WRONLY || fi->flags & O_RDWR)
+ result = setup_output_stream (file, fh);
+ else
+@@ -1053,10 +1070,10 @@
+
+ /* Success */
+
+- SET_FILE_HANDLE (fi, fh);
+-
+ g_mutex_lock (fh->mutex);
+
++ SET_FILE_HANDLE (fi, fh);
++
+ file_handle_close_stream (fh);
+ fh->stream = file_output_stream;
+ fh->op = FILE_OP_WRITE;
+@@ -1087,12 +1104,16 @@
+ static gint
+ vfs_release (const gchar *path, struct fuse_file_info *fi)
+ {
+- FileHandle *fh = GET_FILE_HANDLE (fi);
++ FileHandle *fh = get_file_handle_from_info (fi);
+
+ debug_print ("vfs_release: %s\n", path);
+
+ if (fh)
+- file_handle_unref (fh);
++ {
++ /* get_file_handle_from_info () adds a "working ref", so unref twice. */
++ file_handle_unref (fh);
++ file_handle_unref (fh);
++ }
+
+ return 0;
+ }
+@@ -1209,23 +1230,32 @@
+
+ if ((file = file_from_full_path (path)))
+ {
+- FileHandle *fh = GET_FILE_HANDLE (fi);
++ FileHandle *fh = get_file_handle_from_info (fi);
+
+- g_mutex_lock (fh->mutex);
++ if (fh)
++ {
++ g_mutex_lock (fh->mutex);
+
+- result = setup_input_stream (file, fh);
++ result = setup_input_stream (file, fh);
+
+- if (result == 0)
+- {
+- result = read_stream (fh, buf, size, offset);
++ if (result == 0)
++ {
++ result = read_stream (fh, buf, size, offset);
++ }
++ else
++ {
++ debug_print ("vfs_read: failed to setup input_stream!\n");
++ }
++
++ g_mutex_unlock (fh->mutex);
++ file_handle_unref (fh);
+ }
+ else
+ {
+- debug_print ("vfs_read: failed to setup input_stream!\n");
++ result = -EINVAL;
+ }
+
+ g_object_unref (file);
+- g_mutex_unlock (fh->mutex);
+ }
+ else
+ {
+@@ -1328,18 +1358,27 @@
+
+ if ((file = file_from_full_path (path)))
+ {
+- FileHandle *fh = GET_FILE_HANDLE (fi);
++ FileHandle *fh = get_file_handle_from_info (fi);
+
+- g_mutex_lock (fh->mutex);
++ if (fh)
++ {
++ g_mutex_lock (fh->mutex);
+
+- result = setup_output_stream (file, fh);
+- if (result == 0)
++ result = setup_output_stream (file, fh);
++ if (result == 0)
++ {
++ result = write_stream (fh, buf, len, offset);
++ }
++
++ g_mutex_unlock (fh->mutex);
++ file_handle_unref (fh);
++ }
++ else
+ {
+- result = write_stream (fh, buf, len, offset);
++ result = -EINVAL;
+ }
+
+ g_object_unref (file);
+- g_mutex_unlock (fh->mutex);
+ }
+ else
+ {
+@@ -1497,9 +1536,7 @@
+
+ if (old_file && new_file)
+ {
+- FileHandle *fh;
+-
+- fh = get_file_handle_for_path (old_path);
++ FileHandle *fh = get_file_handle_for_path (old_path);
+
+ if (fh)
+ {
+@@ -1561,9 +1598,7 @@
+
+ if (file)
+ {
+- FileHandle *fh;
+-
+- fh = get_file_handle_for_path (path);
++ FileHandle *fh = get_file_handle_for_path (path);
+
+ if (fh)
+ {
+@@ -1706,40 +1741,49 @@
+
+ if (file)
+ {
+- FileHandle *fh = GET_FILE_HANDLE (fi);
++ FileHandle *fh = get_file_handle_from_info (fi);
+
+- g_mutex_lock (fh->mutex);
++ if (fh)
++ {
++ g_mutex_lock (fh->mutex);
+
+- result = setup_output_stream (file, fh);
++ result = setup_output_stream (file, fh);
+
+- if (result == 0)
+- {
+- if (g_seekable_can_truncate (G_SEEKABLE (fh->stream)))
+- {
+- g_seekable_truncate (fh->stream, size, NULL, &error);
+- }
+- else if (size == 0)
++ if (result == 0)
+ {
+- g_output_stream_close (fh->stream, NULL, NULL);
+- g_object_unref (fh->stream);
+- fh->stream = NULL;
++ if (g_seekable_can_truncate (G_SEEKABLE (fh->stream)))
++ {
++ g_seekable_truncate (fh->stream, size, NULL, &error);
++ }
++ else if (size == 0)
++ {
++ g_output_stream_close (fh->stream, NULL, NULL);
++ g_object_unref (fh->stream);
++ fh->stream = NULL;
+
+- fh->stream = g_file_replace (file, 0, FALSE, 0, NULL, &error);
+- }
+- else
+- {
+- result = -ENOTSUP;
+- }
++ fh->stream = g_file_replace (file, 0, FALSE, 0, NULL, &error);
++ }
++ else
++ {
++ result = -ENOTSUP;
++ }
+
+- if (error)
+- {
+- result = -errno_from_error (error);
+- g_error_free (error);
++ if (error)
++ {
++ result = -errno_from_error (error);
++ g_error_free (error);
++ }
+ }
++
++ g_mutex_unlock (fh->mutex);
++ file_handle_unref (fh);
++ }
++ else
++ {
++ result = -EINVAL;
+ }
+
+ g_object_unref (file);
+- g_mutex_unlock (fh->mutex);
+ }
+ else
+ {
+@@ -1767,6 +1811,7 @@
+ GFileOutputStream *file_output_stream = NULL;
+ FileHandle *fh;
+
++ /* Get a file handle just to lock the path while we're working */
+ fh = get_file_handle_for_path (path);
+ if (fh)
+ g_mutex_lock (fh->mutex);
+@@ -2105,8 +2150,10 @@
+ daemon_gid = getgid ();
+
+ mount_list_mutex = g_mutex_new ();
+- global_fh_table = g_hash_table_new_full (g_str_hash, g_str_equal,
+- NULL, (GDestroyNotify) file_handle_free);
++ global_path_to_fh_map = g_hash_table_new_full (g_str_hash, g_str_equal,
++ NULL, (GDestroyNotify) file_handle_free);
++ global_active_fh_map = g_hash_table_new_full (g_direct_hash, g_direct_equal,
++ NULL, NULL);
+
+ dbus_error_init (&error);
+
More information about the pkg-gnome-commits
mailing list