fix: report fscache blob cull completion status - #1993
Open
Park-Jiyeonn wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves FSCACHE blob reclamation (“cull”) reporting and scheduling by moving cull execution into a dedicated worker, tracking whether reclamation is done vs pending, and exposing that status through a new API v2 endpoint so callers can retry when needed.
Changes:
- Add a
BlobCullResult(Done/Pending) result type and plumb it through the daemon trait and nydusd API glue. - Implement a dedicated FSCACHE cull worker with queueing, close-event tracking, and synchronous “attempt status” reporting.
- Extend HTTP API v2 with
/api/v2/blobs/culland aPendingresponse payload for retryable results.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/bin/nydusd/api_server_glue.rs | Wire new CullBlobFile API request into nydusd and map Done/Pending to response payloads. |
| service/src/singleton.rs | Implement NydusDaemon::cull_blob() by delegating to FSCACHE handler status API. |
| service/src/fs_cache.rs | Add cull worker/state machine, track close/commit settle windows, and provide cull_cache_status() returning Done/Pending. |
| service/src/daemon.rs | Introduce BlobCullResult and a new cull_blob() daemon trait method. |
| service/src/blob_cache.rs | Make removal idempotent for missing entries and add contains_blob_id() used by cull logic. |
| api/src/http.rs | Add CullBlobFile request, Pending payload, and HTTP error variant for cull. |
| api/src/http_handler.rs | Register new v2 route for /api/v2/blobs/cull. |
| api/src/http_endpoint_v2.rs | Implement the v2 cull endpoint and map Pending to a structured HTTP 200 response. |
Comment on lines
+673
to
+684
| let mut volume_hash_key: Vec<u8> = | ||
| Vec::with_capacity(Self::round_up_u32(volume_key.len() + 2)); | ||
| volume_hash_key.push(volume_key.len() as u8); | ||
| volume_hash_key.append(&mut volume_key.as_bytes().to_vec()); | ||
| volume_hash_key.resize(volume_hash_key.capacity(), 0); | ||
| let volume_hash = Self::fscache_hash(0, volume_hash_key.as_slice()); | ||
|
|
||
| // Calculate cookie hash. | ||
| let mut cookie_hash_key: Vec<u8> = Vec::with_capacity(Self::round_up_u32(cookie_key.len())); | ||
| cookie_hash_key.append(&mut cookie_key.as_bytes().to_vec()); | ||
| cookie_hash_key.resize(cookie_hash_key.capacity(), 0); | ||
| let dir_hash = Self::fscache_hash(volume_hash, cookie_hash_key.as_slice()); |
Comment on lines
+1264
to
+1268
| let guard = fsblob.read().unwrap(); | ||
| match guard.get_blob_cache() { | ||
| Some(blob) => { | ||
| if let Ok(cache_cfg) = factory_config.get_cache_config() { | ||
| if cache_cfg.prefetch.enable { |
Comment on lines
216
to
218
| match self.id_to_config_map.get(&scoped_blob_prefix) { | ||
| None => return Err(enoent!("blob_cache: cache entry not found")), | ||
| None => return Ok(()), | ||
| Some(BlobConfig::MetaBlob(o)) => { |
6 tasks
Run cachefiles cull requests on a dedicated worker and expose whether reclamation finished or needs another attempt. Keep configured and open blobs out of cull, and track CLOSE events by fscache volume until cachefiles commits the cookie. A missing cookie after CLOSE is therefore reported as pending instead of done. Wake asynchronous culls when references close, while leaving retry ownership with synchronous callers. Treat already-removed cache entries as idempotent and keep the cull worker's filesystem state isolated from the daemon. Add API and fscache tests for done and pending responses, cull ordering, close and cachefiles commit handling, and retry ownership. Signed-off-by: Park.Jiyeon <jiyeonnn2@icloud.com>
Park-Jiyeonn
force-pushed
the
fix/fscache-cull
branch
from
July 24, 2026 10:33
5c9db10 to
a152f97
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Run cachefiles cull requests on a dedicated worker and expose whether reclamation finished or needs another attempt.
Keep configured and open blobs out of cull, and track CLOSE events by fscache volume until cachefiles commits the cookie. A missing cookie after CLOSE is therefore reported as pending instead of done.
Wake asynchronous culls when references close, while leaving retry ownership with synchronous callers. Treat already-removed cache entries as idempotent and keep the cull worker's filesystem state isolated from the daemon.
Add API and fscache tests for done and pending responses, cull ordering, close and cachefiles commit handling, and retry ownership.
Related: Nydus-Snapshotter: fix: retry fscache blob cull until cachefiles completes#787
Change Type
Please select the type of change your pull request relates to: