Index: client/gvfsfusedaemon.c
===================================================================
--- client/gvfsfusedaemon.c	(revision 1819)
+++ client/gvfsfusedaemon.c	(working copy)
@@ -959,11 +959,15 @@ vfs_open (const gchar *path, struct fuse
 
               /* 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 mo
 
               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
