提交 f1885e3a 编写于 作者: M Miklos Szeredi 提交者: Caspar Zhang

fuse: always flush dirty data on close(2)

to #30030885

commit 614c026e8a46636198da93ec30719f93975bb26a upstream

We want cached data to synced with the userspace filesystem on close(), for
example to allow getting correct st_blocks value.  Do this regardless of
whether the userspace filesystem implements a FLUSH method or not.
Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
Signed-off-by: NEryu Guan <eguan@linux.alibaba.com>
Reviewed-by: NLiu Bo <bo.liu@linux.alibaba.com>
上级 e52fca03
...@@ -410,10 +410,6 @@ static int fuse_flush(struct file *file, fl_owner_t id) ...@@ -410,10 +410,6 @@ static int fuse_flush(struct file *file, fl_owner_t id)
if (is_bad_inode(inode)) if (is_bad_inode(inode))
return -EIO; return -EIO;
err = 0;
if (fc->no_flush)
goto inval_attr_out;
err = write_inode_now(inode, 1); err = write_inode_now(inode, 1);
if (err) if (err)
return err; return err;
...@@ -426,6 +422,10 @@ static int fuse_flush(struct file *file, fl_owner_t id) ...@@ -426,6 +422,10 @@ static int fuse_flush(struct file *file, fl_owner_t id)
if (err) if (err)
return err; return err;
err = 0;
if (fc->no_flush)
goto inval_attr_out;
req = fuse_get_req_nofail_nopages(fc, file); req = fuse_get_req_nofail_nopages(fc, file);
memset(&inarg, 0, sizeof(inarg)); memset(&inarg, 0, sizeof(inarg));
inarg.fh = ff->fh; inarg.fh = ff->fh;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册