[gvfs] fuse: Close stream on release rather than flush
- From: Ross Lagerwall <rossl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs] fuse: Close stream on release rather than flush
- Date: Sun, 26 Oct 2014 15:59:48 +0000 (UTC)
commit 1ff4d6c13358ca3efbece1cf81298b44fdc8e855
Author: Ross Lagerwall <rosslagerwall gmail com>
Date: Sat Jul 26 11:38:55 2014 +0100
fuse: Close stream on release rather than flush
Before, if an application created, dup()ed the fd and then closed it,
the stream would be closed. When attempting to write to the original
fd, reopening the stream would fail since it is an error to open an
existing file without either truncating it or appending to it.
Close the stream on release() rather than flush() to fix this since
release() is called only once per open/create rather than for each
close. Since g_output_stream_flush() is called after every write,
flush() and fsync() are unnecessary.
https://bugzilla.gnome.org/show_bug.cgi?id=632296
client/gvfsfusedaemon.c | 48 +++-------------------------------------------
1 files changed, 4 insertions(+), 44 deletions(-)
---
diff --git a/client/gvfsfusedaemon.c b/client/gvfsfusedaemon.c
index 92ddf0f..de37c3b 100644
--- a/client/gvfsfusedaemon.c
+++ b/client/gvfsfusedaemon.c
@@ -1238,6 +1238,10 @@ vfs_release (const gchar *path, struct fuse_file_info *fi)
if (fh)
{
+ g_mutex_lock (&fh->mutex);
+ file_handle_close_stream (fh);
+ g_mutex_unlock (&fh->mutex);
+
/* get_file_handle_from_info () adds a "working ref", so unref twice. */
file_handle_unref (fh);
file_handle_unref (fh);
@@ -1530,48 +1534,6 @@ vfs_write (const gchar *path, const gchar *buf, size_t len, off_t offset,
}
static gint
-vfs_flush (const gchar *path, struct fuse_file_info *fi)
-{
- FileHandle *fh = get_file_handle_from_info (fi);
-
- debug_print ("vfs_flush: %s\n", path);
-
- if (fh)
- {
- g_mutex_lock (&fh->mutex);
- file_handle_close_stream (fh);
- g_mutex_unlock (&fh->mutex);
-
- /* get_file_handle_from_info () adds a "working ref", so release that. */
- file_handle_unref (fh);
- }
-
- /* TODO: Error handling. */
- return 0;
-}
-
-static gint
-vfs_fsync (const gchar *path, gint sync_data_only, struct fuse_file_info *fi)
-{
- FileHandle *fh = get_file_handle_from_info (fi);
-
- debug_print ("vfs_flush: %s\n", path);
-
- if (fh)
- {
- g_mutex_lock (&fh->mutex);
- file_handle_close_stream (fh);
- g_mutex_unlock (&fh->mutex);
-
- /* get_file_handle_from_info () adds a "working ref", so release that. */
- file_handle_unref (fh);
- }
-
- /* TODO: Error handling. */
- return 0;
-}
-
-static gint
vfs_opendir (const gchar *path, struct fuse_file_info *fi)
{
GFile *file;
@@ -2538,8 +2500,6 @@ static struct fuse_operations vfs_oper =
.open = vfs_open,
.create = vfs_create,
.release = vfs_release,
- .flush = vfs_flush,
- .fsync = vfs_fsync,
.read = vfs_read,
.write = vfs_write,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]