lkml.org 
[lkml]   [2013]   [Jun]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Subject[PATCH 13/16] fuse: fuse_flush() should wait on writeback
    From
    Date
    The aim of .flush fop is to hint file-system that flushing its state or caches
    or any other important data to reliable storage would be desirable now.
    fuse_flush() passes this hint by sending FUSE_FLUSH request to userspace.
    However, dirty pages and pages under writeback may be not visible to userspace
    yet if we won't ensure it explicitly.

    Signed-off-by: Maxim Patlasov <MPatlasov@parallels.com>
    ---
    fs/fuse/file.c | 9 +++++++++
    1 files changed, 9 insertions(+), 0 deletions(-)

    diff --git a/fs/fuse/file.c b/fs/fuse/file.c
    index f48f796..86ef60f 100644
    --- a/fs/fuse/file.c
    +++ b/fs/fuse/file.c
    @@ -19,6 +19,7 @@
    #include <linux/falloc.h>

    static const struct file_operations fuse_direct_io_file_operations;
    +static void fuse_sync_writes(struct inode *inode);

    static int fuse_send_open(struct fuse_conn *fc, u64 nodeid, struct file *file,
    int opcode, struct fuse_open_out *outargp)
    @@ -400,6 +401,14 @@ static int fuse_flush(struct file *file, fl_owner_t id)
    if (fc->no_flush)
    return 0;

    + err = filemap_write_and_wait(file->f_mapping);
    + if (err)
    + return err;
    +
    + mutex_lock(&inode->i_mutex);
    + fuse_sync_writes(inode);
    + mutex_unlock(&inode->i_mutex);
    +
    req = fuse_get_req_nofail_nopages(fc, file);
    memset(&inarg, 0, sizeof(inarg));
    inarg.fh = ff->fh;


    \
     
     \ /
      Last update: 2013-06-29 20:21    [W:2.536 / U:0.152 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site