[Devel] [PATCH 08/14] fuse: Flush files on wb close
Maxim V. Patlasov
MPatlasov at parallels.com
Mon Apr 1 03:41:56 PDT 2013
Any write request requires a file handle to report to the userspace. Thus
when we close a file (and free the fuse_file with this info) we have to
flush all the outstanding dirty pages.
filemap_write_and_wait() is enough because every page under fuse writeback
is accounted in ff->count. This delays actual close until all fuse wb is
completed.
In case of "write cache" turned off, the flush is ensured by fuse_vma_close().
Original patch by: Pavel Emelyanov <xemul at openvz.org>
Signed-off-by: Maxim Patlasov <MPatlasov at parallels.com>
---
fs/fuse/file.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 6821e95..5509c0b 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -288,6 +288,12 @@ static int fuse_open(struct inode *inode, struct file *file)
static int fuse_release(struct inode *inode, struct file *file)
{
+ struct fuse_conn *fc = get_fuse_conn(inode);
+
+ /* see fuse_vma_close() for !writeback_cache case */
+ if (fc->writeback_cache)
+ filemap_write_and_wait(file->f_mapping);
+
if (test_bit(FUSE_I_MTIME_UPDATED,
&get_fuse_inode(inode)->state))
fuse_flush_mtime(file, true);
More information about the Devel
mailing list