Skip to content

snapshots/erofs: keep lowers stacked above a merged fsmeta - #13860

Merged
fuweid merged 1 commit into
containerd:mainfrom
dmcgowan:fix-erofs-mixed-merged
Jul 30, 2026
Merged

fuweid merged 1 commit into
containerd:mainfrom
dmcgowan:fix-erofs-mixed-merged

Conversation

@dmcgowan

Copy link
Copy Markdown
Member

mounts() moved first to the merged fsmeta mount's index whenever mountFsMeta matched, collapsing the overlay's lowerdir range to the fsmeta alone and dropping any plain lowers already appended above it.

When fsmerge was added, fsmeta was only ever written for the top parent of the chain being prepared, so the loop matched at i == 0, where first already equalled the fsmeta's index and the reassignment was a no-op. It only mattered once the fsmeta could sit below the top parent, i.e. a chain extending an already-merged sub-chain. The snapshotter no longer generates fsmeta itself, so today this only affects externally supplied fsmeta files.

first only marks the start of the lowerdir range, so it must stay at the first lower's index.

mounts() moved `first` to the merged fsmeta mount's index whenever
mountFsMeta matched, collapsing the overlay's lowerdir range to the
fsmeta alone and dropping any plain lowers already appended above it.

When fsmerge was added, fsmeta was only ever written for the top
parent of the chain being prepared, so the loop matched at i == 0,
where first already equalled the fsmeta's index and the reassignment
was a no-op. It only mattered once the fsmeta could sit below the top
parent, i.e. a chain extending an already-merged sub-chain. The
snapshotter no longer generates fsmeta itself, so today this only
affects externally supplied fsmeta files.

first only marks the start of the lowerdir range, so it must stay at
the first lower's index.

Signed-off-by: Derek McGowan <[email protected]>
Copilot AI review requested due to automatic review settings July 27, 2026 22:31
@github-project-automation github-project-automation Bot moved this to Needs Triage in Pull Request Review Jul 27, 2026
@dmcgowan dmcgowan added cherry-pick/2.3.x Change to be cherry picked to release/2.3 and removed size/M labels Jul 27, 2026
@dmcgowan dmcgowan moved this from Needs Triage to Needs Reviewers in Pull Request Review Jul 27, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes EROFS snapshotter overlay lowerdir assembly when a merged fsmeta exists on a non-top parent, ensuring the overlay’s lowerdir range continues to include any plain layers stacked above that merged fsmeta instead of collapsing to fsmeta alone.

Changes:

  • Stop reassigning first when mountFsMeta matches so the lowerdir range start remains at the first lower mount.
  • Add targeted tests covering merged fsmeta below the top parent and the “merged on top parent” single-lower behavior.

Reviewed changes

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

File Description
plugins/snapshots/erofs/erofs.go Keeps first as the start of the lowerdir range even when a merged fsmeta mount is used, preserving stacked plain lowers.
plugins/snapshots/erofs/erofs_linux_test.go Adds regression tests validating correct mount list and overlay lowerdir range for merged fsmeta scenarios.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dmcgowan dmcgowan added this to the 2.4 milestone Jul 27, 2026
@hsiangkao

Copy link
Copy Markdown
Member

Hi Derek @dmcgowan , I wonder what is the direct issue which drives this change? The original design here is to allow fsmeta in the midst layer (so that the bottom layers can be replaced by fsmeta), but if the top layers doesn't have fsmeta, they can use the overlayfs way.

@dmcgowan

dmcgowan commented Jul 29, 2026 •

Copy link
Copy Markdown
Member Author

@hsiangkao the issue is from upgrading or a change in configuration that means lower layers have merged but later images pulled don't have the merged. The new layers are completely stripped out. The merge layer can happen at any point, it should just stop adding layers lower than the merged layer, not strip out all the layers higher. I think the logic was just confused but it worked before since when merge is configured there was only one lower.

@hsiangkao

hsiangkao commented Jul 29, 2026 •

Copy link
Copy Markdown
Member

@hsiangkao the issue is from upgrading or a change in configuration that means lower layers have merged but later images pulled don't have the merged. The new layers are completely stripped out. The merge layer can happen at any point, it should just stop adding layers lower than the merged layer, not strip out all the layers higher. I think the logic was just confused but it worked before since when merge is configured there was only one lower.

Sorry my understanding was incorrect, and this patch is a correct fix.
Sorry about the bug, thanks!

@github-project-automation github-project-automation Bot moved this from Needs Reviewers to Review In Progress in Pull Request Review Jul 30, 2026
@fuweid
fuweid added this pull request to the merge queue Jul 30, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 30, 2026
@fuweid
fuweid added this pull request to the merge queue Jul 30, 2026
Merged via the queue into containerd:main with commit 9013f8c Jul 30, 2026
51 checks passed
@github-project-automation github-project-automation Bot moved this from Review In Progress to Done in Pull Request Review Jul 30, 2026
@hsiangkao

Copy link
Copy Markdown
Member

/cherry-pick release/2.3

@k8s-infra-cherrypick-robot

Copy link
Copy Markdown

@hsiangkao: #13860 failed to apply on top of branch "release/2.3":

Applying: snapshots/erofs: keep lowers stacked above a merged fsmeta
Using index info to reconstruct a base tree...
M	plugins/snapshots/erofs/erofs.go
M	plugins/snapshots/erofs/erofs_linux_test.go
Falling back to patching base and 3-way merge...
Auto-merging plugins/snapshots/erofs/erofs.go
Auto-merging plugins/snapshots/erofs/erofs_linux_test.go
CONFLICT (content): Merge conflict in plugins/snapshots/erofs/erofs_linux_test.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 snapshots/erofs: keep lowers stacked above a merged fsmeta

Details

In response to this:

/cherry-pick release/2.3

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cherry-pick/2.3.x Change to be cherry picked to release/2.3

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants