Skip to content

Fix: RAFS v5 chunkdict bootstrap metadata#1952

Open
shu-pei wants to merge 2 commits into
dragonflyoss:masterfrom
shu-pei:fix-chunkdict-v5-metadata
Open

Fix: RAFS v5 chunkdict bootstrap metadata#1952
shu-pei wants to merge 2 commits into
dragonflyoss:masterfrom
shu-pei:fix-chunkdict-v5-metadata

Conversation

@shu-pei

@shu-pei shu-pei commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Overview

When generating a RAFS v5 chunkdict bootstrap with chunkdict, several fields in the generated chunk metadata are incorrect.

1.

The original code calculates the chunkdict file offset with the compressed chunk size:

for (index, chunk_info) in chunkdict_chunks.iter().enumerate() {
    let chunk_size: u32 = chunk_info.chunk_compressed_size;
    let file_offset = index as u64 * chunk_size as u64;
    ...
    chunk.set_file_offset(file_offset);
}

file_offset is the logical offset inside the file, so it should be calculated from the uncompressed data size.

2.

When generating chunkdict chunk metadata, the original code does not set the COMPRESSED flag.

3.

The generated chunkdict entry is a regular file in the RAFS v5 bootstrap, but its inode digest is not set.
This breaks RAFS v5 inode digest validation. In rafs/src/metadata/layout/v5.rs, rafsv5_validate_inode()

4.

The original filecache logic forces chunkdict-generated blobs to load blob.meta:

let meta = if blob_info.meta_ci_is_valid()
    || blob_info.has_feature(BlobFeatures::IS_CHUNKDICT_GENERATED)
{
    ...
}

However, RAFS v5 blob table entries do not have valid meta_ci_* information for chunkdict blobs.

Related Issues

Please link to the relevant issue. For example: Fix #123 or Related #456.

Change Details

Please describe your changes in detail:

Test Results

If you have any relevant screenshots or videos that can help illustrate your changes, please add them here.

Change Type

Please select the type of change your pull request relates to:

  • Bug Fix
  • Feature Addition
  • Documentation Update
  • Code Refactoring
  • Performance Improvement
  • Other (please describe)

Self-Checklist

Before submitting a pull request, please ensure you have completed the following:

  • I have run a code style check and addressed any warnings/errors.
  • I have added appropriate comments to my code (if applicable).
  • I have updated the documentation (if applicable).
  • I have written appropriate unit tests.

@shu-pei shu-pei requested a review from a team as a code owner June 3, 2026 15:31
@shu-pei shu-pei requested review from Zephyrcf, adam3q and power-more and removed request for a team June 3, 2026 15:31
shu-pei added 2 commits June 3, 2026 15:34
Signed-off-by: shu-pei <linshupei2003@gmail.com>
Signed-off-by: shu-pei <linshupei2003@gmail.com>
@shu-pei shu-pei force-pushed the fix-chunkdict-v5-metadata branch from 1a39d45 to 046d264 Compare June 3, 2026 15:34
@shu-pei shu-pei changed the title builder: Fix RAFS v5 chunkdict bootstrap metadata Fix: RAFS v5 chunkdict bootstrap metadata Jun 3, 2026
@imeoer imeoer self-requested a review June 8, 2026 03:33
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.

1 participant