ANDROID: fuse: Update file size in fuse_passthrough_splice_write

This bug was caused by the file being written with splices through fuse,
then read a short while later. This would succeed if the inode got
evicted, but not otherwise. The reason is that the inode size was not
being updated, so it would report a size of 0 through certain routes.

Without this fix, splice writes will work but will leave the inode in an
inconsistent state. The below test will fail most of the time (9 times
out of 11 in my testing.)

With this fix the test passes consistently (11/11 times)

Bug: 355866306
Test: atest CtsScopedStorageDeviceOnlyTest:android.scopedstorage.cts.device.StorageOtherFilesTest#other_accessLocationMetadata
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: Ic9c7ccd51f8d3a1fe35964a336c780a94c604180
This commit is contained in:
Paul Lawrence 2024-08-28 12:39:55 -07:00 committed by Treehugger Robot
parent 09d40ffd7d
commit 3569b05351

View File

@ -209,6 +209,8 @@ ssize_t fuse_passthrough_splice_write(struct pipe_inode_info *pipe,
file_end_write(backing_file); file_end_write(backing_file);
fuse_invalidate_attr_mask(inode, FUSE_STATX_MODSIZE); fuse_invalidate_attr_mask(inode, FUSE_STATX_MODSIZE);
revert_creds(old_cred); revert_creds(old_cred);
if (ret > 0)
fuse_copyattr(out, backing_file);
inode_unlock(inode); inode_unlock(inode);
return ret; return ret;