From 67933e2f73b87d89aa54faee3d7ff7bb236ab740 Mon Sep 17 00:00:00 2001 From: Paul Lawrence Date: Fri, 25 Feb 2022 23:35:30 +0000 Subject: [PATCH] ANDROID: fuse-bpf: Update attributes on file write Bug: 221093504 Test: atest android.hardware.cts.CameraTest#testJpegExif Signed-off-by: Paul Lawrence Change-Id: Ideb4f4d95e60594aed9000df4c21bacfaeac3a55 --- fs/fuse/backing.c | 4 ++++ fs/fuse/fuse_i.h | 1 + fs/fuse/passthrough.c | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/fuse/backing.c b/fs/fuse/backing.c index f7629c0f096c..c1e57a06c469 100644 --- a/fs/fuse/backing.c +++ b/fs/fuse/backing.c @@ -797,6 +797,10 @@ int fuse_file_write_iter_backing(struct fuse_args *fa, /* TODO This just plain ignores any change to fuse_write_in */ fwo->size = vfs_iter_write(ff->backing_file, from, &iocb->ki_pos, 0); + /* Must reflect change in size of backing file to upper file */ + if (fwo->size > 0) + fuse_copyattr(file, ff->backing_file); + if (fwo->size < 0) return fwo->size; return 0; diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index 50784f39cba8..675db33e9c0c 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -1299,6 +1299,7 @@ bool fuse_dax_check_alignment(struct fuse_conn *fc, unsigned int map_alignment); void fuse_dax_cancel_work(struct fuse_conn *fc); /* passthrough.c */ +void fuse_copyattr(struct file *dst_file, struct file *src_file); int fuse_passthrough_open(struct fuse_dev *fud, u32 lower_fd); int fuse_passthrough_setup(struct fuse_conn *fc, struct fuse_file *ff, struct fuse_open_out *openarg); diff --git a/fs/fuse/passthrough.c b/fs/fuse/passthrough.c index 83125de0bfdc..6031e72f3b5a 100644 --- a/fs/fuse/passthrough.c +++ b/fs/fuse/passthrough.c @@ -34,7 +34,7 @@ static void fuse_file_accessed(struct file *dst_file, struct file *src_file) touch_atime(&dst_file->f_path); } -static void fuse_copyattr(struct file *dst_file, struct file *src_file) +void fuse_copyattr(struct file *dst_file, struct file *src_file) { struct inode *dst = file_inode(dst_file); struct inode *src = file_inode(src_file);