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.
Details
Details
- Reviewers
asomers
Diff Detail
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
Comment Actions
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.