Merge pull request #6964 from containers/dependabot/go_modules/github.com/containers/storage-1.21.1

Bump github.com/containers/storage from 1.21.0 to 1.21.1
This commit is contained in:
OpenShift Merge Robot
2020-07-14 22:46:57 +02:00
committed by GitHub
7 changed files with 44 additions and 22 deletions

2
go.mod
View File

@ -15,7 +15,7 @@ require (
github.com/containers/conmon v2.0.18+incompatible github.com/containers/conmon v2.0.18+incompatible
github.com/containers/image/v5 v5.5.1 github.com/containers/image/v5 v5.5.1
github.com/containers/psgo v1.5.1 github.com/containers/psgo v1.5.1
github.com/containers/storage v1.21.0 github.com/containers/storage v1.21.1
github.com/coreos/go-systemd/v22 v22.1.0 github.com/coreos/go-systemd/v22 v22.1.0
github.com/cri-o/ocicni v0.2.0 github.com/cri-o/ocicni v0.2.0
github.com/cyphar/filepath-securejoin v0.2.2 github.com/cyphar/filepath-securejoin v0.2.2

4
go.sum
View File

@ -86,8 +86,8 @@ github.com/containers/psgo v1.5.1 h1:MQNb7FLbXqBdqz6u4lI2QWizVz4RSTzs1+Nk9XT1iVA
github.com/containers/psgo v1.5.1/go.mod h1:2ubh0SsreMZjSXW1Hif58JrEcFudQyIy9EzPUWfawVU= github.com/containers/psgo v1.5.1/go.mod h1:2ubh0SsreMZjSXW1Hif58JrEcFudQyIy9EzPUWfawVU=
github.com/containers/storage v1.20.2 h1:tw/uKRPDnmVrluIzer3dawTFG/bTJLP8IEUyHFhltYk= github.com/containers/storage v1.20.2 h1:tw/uKRPDnmVrluIzer3dawTFG/bTJLP8IEUyHFhltYk=
github.com/containers/storage v1.20.2/go.mod h1:oOB9Ie8OVPojvoaKWEGSEtHbXUAs+tSyr7RO7ZGteMc= github.com/containers/storage v1.20.2/go.mod h1:oOB9Ie8OVPojvoaKWEGSEtHbXUAs+tSyr7RO7ZGteMc=
github.com/containers/storage v1.21.0 h1:9VpsAmqwA9P+xQZc2sWZ3sj5NQojvg47P6orW34nYFU= github.com/containers/storage v1.21.1 h1:FGA2c7+0Bn8ndrlrj+HHmKeVjFD3yVhvYa0gijsrg1M=
github.com/containers/storage v1.21.0/go.mod h1:I1EIAA7B4OwWRSA0b4yq2AW1wjvvfcY0zLWQuwTa4zw= github.com/containers/storage v1.21.1/go.mod h1:I1EIAA7B4OwWRSA0b4yq2AW1wjvvfcY0zLWQuwTa4zw=
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/go-iptables v0.4.5 h1:DpHb9vJrZQEFMcVLFKAAGMUVX0XoRC0ptCthinRYm38= github.com/coreos/go-iptables v0.4.5 h1:DpHb9vJrZQEFMcVLFKAAGMUVX0XoRC0ptCthinRYm38=

View File

@ -1 +1 @@
1.21.0 1.21.1

View File

@ -892,19 +892,6 @@ func (d *Driver) get(id string, disableShifting bool, options graphdriver.MountO
} }
} }
// If the lowers list is still empty, use an empty lower so that we can still force an
// SELinux context for the mount.
// if we are doing a readOnly mount, and there is only one lower
// We should just return the lower directory, no reason to mount.
if !readWrite && d.options.mountProgram == "" {
if len(absLowers) == 0 {
return path.Join(dir, "empty"), nil
}
if len(absLowers) == 1 {
return absLowers[0], nil
}
}
if len(absLowers) == 0 { if len(absLowers) == 0 {
absLowers = append(absLowers, path.Join(dir, "empty")) absLowers = append(absLowers, path.Join(dir, "empty"))
relLowers = append(relLowers, path.Join(id, "empty")) relLowers = append(relLowers, path.Join(id, "empty"))

View File

@ -772,7 +772,20 @@ func (r *layerStore) Mounted(id string) (int, error) {
} }
func (r *layerStore) Mount(id string, options drivers.MountOpts) (string, error) { func (r *layerStore) Mount(id string, options drivers.MountOpts) (string, error) {
if !r.IsReadWrite() {
// check whether options include ro option
hasReadOnlyOpt := func(opts []string) bool {
for _, item := range opts {
if item == "ro" {
return true
}
}
return false
}
// You are not allowed to mount layers from readonly stores if they
// are not mounted read/only.
if !r.IsReadWrite() && !hasReadOnlyOpt(options.Options) {
return "", errors.Wrapf(ErrStoreIsReadOnly, "not allowed to update mount locations for layers at %q", r.mountspath()) return "", errors.Wrapf(ErrStoreIsReadOnly, "not allowed to update mount locations for layers at %q", r.mountspath())
} }
r.mountsLockfile.Lock() r.mountsLockfile.Lock()
@ -1000,6 +1013,7 @@ func (r *layerStore) deleteInternal(id string) error {
if layer.MountPoint != "" { if layer.MountPoint != "" {
delete(r.bymount, layer.MountPoint) delete(r.bymount, layer.MountPoint)
} }
r.deleteInDigestMap(id)
toDeleteIndex := -1 toDeleteIndex := -1
for i, candidate := range r.layers { for i, candidate := range r.layers {
if candidate.ID == id { if candidate.ID == id {
@ -1031,6 +1045,27 @@ func (r *layerStore) deleteInternal(id string) error {
return err return err
} }
func (r *layerStore) deleteInDigestMap(id string) {
for digest, layers := range r.bycompressedsum {
for i, layerID := range layers {
if layerID == id {
layers = append(layers[:i], layers[i+1:]...)
r.bycompressedsum[digest] = layers
break
}
}
}
for digest, layers := range r.byuncompressedsum {
for i, layerID := range layers {
if layerID == id {
layers = append(layers[:i], layers[i+1:]...)
r.byuncompressedsum[digest] = layers
break
}
}
}
}
func (r *layerStore) Delete(id string) error { func (r *layerStore) Delete(id string) error {
layer, ok := r.lookup(id) layer, ok := r.lookup(id)
if !ok { if !ok {

View File

@ -229,7 +229,7 @@ func subtractHostIDs(avail idtools.IDMap, used idtools.IDMap) []idtools.IDMap {
case used.HostID <= avail.HostID && used.HostID+used.Size >= avail.HostID+avail.Size: case used.HostID <= avail.HostID && used.HostID+used.Size >= avail.HostID+avail.Size:
return nil return nil
case used.HostID <= avail.HostID && used.HostID+used.Size > avail.HostID && used.HostID+used.Size < avail.HostID+avail.Size: case used.HostID <= avail.HostID && used.HostID+used.Size > avail.HostID && used.HostID+used.Size < avail.HostID+avail.Size:
newContainerID := used.HostID + used.Size newContainerID := avail.ContainerID + used.Size
newHostID := used.HostID + used.Size newHostID := used.HostID + used.Size
r := idtools.IDMap{ r := idtools.IDMap{
ContainerID: newContainerID, ContainerID: newContainerID,
@ -275,7 +275,7 @@ func subtractContainerIDs(avail idtools.IDMap, used idtools.IDMap) []idtools.IDM
return nil return nil
case used.ContainerID <= avail.ContainerID && used.ContainerID+used.Size > avail.ContainerID && used.ContainerID+used.Size < avail.ContainerID+avail.Size: case used.ContainerID <= avail.ContainerID && used.ContainerID+used.Size > avail.ContainerID && used.ContainerID+used.Size < avail.ContainerID+avail.Size:
newContainerID := used.ContainerID + used.Size newContainerID := used.ContainerID + used.Size
newHostID := used.HostID + used.Size newHostID := avail.HostID + used.Size
r := idtools.IDMap{ r := idtools.IDMap{
ContainerID: newContainerID, ContainerID: newContainerID,
HostID: newHostID, HostID: newHostID,
@ -297,7 +297,7 @@ func subtractContainerIDs(avail idtools.IDMap, used idtools.IDMap) []idtools.IDM
} }
r2 := idtools.IDMap{ r2 := idtools.IDMap{
ContainerID: used.ContainerID + used.Size, ContainerID: used.ContainerID + used.Size,
HostID: used.HostID + used.Size, HostID: avail.HostID + used.Size,
Size: avail.ContainerID + avail.Size - used.ContainerID - used.Size, Size: avail.ContainerID + avail.Size - used.ContainerID - used.Size,
} }
return []idtools.IDMap{r1, r2} return []idtools.IDMap{r1, r2}

2
vendor/modules.txt vendored
View File

@ -155,7 +155,7 @@ github.com/containers/psgo/internal/dev
github.com/containers/psgo/internal/host github.com/containers/psgo/internal/host
github.com/containers/psgo/internal/proc github.com/containers/psgo/internal/proc
github.com/containers/psgo/internal/process github.com/containers/psgo/internal/process
# github.com/containers/storage v1.21.0 # github.com/containers/storage v1.21.1
github.com/containers/storage github.com/containers/storage
github.com/containers/storage/drivers github.com/containers/storage/drivers
github.com/containers/storage/drivers/aufs github.com/containers/storage/drivers/aufs