ANDROID: 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@google.com>
Bug: 333497409
Test: atest android.scopedstorage.cts.general.ScopedStorageDeviceTest
Change-Id: I1ebc0d06f3d2b41a9cfb2af35f27989d25d96032
This commit is contained in:
Daniel Rosenberg
2024-07-01 14:56:24 -07:00
parent 3ae410445f
commit 65687870ee
+12 -1
View File
@@ -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);
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);
fuse_invalidate_attr_mask(inode, FUSE_STATX_MODSIZE);
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)