Skip to content

Commit 614c026

Browse files
author
Miklos Szeredi
committed
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 <[email protected]>
1 parent cf576c5 commit 614c026

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

fs/fuse/file.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -445,10 +445,6 @@ static int fuse_flush(struct file *file, fl_owner_t id)
445445
if (is_bad_inode(inode))
446446
return -EIO;
447447

448-
err = 0;
449-
if (fc->no_flush)
450-
goto inval_attr_out;
451-
452448
err = write_inode_now(inode, 1);
453449
if (err)
454450
return err;
@@ -461,6 +457,10 @@ static int fuse_flush(struct file *file, fl_owner_t id)
461457
if (err)
462458
return err;
463459

460+
err = 0;
461+
if (fc->no_flush)
462+
goto inval_attr_out;
463+
464464
memset(&inarg, 0, sizeof(inarg));
465465
inarg.fh = ff->fh;
466466
inarg.lock_owner = fuse_lock_owner_id(fc, id);

0 commit comments

Comments
 (0)