Page MenuHomeFreeBSD

fuse: Do not unconditionally overwrite local vnode size with remote
Needs ReviewPublic

Authored by emil_etsalapatis.com on Mon, Feb 2, 12:24 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Feb 3, 12:41 AM
Unknown Object (File)
Mon, Feb 2, 9:41 PM
Unknown Object (File)
Mon, Feb 2, 3:06 PM
Unknown Object (File)
Mon, Feb 2, 5:58 AM
Subscribers

Details

Reviewers
asomers
Summary

The code in fuse_internal_cache_attrs() assumes that the size reported
by a FUSE_GETATTR request is always canonical. That is not accurate -
it is possible the file has had its FN_SIZECHANGE set during the
getattr call due to a concurrent write. However, the code currently
still considers the server's response canonical and overwrite the size
of the file with the one reported by the server, most likely erasing
data due to file truncation. Adjust the code to consider whether the
file has its FN_SIZECHANGE flag set, and if so use the local cached
size instead.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 70334
Build 67217: arc lint + arc unit

Event Timeline

Interesting find. I'll review this next week, after I'm home from vacation.

Thank you! For context, this diff along with the elock issue we discussed on D55046 are the main blockers for getting virtiofs working (D46295 + D46296). This issue from this diff specifically causes constant truncations when using metadata caching from the virtiofs (and assume FUSE) server. This looks like corruption from a user's point of view. I actually think that it'd be better if we removed the warnings altogether because they trigger spuriously and so are not helpful as diagnostics.