Repository navigation
snapshots/erofs: keep lowers stacked above a merged fsmeta - #13860
Conversation
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]>
There was a problem hiding this comment.
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
firstwhenmountFsMetamatches so the lowerdir range start remains at the first lower mount. - Add targeted tests covering merged
fsmetabelow 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.
|
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. |
|
@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. |
|
/cherry-pick release/2.3 |
|
@hsiangkao: #13860 failed to apply on top of branch "release/2.3": DetailsIn response to this:
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. |
mounts() moved
firstto 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.