diff --git a/fs/fuse/file.c b/fs/fuse/file.c index e7bfad5446288f6b8f774a0488e50d8be3a0abaa..6f99be0228452b7bb3544c6cd47f1268e62e24e1 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -410,8 +410,9 @@ static int fuse_flush(struct file *file, fl_owner_t id) if (is_bad_inode(inode)) return -EIO; + err = 0; if (fc->no_flush) - return 0; + goto inval_attr_out; err = write_inode_now(inode, 1); if (err) @@ -442,6 +443,14 @@ static int fuse_flush(struct file *file, fl_owner_t id) fc->no_flush = 1; err = 0; } + +inval_attr_out: + /* + * In memory i_blocks is not maintained by fuse, if writeback cache is + * enabled, i_blocks from cached attr may not be accurate. + */ + if (!err && fc->writeback_cache) + fuse_invalidate_attr(inode); return err; }