[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240703010215.2013266-2-drosen@google.com>
Date: Tue, 2 Jul 2024 18:02:15 -0700
From: Daniel Rosenberg <drosen@...gle.com>
To: Miklos Szeredi <miklos@...redi.hu>, Amir Goldstein <amir73il@...il.com>
Cc: linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
kernel-team@...roid.com, Daniel Rosenberg <drosen@...gle.com>
Subject: [PATCH 1/1] fuse: Keep attributes consistent with Passthrough
If writeback cache is enabled, and we attempt to use fuse passthrough,
fuse will invalidate attributes on write, but will then ignore when the
server attempts to update those attributes. Since the kernel is the
arbiter of truth with writeback cache, passthrough holds the
responsibility to keep these values updated.
Signed-off-by: Daniel Rosenberg <drosen@...gle.com>
---
fs/fuse/passthrough.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/fs/fuse/passthrough.c b/fs/fuse/passthrough.c
index 9666d13884ce..6f63a1a38d7c 100644
--- a/fs/fuse/passthrough.c
+++ b/fs/fuse/passthrough.c
@@ -21,8 +21,19 @@ static void fuse_file_accessed(struct file *file)
static void fuse_file_modified(struct file *file)
{
struct inode *inode = file_inode(file);
-
- fuse_invalidate_attr_mask(inode, FUSE_STATX_MODSIZE);
+ struct fuse_conn *fc = get_fuse_conn(inode);
+ struct fuse_file *ff = file->private_data;
+ struct file *backing_file = fuse_file_passthrough(ff);
+ struct inode *backing_inode = file_inode(backing_file);
+
+ if (!fc->writeback_cache) {
+ fuse_invalidate_attr_mask(inode, FUSE_STATX_MODSIZE);
+ } else {
+ inode_set_mtime_to_ts(inode, inode_get_mtime(backing_inode));
+ inode_set_ctime_to_ts(inode, inode_get_ctime(backing_inode));
+ inode->i_blocks = backing_inode->i_blocks;
+ i_size_write(inode, i_size_read(backing_inode));
+ }
}
ssize_t fuse_passthrough_read_iter(struct kiocb *iocb, struct iov_iter *iter)
--
2.45.2.803.g4e1b14247a-goog
Powered by blists - more mailing lists