summaryrefslogtreecommitdiffstats
path: root/fs/fuse
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@redhat.com>2020-05-19 14:50:37 +0200
committerMiklos Szeredi <mszeredi@redhat.com>2020-05-19 14:50:37 +0200
commit614c026e8a46636198da93ec30719f93975bb26a (patch)
tree08b49a20094cb7c3784fb850e35602c2f1cfe986 /fs/fuse
parentcf576c58b3a283333fc6e9a7c1c8e5342fa59b97 (diff)
downloadlinux-stable-614c026e8a46636198da93ec30719f93975bb26a.tar.gz
linux-stable-614c026e8a46636198da93ec30719f93975bb26a.tar.bz2
linux-stable-614c026e8a46636198da93ec30719f93975bb26a.zip
fuse: always flush dirty data on close(2)
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: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/fuse')
-rw-r--r--fs/fuse/file.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 262c5e20f324..4aa750d08d62 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -445,10 +445,6 @@ static int fuse_flush(struct file *file, fl_owner_t id)
if (is_bad_inode(inode))
return -EIO;
- err = 0;
- if (fc->no_flush)
- goto inval_attr_out;
-
err = write_inode_now(inode, 1);
if (err)
return err;
@@ -461,6 +457,10 @@ static int fuse_flush(struct file *file, fl_owner_t id)
if (err)
return err;
+ err = 0;
+ if (fc->no_flush)
+ goto inval_attr_out;
+
memset(&inarg, 0, sizeof(inarg));
inarg.fh = ff->fh;
inarg.lock_owner = fuse_lock_owner_id(fc, id);