Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to eliminate mtime inconsistencies in cache-mode by aligning the mtime exposed by cached reads with the underlying UFS mtime, preventing downstream page-cache invalidation caused by mismatched timestamps.
Changes:
- Make
blocksmutable inget_cv_reader()so its returnedFileStatuscan be adjusted. - In cache-mode (when cache is considered valid), overwrite
blocks.status.mtimewithblocks.status.storage_policy.ufs_mtimebefore constructing theFsReader.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| .await? | ||
| { | ||
| CacheValidity::Valid => { | ||
| blocks.status.mtime = blocks.status.storage_policy.ufs_mtime; |
There was a problem hiding this comment.
In cache-mode, check_cache_validity() returns Valid immediately when mount.info.read_verify_ufs is false, without ensuring storage_policy.ufs_mtime is populated. Since StoragePolicy::ufs_mtime defaults to 0, this assignment can cause the reader’s status().mtime to become 0 for cached entries that don't have ufs_mtime set, which is a behavior change and can break mtime-based cache/page-cache logic. Consider guarding the assignment (only overwrite when ufs_mtime > 0), or obtaining the UFS mtime (e.g., via mount.ufs.get_status) when ufs_mtime is missing so the reader mtime stays consistent with get_status/list_status.
| blocks.status.mtime = blocks.status.storage_policy.ufs_mtime; | |
| if blocks.status.storage_policy.ufs_mtime > 0 { | |
| blocks.status.mtime = blocks.status.storage_policy.ufs_mtime; | |
| } |
…status under cache-mode, which causes page cache invalidation.
fix the inconsistency of mtime returned by list and get_status under cache-mode, which causes page cache invalidation.