Skip to content

fix(client): fix the inconsistency of mtime returned by list and get_…#699

Merged
szbr9486 merged 1 commit intomainfrom
fuse-fix2
Mar 6, 2026
Merged

fix(client): fix the inconsistency of mtime returned by list and get_…#699
szbr9486 merged 1 commit intomainfrom
fuse-fix2

Conversation

@bigbigxu
Copy link
Contributor

@bigbigxu bigbigxu commented Mar 5, 2026

fix the inconsistency of mtime returned by list and get_status under cache-mode, which causes page cache invalidation.

Copilot AI review requested due to automatic review settings March 5, 2026 14:04
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 blocks mutable in get_cv_reader() so its returned FileStatus can be adjusted.
  • In cache-mode (when cache is considered valid), overwrite blocks.status.mtime with blocks.status.storage_policy.ufs_mtime before constructing the FsReader.

💡 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;
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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;
}

Copilot uses AI. Check for mistakes.
…status under cache-mode, which causes page cache invalidation.
@szbr9486 szbr9486 merged commit 1188666 into main Mar 6, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants