Skip to content

feat(client): cache-mode get_status + single-flight mount refresh + a…#693

Merged
szbr9486 merged 1 commit intomainfrom
fs-mode-1
Mar 6, 2026
Merged

feat(client): cache-mode get_status + single-flight mount refresh + a…#693
szbr9486 merged 1 commit intomainfrom
fs-mode-1

Conversation

@bigbigxu
Copy link
Contributor

@bigbigxu bigbigxu commented Mar 5, 2026

…sync_cache fire-and-forget

  • unified_filesystem: get_status branches by no-mount / FS mode / cache mode; in cache mode calls cv.get_status then check_cache_validity, falls back to UFS when invalid or on error; CacheValidity gains Invalid(Option) to carry UFS status
  • unified_filesystem: add invalidate_cache, clear CV cache before open-for-write on mount path; async_cache becomes fire-and-forget (spawn load job in background, return immediately)
  • mount_cache: single-flight refresh via refresh_lock to avoid blocking all get_mount while holding write lock during RPC
  • master_handler: forbid delete of mount point root (error when path == mount.cv_path)
  • curvine_fuse: call invalidate_cache only when handle.writer.is_some() (invalidate cache only after flush/release when file was opened for write)

Copilot AI review requested due to automatic review settings March 5, 2026 02:41
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 enhances the cache-mode behavior in the unified filesystem by improving get_status for cached files, introducing single-flight mount refresh to avoid redundant concurrent RPC calls, and making the async_cache method fire-and-forget to avoid blocking the caller.

Changes:

  • get_status now branches by no-mount / FS mode / cache mode: in cache mode it first checks CV status and validates against UFS, falling back to UFS when cache is invalid; CacheValidity::Invalid now carries an Option<FileStatus> to reuse the UFS status fetched during validation, avoiding duplicate UFS calls.
  • async_cache is now a synchronous fire-and-forget method that spawns the job submission in a background task, and open_with_opts invalidates the CV cache before writing to UFS in cache mode. Additionally, FUSE flush/release only invalidate meta cache when the file was opened for writing.
  • MountCache::check_update uses a tokio::sync::Mutex for double-checked locking to ensure only one task performs the full mount refresh when the TTL expires. The server now forbids deletion of mount point root directories.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
curvine-client/src/unified/unified_filesystem.rs Cache-mode get_status with validity check/fallback; fire-and-forget async_cache; cache invalidation on write open; CacheValidity::Invalid now carries optional FileStatus
curvine-client/src/unified/mount_cache.rs Single-flight mount refresh via tokio::sync::Mutex with double-checked locking pattern
curvine-server/src/master/master_handler.rs Forbid deletion of mount point root directory
curvine-fuse/src/fs/curvine_file_system.rs Conditional meta cache invalidation on flush/release only when writer exists
curvine-tests/tests/write_cache_test.rs Updated test to match new synchronous async_cache signature

💡 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.

…sync_cache fire-and-forget

- unified_filesystem: get_status branches by no-mount / FS mode / cache mode; in cache mode calls cv.get_status then check_cache_validity, falls back to UFS when invalid or on error; CacheValidity gains Invalid(Option<FileStatus>) to carry UFS status
- unified_filesystem: add invalidate_cache, clear CV cache before open-for-write on mount path; async_cache becomes fire-and-forget (spawn load job in background, return immediately)
- mount_cache: single-flight refresh via refresh_lock to avoid blocking all get_mount while holding write lock during RPC
- master_handler: forbid delete of mount point root (error when path == mount.cv_path)
- curvine_fuse: call invalidate_cache only when handle.writer.is_some() (invalidate cache only after flush/release when file was opened for write)
@szbr9486 szbr9486 merged commit f2a6099 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