mirror of
https://github.com/containers/skopeo.git
synced 2025-09-12 21:16:52 +00:00
fix(deps): update module github.com/containers/storage to v1.55.0
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This commit is contained in:
102
vendor/github.com/containers/storage/store.go
generated
vendored
102
vendor/github.com/containers/storage/store.go
generated
vendored
@@ -1088,8 +1088,6 @@ func (s *store) createGraphDriverLocked() (drivers.Driver, error) {
|
||||
RunRoot: s.runRoot,
|
||||
DriverPriority: s.graphDriverPriority,
|
||||
DriverOptions: s.graphOptions,
|
||||
UIDMaps: s.uidMap,
|
||||
GIDMaps: s.gidMap,
|
||||
}
|
||||
return drivers.New(s.graphDriverName, config)
|
||||
}
|
||||
@@ -1437,7 +1435,9 @@ func (s *store) canUseShifting(uidmap, gidmap []idtools.IDMap) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// putLayer requires the rlstore, rlstores, as well as s.containerStore (even if not an argument to this function) to be locked for write.
|
||||
// On entry:
|
||||
// - rlstore must be locked for writing
|
||||
// - rlstores MUST NOT be locked
|
||||
func (s *store) putLayer(rlstore rwLayerStore, rlstores []roLayerStore, id, parent string, names []string, mountLabel string, writeable bool, lOptions *LayerOptions, diff io.Reader, slo *stagedLayerOptions) (*Layer, int64, error) {
|
||||
var parentLayer *Layer
|
||||
var options LayerOptions
|
||||
@@ -1474,6 +1474,11 @@ func (s *store) putLayer(rlstore rwLayerStore, rlstores []roLayerStore, id, pare
|
||||
return nil, -1, ErrLayerUnknown
|
||||
}
|
||||
parentLayer = ilayer
|
||||
|
||||
if err := s.containerStore.startWriting(); err != nil {
|
||||
return nil, -1, err
|
||||
}
|
||||
defer s.containerStore.stopWriting()
|
||||
containers, err := s.containerStore.Containers()
|
||||
if err != nil {
|
||||
return nil, -1, err
|
||||
@@ -1490,6 +1495,13 @@ func (s *store) putLayer(rlstore rwLayerStore, rlstores []roLayerStore, id, pare
|
||||
gidMap = ilayer.GIDMap
|
||||
}
|
||||
} else {
|
||||
// FIXME? It’s unclear why we are holding containerStore locked here at all
|
||||
// (and because we are not modifying it, why it is a write lock, not a read lock).
|
||||
if err := s.containerStore.startWriting(); err != nil {
|
||||
return nil, -1, err
|
||||
}
|
||||
defer s.containerStore.stopWriting()
|
||||
|
||||
if !options.HostUIDMapping && len(options.UIDMap) == 0 {
|
||||
uidMap = s.uidMap
|
||||
}
|
||||
@@ -1497,23 +1509,17 @@ func (s *store) putLayer(rlstore rwLayerStore, rlstores []roLayerStore, id, pare
|
||||
gidMap = s.gidMap
|
||||
}
|
||||
}
|
||||
layerOptions := LayerOptions{
|
||||
OriginalDigest: options.OriginalDigest,
|
||||
OriginalSize: options.OriginalSize,
|
||||
UncompressedDigest: options.UncompressedDigest,
|
||||
Flags: options.Flags,
|
||||
}
|
||||
if s.canUseShifting(uidMap, gidMap) {
|
||||
layerOptions.IDMappingOptions = types.IDMappingOptions{HostUIDMapping: true, HostGIDMapping: true, UIDMap: nil, GIDMap: nil}
|
||||
options.IDMappingOptions = types.IDMappingOptions{HostUIDMapping: true, HostGIDMapping: true, UIDMap: nil, GIDMap: nil}
|
||||
} else {
|
||||
layerOptions.IDMappingOptions = types.IDMappingOptions{
|
||||
options.IDMappingOptions = types.IDMappingOptions{
|
||||
HostUIDMapping: options.HostUIDMapping,
|
||||
HostGIDMapping: options.HostGIDMapping,
|
||||
UIDMap: copyIDMap(uidMap),
|
||||
GIDMap: copyIDMap(gidMap),
|
||||
}
|
||||
}
|
||||
return rlstore.create(id, parentLayer, names, mountLabel, nil, &layerOptions, writeable, diff, slo)
|
||||
return rlstore.create(id, parentLayer, names, mountLabel, nil, &options, writeable, diff, slo)
|
||||
}
|
||||
|
||||
func (s *store) PutLayer(id, parent string, names []string, mountLabel string, writeable bool, lOptions *LayerOptions, diff io.Reader) (*Layer, int64, error) {
|
||||
@@ -1525,10 +1531,6 @@ func (s *store) PutLayer(id, parent string, names []string, mountLabel string, w
|
||||
return nil, -1, err
|
||||
}
|
||||
defer rlstore.stopWriting()
|
||||
if err := s.containerStore.startWriting(); err != nil {
|
||||
return nil, -1, err
|
||||
}
|
||||
defer s.containerStore.stopWriting()
|
||||
return s.putLayer(rlstore, rlstores, id, parent, names, mountLabel, writeable, lOptions, diff, nil)
|
||||
}
|
||||
|
||||
@@ -2844,7 +2846,7 @@ func (s *store) mount(id string, options drivers.MountOpts) (string, error) {
|
||||
exists := store.Exists(id)
|
||||
store.stopReading()
|
||||
if exists {
|
||||
return "", fmt.Errorf("mounting read/only store images is not allowed: %w", ErrLayerUnknown)
|
||||
return "", fmt.Errorf("mounting read/only store images is not allowed: %w", ErrStoreIsReadOnly)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2928,14 +2930,40 @@ func (s *store) Unmount(id string, force bool) (bool, error) {
|
||||
}
|
||||
|
||||
func (s *store) Changes(from, to string) ([]archive.Change, error) {
|
||||
if res, done, err := readAllLayerStores(s, func(store roLayerStore) ([]archive.Change, bool, error) {
|
||||
// NaiveDiff could cause mounts to happen without a lock, so be safe
|
||||
// and treat the .Diff operation as a Mount.
|
||||
// We need to make sure the home mount is present when the Mount is done, which happens by possibly reinitializing the graph driver
|
||||
// in startUsingGraphDriver().
|
||||
if err := s.startUsingGraphDriver(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer s.stopUsingGraphDriver()
|
||||
|
||||
rlstore, lstores, err := s.bothLayerStoreKindsLocked()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := rlstore.startWriting(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if rlstore.Exists(to) {
|
||||
res, err := rlstore.Changes(from, to)
|
||||
rlstore.stopWriting()
|
||||
return res, err
|
||||
}
|
||||
rlstore.stopWriting()
|
||||
|
||||
for _, s := range lstores {
|
||||
store := s
|
||||
if err := store.startReading(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if store.Exists(to) {
|
||||
res, err := store.Changes(from, to)
|
||||
return res, true, err
|
||||
store.stopReading()
|
||||
return res, err
|
||||
}
|
||||
return nil, false, nil
|
||||
}); done {
|
||||
return res, err
|
||||
store.stopReading()
|
||||
}
|
||||
return nil, ErrLayerUnknown
|
||||
}
|
||||
@@ -2966,12 +2994,30 @@ func (s *store) Diff(from, to string, options *DiffOptions) (io.ReadCloser, erro
|
||||
}
|
||||
defer s.stopUsingGraphDriver()
|
||||
|
||||
layerStores, err := s.allLayerStoresLocked()
|
||||
rlstore, lstores, err := s.bothLayerStoreKindsLocked()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for _, s := range layerStores {
|
||||
if err := rlstore.startWriting(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if rlstore.Exists(to) {
|
||||
rc, err := rlstore.Diff(from, to, options)
|
||||
if rc != nil && err == nil {
|
||||
wrapped := ioutils.NewReadCloserWrapper(rc, func() error {
|
||||
err := rc.Close()
|
||||
rlstore.stopWriting()
|
||||
return err
|
||||
})
|
||||
return wrapped, nil
|
||||
}
|
||||
rlstore.stopWriting()
|
||||
return rc, err
|
||||
}
|
||||
rlstore.stopWriting()
|
||||
|
||||
for _, s := range lstores {
|
||||
store := s
|
||||
if err := store.startReading(); err != nil {
|
||||
return nil, err
|
||||
@@ -3009,16 +3055,14 @@ func (s *store) ApplyStagedLayer(args ApplyStagedLayerOptions) (*Layer, error) {
|
||||
return layer, err
|
||||
}
|
||||
if err == nil {
|
||||
// This code path exists only for cmd/containers/storage.applyDiffUsingStagingDirectory; we have tests that
|
||||
// assume layer creation and applying a staged layer are separate steps. Production pull code always uses the
|
||||
// other path, where layer creation is atomic.
|
||||
return layer, rlstore.applyDiffFromStagingDirectory(args.ID, args.DiffOutput, args.DiffOptions)
|
||||
}
|
||||
|
||||
// if the layer doesn't exist yet, try to create it.
|
||||
|
||||
if err := s.containerStore.startWriting(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer s.containerStore.stopWriting()
|
||||
|
||||
slo := stagedLayerOptions{
|
||||
DiffOutput: args.DiffOutput,
|
||||
DiffOptions: args.DiffOptions,
|
||||
|
Reference in New Issue
Block a user