Skip to content

Commit

Permalink
fuse: Flush files on wb close
Browse files Browse the repository at this point in the history
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().

Signed-off-by: Maxim Patlasov <MPatlasov@parallels.com>
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
  • Loading branch information
Pavel Emelyanov authored and Miklos Szeredi committed Apr 2, 2014
1 parent b0aa760 commit e7cc133
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions fs/fuse/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,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_DIRTY, &get_fuse_inode(inode)->state))
fuse_flush_mtime(file, true);

Expand Down

0 comments on commit e7cc133

Please sign in to comment.