fuse: update inode size after extending passthrough write
authorAmir Goldstein <amir73il@gmail.com>
Mon, 14 Oct 2024 19:27:59 +0000 (21:27 +0200)
committerMiklos Szeredi <mszeredi@redhat.com>
Wed, 16 Oct 2024 11:18:21 +0000 (13:18 +0200)
commit20121d3f58f06e977ca43eb6efe1fb23b1d2f6d9
tree720ccad8feaf3beb30249a4b1225b6937b15de9c
parentf03b296e8b516dbd63f57fc9056c1b0da1b9a0ff
fuse: update inode size after extending passthrough write

yangyun reported that libfuse test test_copy_file_range() copies zero
bytes from a newly written file when fuse passthrough is enabled.

The reason is that extending passthrough write is not updating the fuse
inode size and when vfs_copy_file_range() observes a zero size inode,
it returns without calling the filesystem copy_file_range() method.

Fix this by adjusting the fuse inode size after an extending passthrough
write.

This does not provide cache coherency of fuse inode attributes and
backing inode attributes, but it should prevent situations where fuse
inode size is too small, causing read/copy to be wrongly shortened.

Reported-by: yangyun <yangyun50@huawei.com>
Closes: https://github.com/libfuse/libfuse/issues/1048
Fixes: 57e1176e6086 ("fuse: implement read/write passthrough")
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/fuse/passthrough.c