mirror of
https://github.com/containers/podman.git
synced 2025-10-19 20:23:08 +08:00
vendor latest c/storage
To include the new fileutils.ReflinkOrCopy() function. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
2
vendor/github.com/containers/storage/.cirrus.yml
generated
vendored
2
vendor/github.com/containers/storage/.cirrus.yml
generated
vendored
@ -23,7 +23,7 @@ env:
|
||||
# GCE project where images live
|
||||
IMAGE_PROJECT: "libpod-218412"
|
||||
# VM Image built in containers/automation_images
|
||||
IMAGE_SUFFIX: "c20250107t132430z-f41f40d13"
|
||||
IMAGE_SUFFIX: "c20250131t121915z-f41f40d13"
|
||||
FEDORA_CACHE_IMAGE_NAME: "fedora-${IMAGE_SUFFIX}"
|
||||
DEBIAN_CACHE_IMAGE_NAME: "debian-${IMAGE_SUFFIX}"
|
||||
|
||||
|
2
vendor/github.com/containers/storage/VERSION
generated
vendored
2
vendor/github.com/containers/storage/VERSION
generated
vendored
@ -1 +1 @@
|
||||
1.57.1
|
||||
1.58.0-dev
|
||||
|
37
vendor/github.com/containers/storage/drivers/overlay/overlay.go
generated
vendored
37
vendor/github.com/containers/storage/drivers/overlay/overlay.go
generated
vendored
@ -36,7 +36,6 @@ import (
|
||||
"github.com/containers/storage/pkg/system"
|
||||
"github.com/containers/storage/pkg/unshare"
|
||||
units "github.com/docker/go-units"
|
||||
"github.com/hashicorp/go-multierror"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
"github.com/opencontainers/selinux/go-selinux"
|
||||
"github.com/opencontainers/selinux/go-selinux/label"
|
||||
@ -419,7 +418,7 @@ func Init(home string, options graphdriver.Options) (graphdriver.Driver, error)
|
||||
|
||||
if !opts.skipMountHome {
|
||||
if err := mount.MakePrivate(home); err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("overlay: failed to make mount private: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1343,7 +1342,7 @@ func (d *Driver) recreateSymlinks() error {
|
||||
return err
|
||||
}
|
||||
// Keep looping as long as we take some corrective action in each iteration
|
||||
var errs *multierror.Error
|
||||
var errs error
|
||||
madeProgress := true
|
||||
iterations := 0
|
||||
for madeProgress {
|
||||
@ -1359,7 +1358,7 @@ func (d *Driver) recreateSymlinks() error {
|
||||
// Read the "link" file under each layer to get the name of the symlink
|
||||
data, err := os.ReadFile(path.Join(d.dir(dir.Name()), "link"))
|
||||
if err != nil {
|
||||
errs = multierror.Append(errs, fmt.Errorf("reading name of symlink for %q: %w", dir.Name(), err))
|
||||
errs = errors.Join(errs, fmt.Errorf("reading name of symlink for %q: %w", dir.Name(), err))
|
||||
continue
|
||||
}
|
||||
linkPath := path.Join(d.home, linkDir, strings.Trim(string(data), "\n"))
|
||||
@ -1368,12 +1367,12 @@ func (d *Driver) recreateSymlinks() error {
|
||||
err = fileutils.Lexists(linkPath)
|
||||
if err != nil && os.IsNotExist(err) {
|
||||
if err := os.Symlink(path.Join("..", dir.Name(), "diff"), linkPath); err != nil {
|
||||
errs = multierror.Append(errs, err)
|
||||
errs = errors.Join(errs, err)
|
||||
continue
|
||||
}
|
||||
madeProgress = true
|
||||
} else if err != nil {
|
||||
errs = multierror.Append(errs, err)
|
||||
errs = errors.Join(errs, err)
|
||||
continue
|
||||
}
|
||||
}
|
||||
@ -1384,7 +1383,7 @@ func (d *Driver) recreateSymlinks() error {
|
||||
// that each symlink we have corresponds to one.
|
||||
links, err := os.ReadDir(linkDirFullPath)
|
||||
if err != nil {
|
||||
errs = multierror.Append(errs, err)
|
||||
errs = errors.Join(errs, err)
|
||||
continue
|
||||
}
|
||||
// Go through all of the symlinks in the "l" directory
|
||||
@ -1392,16 +1391,16 @@ func (d *Driver) recreateSymlinks() error {
|
||||
// Read the symlink's target, which should be "../$layer/diff"
|
||||
target, err := os.Readlink(filepath.Join(linkDirFullPath, link.Name()))
|
||||
if err != nil {
|
||||
errs = multierror.Append(errs, err)
|
||||
errs = errors.Join(errs, err)
|
||||
continue
|
||||
}
|
||||
targetComponents := strings.Split(target, string(os.PathSeparator))
|
||||
if len(targetComponents) != 3 || targetComponents[0] != ".." || targetComponents[2] != "diff" {
|
||||
errs = multierror.Append(errs, fmt.Errorf("link target of %q looks weird: %q", link, target))
|
||||
errs = errors.Join(errs, fmt.Errorf("link target of %q looks weird: %q", link, target))
|
||||
// force the link to be recreated on the next pass
|
||||
if err := os.Remove(filepath.Join(linkDirFullPath, link.Name())); err != nil {
|
||||
if !os.IsNotExist(err) {
|
||||
errs = multierror.Append(errs, fmt.Errorf("removing link %q: %w", link, err))
|
||||
errs = errors.Join(errs, fmt.Errorf("removing link %q: %w", link, err))
|
||||
} // else don’t report any error, but also don’t set madeProgress.
|
||||
continue
|
||||
}
|
||||
@ -1417,7 +1416,7 @@ func (d *Driver) recreateSymlinks() error {
|
||||
// NOTE: If two or more links point to the same target, we will update linkFile
|
||||
// with every value of link.Name(), and set madeProgress = true every time.
|
||||
if err := os.WriteFile(linkFile, []byte(link.Name()), 0o644); err != nil {
|
||||
errs = multierror.Append(errs, fmt.Errorf("correcting link for layer %s: %w", targetID, err))
|
||||
errs = errors.Join(errs, fmt.Errorf("correcting link for layer %s: %w", targetID, err))
|
||||
continue
|
||||
}
|
||||
madeProgress = true
|
||||
@ -1425,14 +1424,11 @@ func (d *Driver) recreateSymlinks() error {
|
||||
}
|
||||
iterations++
|
||||
if iterations >= maxIterations {
|
||||
errs = multierror.Append(errs, fmt.Errorf("reached %d iterations in overlay graph driver’s recreateSymlink, giving up", iterations))
|
||||
errs = errors.Join(errs, fmt.Errorf("reached %d iterations in overlay graph driver’s recreateSymlink, giving up", iterations))
|
||||
break
|
||||
}
|
||||
}
|
||||
if errs != nil {
|
||||
return errs.ErrorOrNil()
|
||||
}
|
||||
return nil
|
||||
return errs
|
||||
}
|
||||
|
||||
// Get creates and mounts the required file system for the given id and returns the mount path.
|
||||
@ -2103,17 +2099,16 @@ func (g *overlayFileGetter) Get(path string) (io.ReadCloser, error) {
|
||||
return nil, fmt.Errorf("%s: %w", path, os.ErrNotExist)
|
||||
}
|
||||
|
||||
func (g *overlayFileGetter) Close() error {
|
||||
var errs *multierror.Error
|
||||
func (g *overlayFileGetter) Close() (errs error) {
|
||||
for _, f := range g.composefsMounts {
|
||||
if err := f.Close(); err != nil {
|
||||
errs = multierror.Append(errs, err)
|
||||
errs = errors.Join(errs, err)
|
||||
}
|
||||
if err := unix.Rmdir(f.Name()); err != nil {
|
||||
errs = multierror.Append(errs, err)
|
||||
errs = errors.Join(errs, err)
|
||||
}
|
||||
}
|
||||
return errs.ErrorOrNil()
|
||||
return errs
|
||||
}
|
||||
|
||||
// newStagingDir creates a new staging directory and returns the path to it.
|
||||
|
23
vendor/github.com/containers/storage/layers.go
generated
vendored
23
vendor/github.com/containers/storage/layers.go
generated
vendored
@ -26,7 +26,6 @@ import (
|
||||
"github.com/containers/storage/pkg/system"
|
||||
"github.com/containers/storage/pkg/tarlog"
|
||||
"github.com/containers/storage/pkg/truncindex"
|
||||
multierror "github.com/hashicorp/go-multierror"
|
||||
"github.com/klauspost/pgzip"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
"github.com/opencontainers/selinux/go-selinux"
|
||||
@ -937,7 +936,7 @@ func (r *layerStore) load(lockedForWriting bool) (bool, error) {
|
||||
// Don't return the error immediately, because deleteInternal does not saveLayers();
|
||||
// Even if deleting one incomplete layer fails, call saveLayers() so that other possible successfully
|
||||
// deleted incomplete layers have their metadata correctly removed.
|
||||
incompleteDeletionErrors = multierror.Append(incompleteDeletionErrors,
|
||||
incompleteDeletionErrors = errors.Join(incompleteDeletionErrors,
|
||||
fmt.Errorf("deleting layer %#v: %w", layer.ID, err))
|
||||
}
|
||||
modifiedLocations |= layerLocation(layer)
|
||||
@ -2256,33 +2255,33 @@ func (r *layerStore) Diff(from, to string, options *DiffOptions) (io.ReadCloser,
|
||||
// but they modify in-memory state.
|
||||
fgetter, err := r.newFileGetter(to)
|
||||
if err != nil {
|
||||
errs := multierror.Append(nil, fmt.Errorf("creating file-getter: %w", err))
|
||||
errs := fmt.Errorf("creating file-getter: %w", err)
|
||||
if err := decompressor.Close(); err != nil {
|
||||
errs = multierror.Append(errs, fmt.Errorf("closing decompressor: %w", err))
|
||||
errs = errors.Join(errs, fmt.Errorf("closing decompressor: %w", err))
|
||||
}
|
||||
if err := tsfile.Close(); err != nil {
|
||||
errs = multierror.Append(errs, fmt.Errorf("closing tarstream headers: %w", err))
|
||||
errs = errors.Join(errs, fmt.Errorf("closing tarstream headers: %w", err))
|
||||
}
|
||||
return nil, errs.ErrorOrNil()
|
||||
return nil, errs
|
||||
}
|
||||
|
||||
tarstream := asm.NewOutputTarStream(fgetter, metadata)
|
||||
rc := ioutils.NewReadCloserWrapper(tarstream, func() error {
|
||||
var errs *multierror.Error
|
||||
var errs error
|
||||
if err := decompressor.Close(); err != nil {
|
||||
errs = multierror.Append(errs, fmt.Errorf("closing decompressor: %w", err))
|
||||
errs = errors.Join(errs, fmt.Errorf("closing decompressor: %w", err))
|
||||
}
|
||||
if err := tsfile.Close(); err != nil {
|
||||
errs = multierror.Append(errs, fmt.Errorf("closing tarstream headers: %w", err))
|
||||
errs = errors.Join(errs, fmt.Errorf("closing tarstream headers: %w", err))
|
||||
}
|
||||
if err := tarstream.Close(); err != nil {
|
||||
errs = multierror.Append(errs, fmt.Errorf("closing reconstructed tarstream: %w", err))
|
||||
errs = errors.Join(errs, fmt.Errorf("closing reconstructed tarstream: %w", err))
|
||||
}
|
||||
if err := fgetter.Close(); err != nil {
|
||||
errs = multierror.Append(errs, fmt.Errorf("closing file-getter: %w", err))
|
||||
errs = errors.Join(errs, fmt.Errorf("closing file-getter: %w", err))
|
||||
}
|
||||
if errs != nil {
|
||||
return errs.ErrorOrNil()
|
||||
return errs
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
1
vendor/github.com/containers/storage/pkg/archive/archive.go
generated
vendored
1
vendor/github.com/containers/storage/pkg/archive/archive.go
generated
vendored
@ -78,7 +78,6 @@ const (
|
||||
windows = "windows"
|
||||
darwin = "darwin"
|
||||
freebsd = "freebsd"
|
||||
linux = "linux"
|
||||
)
|
||||
|
||||
var xattrsToIgnore = map[string]interface{}{
|
||||
|
20
vendor/github.com/containers/storage/pkg/fileutils/reflink_linux.go
generated
vendored
Normal file
20
vendor/github.com/containers/storage/pkg/fileutils/reflink_linux.go
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
package fileutils
|
||||
|
||||
import (
|
||||
"io"
|
||||
"os"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
// ReflinkOrCopy attempts to reflink the source to the destination fd.
|
||||
// If reflinking fails or is unsupported, it falls back to io.Copy().
|
||||
func ReflinkOrCopy(src, dst *os.File) error {
|
||||
err := unix.IoctlFileClone(int(dst.Fd()), int(src.Fd()))
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
_, err = io.Copy(dst, src)
|
||||
return err
|
||||
}
|
15
vendor/github.com/containers/storage/pkg/fileutils/reflink_unsupported.go
generated
vendored
Normal file
15
vendor/github.com/containers/storage/pkg/fileutils/reflink_unsupported.go
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
//go:build !linux
|
||||
|
||||
package fileutils
|
||||
|
||||
import (
|
||||
"io"
|
||||
"os"
|
||||
)
|
||||
|
||||
// ReflinkOrCopy attempts to reflink the source to the destination fd.
|
||||
// If reflinking fails or is unsupported, it falls back to io.Copy().
|
||||
func ReflinkOrCopy(src, dst *os.File) error {
|
||||
_, err := io.Copy(dst, src)
|
||||
return err
|
||||
}
|
11
vendor/github.com/containers/storage/pkg/unshare/unshare_linux.go
generated
vendored
11
vendor/github.com/containers/storage/pkg/unshare/unshare_linux.go
generated
vendored
@ -98,7 +98,7 @@ func IsSetID(path string, modeid os.FileMode, capid capability.Cap) (bool, error
|
||||
return cap.Get(capability.EFFECTIVE, capid), nil
|
||||
}
|
||||
|
||||
func (c *Cmd) Start() error {
|
||||
func (c *Cmd) Start() (retErr error) {
|
||||
runtime.LockOSThread()
|
||||
defer runtime.UnlockOSThread()
|
||||
|
||||
@ -167,6 +167,15 @@ func (c *Cmd) Start() error {
|
||||
return err
|
||||
}
|
||||
|
||||
// If the function fails from here, we need to make sure the
|
||||
// child process is killed and properly cleaned up.
|
||||
defer func() {
|
||||
if retErr != nil {
|
||||
_ = c.Cmd.Process.Kill()
|
||||
_ = c.Cmd.Wait()
|
||||
}
|
||||
}()
|
||||
|
||||
// Close the ends of the pipes that the parent doesn't need.
|
||||
continueRead.Close()
|
||||
continueRead = nil
|
||||
|
6
vendor/github.com/containers/storage/store.go
generated
vendored
6
vendor/github.com/containers/storage/store.go
generated
vendored
@ -18,6 +18,7 @@ import (
|
||||
|
||||
// register all of the built-in drivers
|
||||
_ "github.com/containers/storage/drivers/register"
|
||||
"golang.org/x/sync/errgroup"
|
||||
|
||||
drivers "github.com/containers/storage/drivers"
|
||||
"github.com/containers/storage/internal/dedup"
|
||||
@ -30,7 +31,6 @@ import (
|
||||
"github.com/containers/storage/pkg/stringutils"
|
||||
"github.com/containers/storage/pkg/system"
|
||||
"github.com/containers/storage/types"
|
||||
"github.com/hashicorp/go-multierror"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
"github.com/opencontainers/selinux/go-selinux/label"
|
||||
"github.com/sirupsen/logrus"
|
||||
@ -2744,7 +2744,7 @@ func (s *store) DeleteContainer(id string) error {
|
||||
}
|
||||
}
|
||||
|
||||
var wg multierror.Group
|
||||
var wg errgroup.Group
|
||||
|
||||
middleDir := s.graphDriverName + "-containers"
|
||||
|
||||
@ -2759,7 +2759,7 @@ func (s *store) DeleteContainer(id string) error {
|
||||
})
|
||||
|
||||
if multierr := wg.Wait(); multierr != nil {
|
||||
return multierr.ErrorOrNil()
|
||||
return multierr
|
||||
}
|
||||
return s.containerStore.Delete(id)
|
||||
})
|
||||
|
Reference in New Issue
Block a user