Skip to content

Commit ceb1809

Browse files
committed
storage: don't use stagedLayerExtract when mountLabel is set
Just be safe based on the review feedback from the PR. #378 Signed-off-by: Paul Holzinger <[email protected]>
1 parent f962645 commit ceb1809

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

storage/layers.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2524,9 +2524,6 @@ func (r *layerStore) stageWithUnlockedStore(sl *maybeStagedLayerExtraction, pare
25242524
cleanup, stageLayer, size, err := sl.staging.StartStagingDiffToApply(parent, drivers.ApplyDiffOpts{
25252525
Diff: payload,
25262526
Mappings: idtools.NewIDMappingsFromMaps(layerOptions.UIDMap, layerOptions.GIDMap),
2527-
// FIXME: What to do here? We have no lock and assigned label yet.
2528-
// Overlayfs should not need it anyway so this seems fine for now.
2529-
MountLabel: "",
25302527
})
25312528
sl.cleanupFuncs = append(sl.cleanupFuncs, cleanup)
25322529
sl.stagedLayer = stageLayer

storage/store.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1577,7 +1577,12 @@ func (s *store) PutLayer(id, parent string, names []string, mountLabel string, w
15771577
}
15781578
}()
15791579
// driver can do unlocked staging so do that without holding the layer lock
1580-
if m.staging != nil {
1580+
// Special case we only support it when no mount label is used. c/image doesn't set it for layers
1581+
// and the overlay driver doesn't use it for extract today so it would be safe even when set but
1582+
// that is not exactly obvious and if someone would implement the ApplyDiffStaging interface for
1583+
// another driver that may be no longer true. So for now simply fall back to the locked extract path
1584+
// to ensure we don't cause any weird issues here.
1585+
if m.staging != nil && mountLabel == "" {
15811586
// func so we have a scope for defer, we don't want to hold the lock for stageWithUnlockedStore()
15821587
layer, err := func() (*Layer, error) {
15831588
if err := rlstore.startReading(); err != nil {

0 commit comments

Comments
 (0)