提交 22401e7b 编写于 作者: M Miklos Szeredi

fuse: clean up fsync

Don't need to start I/O twice (once without i_mutex and one within).

Also make sure that even if the userspace filesystem doesn't support FSYNC
we do all the steps other than sending the message.
Signed-off-by: NMiklos Szeredi <mszeredi@suse.cz>
上级 93d2269d
...@@ -490,13 +490,6 @@ int fuse_fsync_common(struct file *file, loff_t start, loff_t end, ...@@ -490,13 +490,6 @@ int fuse_fsync_common(struct file *file, loff_t start, loff_t end,
if (is_bad_inode(inode)) if (is_bad_inode(inode))
return -EIO; return -EIO;
err = filemap_write_and_wait_range(inode->i_mapping, start, end);
if (err)
return err;
if ((!isdir && fc->no_fsync) || (isdir && fc->no_fsyncdir))
return 0;
mutex_lock(&inode->i_mutex); mutex_lock(&inode->i_mutex);
/* /*
...@@ -504,7 +497,7 @@ int fuse_fsync_common(struct file *file, loff_t start, loff_t end, ...@@ -504,7 +497,7 @@ int fuse_fsync_common(struct file *file, loff_t start, loff_t end,
* wait for all outstanding writes, before sending the FSYNC * wait for all outstanding writes, before sending the FSYNC
* request. * request.
*/ */
err = write_inode_now(inode, 0); err = filemap_write_and_wait_range(inode->i_mapping, start, end);
if (err) if (err)
goto out; goto out;
...@@ -515,6 +508,8 @@ int fuse_fsync_common(struct file *file, loff_t start, loff_t end, ...@@ -515,6 +508,8 @@ int fuse_fsync_common(struct file *file, loff_t start, loff_t end,
if (err) if (err)
goto out; goto out;
} }
if ((!isdir && fc->no_fsync) || (isdir && fc->no_fsyncdir))
goto out;
req = fuse_get_req_nopages(fc); req = fuse_get_req_nopages(fc);
if (IS_ERR(req)) { if (IS_ERR(req)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册