Skip to content

Commit 20121d3

Browse files
amir73ilMiklos Szeredi
authored andcommitted
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 <[email protected]> Closes: libfuse/libfuse#1048 Fixes: 57e1176 ("fuse: implement read/write passthrough") Signed-off-by: Amir Goldstein <[email protected]> Signed-off-by: Miklos Szeredi <[email protected]>
1 parent f03b296 commit 20121d3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/fuse/passthrough.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ static void fuse_passthrough_end_write(struct file *file, loff_t pos, ssize_t re
2222
{
2323
struct inode *inode = file_inode(file);
2424

25-
fuse_invalidate_attr_mask(inode, FUSE_STATX_MODSIZE);
25+
fuse_write_update_attr(inode, pos, ret);
2626
}
2727

2828
ssize_t fuse_passthrough_read_iter(struct kiocb *iocb, struct iov_iter *iter)

0 commit comments

Comments
 (0)