mirror of
https://github.com/podman-container-tools/podman.git
synced 2026-10-29 01:07:38 +00:00
Backport of https://github.com/containers/podman/pull/13536 to 3.4
Signed-off-by: Dan Čermák <dcermak@suse.com>
This commit is contained in:
parent
599d785b9e
commit
efe943f669
7 changed files with 55 additions and 47 deletions
2
go.mod
2
go.mod
|
|
@ -17,7 +17,7 @@ require (
|
|||
github.com/containers/image/v5 v5.17.0
|
||||
github.com/containers/ocicrypt v1.1.2
|
||||
github.com/containers/psgo v1.7.1
|
||||
github.com/containers/storage v1.37.0
|
||||
github.com/containers/storage v1.37.1
|
||||
github.com/coreos/go-systemd/v22 v22.3.2
|
||||
github.com/coreos/stream-metadata-go v0.0.0-20210225230131-70edb9eb47b3
|
||||
github.com/cri-o/ocicni v0.2.1-0.20210621164014-d0acc7862283
|
||||
|
|
|
|||
3
go.sum
3
go.sum
|
|
@ -271,8 +271,9 @@ github.com/containers/psgo v1.7.1/go.mod h1:mWGpFzW73qWFA+blhF6l7GuKzbrACkYgr/aj
|
|||
github.com/containers/storage v1.23.5/go.mod h1:ha26Q6ngehFNhf3AWoXldvAvwI4jFe3ETQAf/CeZPyM=
|
||||
github.com/containers/storage v1.35.0/go.mod h1:qzYhasQP2/V9D9XdO+vRwkHBhsBO0oznMLzzRDQ8s20=
|
||||
github.com/containers/storage v1.36.0/go.mod h1:vbd3SKVQNHdmU5qQI6hTEcKPxnZkGqydG4f6uwrI5a8=
|
||||
github.com/containers/storage v1.37.0 h1:HVhDsur6sx889ZIZ1d1kEiOzv3gsr5q0diX2VZmOdSg=
|
||||
github.com/containers/storage v1.37.0/go.mod h1:kqeJeS0b7DO2ZT1nVWs0XufrmPFbgV3c+Q/45RlH6r4=
|
||||
github.com/containers/storage v1.37.1 h1:VB34UgJXlanXgT/vdL+F0PXoFLXr5mtkcQqN9WFGHmw=
|
||||
github.com/containers/storage v1.37.1/go.mod h1:kqeJeS0b7DO2ZT1nVWs0XufrmPFbgV3c+Q/45RlH6r4=
|
||||
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.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
|
||||
|
|
|
|||
2
vendor/github.com/containers/storage/VERSION
generated
vendored
2
vendor/github.com/containers/storage/VERSION
generated
vendored
|
|
@ -1 +1 @@
|
|||
1.37.0
|
||||
1.37.1
|
||||
|
|
|
|||
46
vendor/github.com/containers/storage/drivers/overlay/overlay.go
generated
vendored
46
vendor/github.com/containers/storage/drivers/overlay/overlay.go
generated
vendored
|
|
@ -282,6 +282,31 @@ func Init(home string, options graphdriver.Options) (graphdriver.Driver, error)
|
|||
backingFs = fsName
|
||||
}
|
||||
|
||||
runhome := filepath.Join(options.RunRoot, filepath.Base(home))
|
||||
rootUID, rootGID, err := idtools.GetRootUIDGID(options.UIDMaps, options.GIDMaps)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Create the driver home dir
|
||||
if err := idtools.MkdirAllAs(path.Join(home, linkDir), 0700, rootUID, rootGID); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err := idtools.MkdirAllAs(runhome, 0700, rootUID, rootGID); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if opts.mountProgram == "" {
|
||||
if supported, err := SupportsNativeOverlay(home, runhome); err != nil {
|
||||
return nil, err
|
||||
} else if !supported {
|
||||
if path, err := exec.LookPath("fuse-overlayfs"); err == nil {
|
||||
opts.mountProgram = path
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if opts.mountProgram != "" {
|
||||
if unshare.IsRootless() && isNetworkFileSystem(fsMagic) && opts.forceMask == nil {
|
||||
m := os.FileMode(0700)
|
||||
|
|
@ -306,20 +331,6 @@ func Init(home string, options graphdriver.Options) (graphdriver.Driver, error)
|
|||
}
|
||||
}
|
||||
|
||||
rootUID, rootGID, err := idtools.GetRootUIDGID(options.UIDMaps, options.GIDMaps)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Create the driver home dir
|
||||
if err := idtools.MkdirAllAs(path.Join(home, linkDir), 0700, rootUID, rootGID); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
runhome := filepath.Join(options.RunRoot, filepath.Base(home))
|
||||
if err := idtools.MkdirAllAs(runhome, 0700, rootUID, rootGID); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var usingMetacopy bool
|
||||
var supportsDType bool
|
||||
var supportsVolatile *bool
|
||||
|
|
@ -559,14 +570,11 @@ func cachedFeatureRecord(runhome, feature string, supported bool, text string) (
|
|||
return err
|
||||
}
|
||||
|
||||
func SupportsNativeOverlay(graphroot, rundir string) (bool, error) {
|
||||
if os.Geteuid() != 0 || graphroot == "" || rundir == "" {
|
||||
func SupportsNativeOverlay(home, runhome string) (bool, error) {
|
||||
if os.Geteuid() != 0 || home == "" || runhome == "" {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
home := filepath.Join(graphroot, "overlay")
|
||||
runhome := filepath.Join(rundir, "overlay")
|
||||
|
||||
var contents string
|
||||
flagContent, err := ioutil.ReadFile(getMountProgramFlagFile(home))
|
||||
if err == nil {
|
||||
|
|
|
|||
23
vendor/github.com/containers/storage/store.go
generated
vendored
23
vendor/github.com/containers/storage/store.go
generated
vendored
|
|
@ -2830,10 +2830,33 @@ func (s *store) Diff(from, to string, options *DiffOptions) (io.ReadCloser, erro
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// NaiveDiff could cause mounts to happen without a lock, so be safe
|
||||
// and treat the .Diff operation as a Mount.
|
||||
s.graphLock.Lock()
|
||||
defer s.graphLock.Unlock()
|
||||
|
||||
modified, err := s.graphLock.Modified()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// We need to make sure the home mount is present when the Mount is done.
|
||||
if modified {
|
||||
s.graphDriver = nil
|
||||
s.layerStore = nil
|
||||
s.graphDriver, err = s.getGraphDriver()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
s.lastLoaded = time.Now()
|
||||
}
|
||||
|
||||
for _, s := range append([]ROLayerStore{lstore}, lstores...) {
|
||||
store := s
|
||||
store.RLock()
|
||||
if err := store.ReloadIfChanged(); err != nil {
|
||||
store.Unlock()
|
||||
return nil, err
|
||||
}
|
||||
if store.Exists(to) {
|
||||
|
|
|
|||
24
vendor/github.com/containers/storage/types/options.go
generated
vendored
24
vendor/github.com/containers/storage/types/options.go
generated
vendored
|
|
@ -3,14 +3,12 @@ package types
|
|||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/BurntSushi/toml"
|
||||
"github.com/containers/storage/drivers/overlay"
|
||||
cfg "github.com/containers/storage/pkg/config"
|
||||
"github.com/containers/storage/pkg/idtools"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
|
@ -190,28 +188,6 @@ func getRootlessStorageOpts(rootlessUID int, systemOpts StoreOptions) (StoreOpti
|
|||
if driver := os.Getenv("STORAGE_DRIVER"); driver != "" {
|
||||
opts.GraphDriverName = driver
|
||||
}
|
||||
if opts.GraphDriverName == "" || opts.GraphDriverName == overlayDriver {
|
||||
supported, err := overlay.SupportsNativeOverlay(opts.GraphRoot, rootlessRuntime)
|
||||
if err != nil {
|
||||
return opts, err
|
||||
}
|
||||
if supported {
|
||||
opts.GraphDriverName = overlayDriver
|
||||
} else {
|
||||
if path, err := exec.LookPath("fuse-overlayfs"); err == nil {
|
||||
opts.GraphDriverName = overlayDriver
|
||||
opts.GraphDriverOptions = []string{fmt.Sprintf("overlay.mount_program=%s", path)}
|
||||
}
|
||||
}
|
||||
if opts.GraphDriverName == overlayDriver {
|
||||
for _, o := range systemOpts.GraphDriverOptions {
|
||||
if strings.Contains(o, "ignore_chown_errors") {
|
||||
opts.GraphDriverOptions = append(opts.GraphDriverOptions, o)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if opts.GraphDriverName == "" {
|
||||
opts.GraphDriverName = "vfs"
|
||||
}
|
||||
|
|
|
|||
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
|
|
@ -204,7 +204,7 @@ github.com/containers/psgo/internal/dev
|
|||
github.com/containers/psgo/internal/host
|
||||
github.com/containers/psgo/internal/proc
|
||||
github.com/containers/psgo/internal/process
|
||||
# github.com/containers/storage v1.37.0
|
||||
# github.com/containers/storage v1.37.1
|
||||
github.com/containers/storage
|
||||
github.com/containers/storage/drivers
|
||||
github.com/containers/storage/drivers/aufs
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue