Skip to content

Commit 225d9b1

Browse files
committed
Fix LCOW layer ordering
Due to an error in the OCI specf for layerFolders, the runhcs shim was passing the layers for LCOW in reverse order. This fixes the ordering by simply removing the code which reversed the layers for LCOW. Signed-off-by: Kevin Parsons <[email protected]>
1 parent 0922c69 commit 225d9b1

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

runtime/v2/runhcs/service.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -366,11 +366,11 @@ func writeMountsToConfig(bundle string, mounts []*containerd_types.Mount) error
366366
return errors.Errorf("unsupported mount type '%s'", m.Type)
367367
}
368368

369-
// parentLayerPaths are passed in layerN, layerN-1, ..., layer 0
369+
// parentLayerPaths are passed in:
370+
// layerN, layerN-1, ..., layer0
370371
//
371372
// The OCI spec expects:
372-
// windows-layer order is layerN, layerN-1, ..., layer0, scratch
373-
// lcow-layer order is layer0, layer1, ..., layerN, scratch
373+
// layerN, layerN-1, ..., layer0, scratch
374374
var parentLayerPaths []string
375375
for _, option := range mounts[0].Options {
376376
if strings.HasPrefix(option, mount.ParentLayerPathsFlag) {
@@ -382,12 +382,6 @@ func writeMountsToConfig(bundle string, mounts []*containerd_types.Mount) error
382382
}
383383

384384
if m.Type == "lcow-layer" {
385-
// Reverse the lcow-layer parents
386-
for i := len(parentLayerPaths)/2 - 1; i >= 0; i-- {
387-
opp := len(parentLayerPaths) - 1 - i
388-
parentLayerPaths[i], parentLayerPaths[opp] = parentLayerPaths[opp], parentLayerPaths[i]
389-
}
390-
391385
// If we are creating LCOW make sure that spec.Windows is filled out before
392386
// appending layer folders.
393387
if spec.Windows == nil {

0 commit comments

Comments
 (0)