VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   32 Branches   54 Tags
author: Vivek Goyal <vgoyal@redhat.com> 2021-04-06 10:07:06 -0400 committer: Miklos Szeredi <mszeredi@redhat.com> 2021-04-14 10:40:57 +0200 commit: 3466958beb31a8e9d3a1441a34228ed088b84f3e parent: 550a7d3bc0c4049ef8d36ff4d9ed7082ee8cb5ec
Commit Summary:
fuse: invalidate attrs when page writeback completes
Diffstat:
1 file changed, 9 insertions, 0 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 51187777c39b..df769f55f205 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -1767,8 +1767,17 @@ static void fuse_writepage_end(struct fuse_mount *fm, struct fuse_args *args,
 		container_of(args, typeof(*wpa), ia.ap.args);
 	struct inode *inode = wpa->inode;
 	struct fuse_inode *fi = get_fuse_inode(inode);
+	struct fuse_conn *fc = get_fuse_conn(inode);
 
 	mapping_set_error(inode->i_mapping, error);
+	/*
+	 * A writeback finished and this might have updated mtime/ctime on
+	 * server making local mtime/ctime stale.  Hence invalidate attrs.
+	 * Do this only if writeback_cache is not enabled.  If writeback_cache
+	 * is enabled, we trust local ctime/mtime.
+	 */
+	if (!fc->writeback_cache)
+		fuse_invalidate_attr(inode);
 	spin_lock(&fi->lock);
 	rb_erase(&wpa->writepages_entry, &fi->writepages);
 	while (wpa->next) {