summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Petter Jansson <hpj@novell.com>2008-07-18 23:18:52 +0000
committerHans Petter <hansp@src.gnome.org>2008-07-18 23:18:52 +0000
commit0d9a31f17dbc1df7a7341442da38a8b101c20459 (patch)
treeae1f3b997207e33d46caf60286497af53fe60b30
parent195dd86683f525515069e6630a5f258f1bc39487 (diff)
downloadgvfs-0d9a31f17dbc1df7a7341442da38a8b101c20459.tar.gz
Hold the file handle lock while opening the stream. Second part of fix for
2008-07-18 Hans Petter Jansson <hpj@novell.com> * client/gvfsfusedaemon.c (vfs_open) (vfs_create): Hold the file handle lock while opening the stream. Second part of fix for #536614. svn path=/trunk/; revision=1822
-rw-r--r--ChangeLog6
-rw-r--r--client/gvfsfusedaemon.c9
2 files changed, 14 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index b72e7886..55bfb8c1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-07-18 Hans Petter Jansson <hpj@novell.com>
+
+ * client/gvfsfusedaemon.c (vfs_open)
+ (vfs_create): Hold the file handle lock while opening the stream.
+ Second part of fix for #536614.
+
2008-07-17 Hans Petter Jansson <hpj@novell.com>
* client/gvfsfusedaemon.c (reindex_file_handle_for_path): Steal the
diff --git a/client/gvfsfusedaemon.c b/client/gvfsfusedaemon.c
index bc70b53c..65720539 100644
--- a/client/gvfsfusedaemon.c
+++ b/client/gvfsfusedaemon.c
@@ -959,11 +959,15 @@ vfs_open (const gchar *path, struct fuse_file_info *fi)
/* 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 @@ vfs_create (const gchar *path, mode_t mode, struct fuse_file_info *fi)
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