mirror of
https://github.com/containers/skopeo.git
synced 2025-09-12 13:08:02 +00:00
Update c/image after https://github.com/containers/image/pull/2408
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
36
vendor/github.com/containers/storage/store.go
generated
vendored
36
vendor/github.com/containers/storage/store.go
generated
vendored
@@ -2820,22 +2820,42 @@ func (s *store) mount(id string, options drivers.MountOpts) (string, error) {
|
||||
}
|
||||
defer s.stopUsingGraphDriver()
|
||||
|
||||
rlstore, err := s.getLayerStoreLocked()
|
||||
rlstore, lstores, err := s.bothLayerStoreKindsLocked()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if err := rlstore.startWriting(); err != nil {
|
||||
return "", err
|
||||
}
|
||||
defer rlstore.stopWriting()
|
||||
|
||||
if options.UidMaps != nil || options.GidMaps != nil {
|
||||
options.DisableShifting = !s.canUseShifting(options.UidMaps, options.GidMaps)
|
||||
}
|
||||
|
||||
if rlstore.Exists(id) {
|
||||
return rlstore.Mount(id, options)
|
||||
// function used to have a scope for rlstore.StopWriting()
|
||||
tryMount := func() (string, error) {
|
||||
if err := rlstore.startWriting(); err != nil {
|
||||
return "", err
|
||||
}
|
||||
defer rlstore.stopWriting()
|
||||
if rlstore.Exists(id) {
|
||||
return rlstore.Mount(id, options)
|
||||
}
|
||||
return "", nil
|
||||
}
|
||||
mountPoint, err := tryMount()
|
||||
if mountPoint != "" || err != nil {
|
||||
return mountPoint, err
|
||||
}
|
||||
|
||||
// check if the layer is in a read-only store, and return a better error message
|
||||
for _, store := range lstores {
|
||||
if err := store.startReading(); err != nil {
|
||||
return "", err
|
||||
}
|
||||
exists := store.Exists(id)
|
||||
store.stopReading()
|
||||
if exists {
|
||||
return "", fmt.Errorf("mounting read/only store images is not allowed: %w", ErrLayerUnknown)
|
||||
}
|
||||
}
|
||||
|
||||
return "", ErrLayerUnknown
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user