mirror of
https://github.com/containers/podman.git
synced 2025-12-01 02:27:13 +08:00
Vendor in latest containers/common with default capabilities
Also update vendor of containers/storage and image Cleanup display of added/dropped capabilties as well Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
5
vendor/github.com/containers/storage/drivers/counter.go
generated
vendored
5
vendor/github.com/containers/storage/drivers/counter.go
generated
vendored
@@ -58,6 +58,11 @@ func (c *RefCounter) incdec(path string, infoOp func(minfo *minfo)) int {
|
||||
}
|
||||
infoOp(m)
|
||||
count := m.count
|
||||
if count <= 0 {
|
||||
// If the mounted path has been decremented enough have no references,
|
||||
// then its entry can be removed.
|
||||
delete(c.counts, path)
|
||||
}
|
||||
c.mu.Unlock()
|
||||
return count
|
||||
}
|
||||
|
||||
3
vendor/github.com/containers/storage/drivers/overlay/overlay.go
generated
vendored
3
vendor/github.com/containers/storage/drivers/overlay/overlay.go
generated
vendored
@@ -1202,6 +1202,9 @@ func (d *Driver) Remove(id string) error {
|
||||
if err := system.EnsureRemoveAll(dir); err != nil && !os.IsNotExist(err) {
|
||||
return err
|
||||
}
|
||||
if d.quotaCtl != nil {
|
||||
d.quotaCtl.ClearQuota(dir)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
6
vendor/github.com/containers/storage/drivers/quota/projectquota.go
generated
vendored
6
vendor/github.com/containers/storage/drivers/quota/projectquota.go
generated
vendored
@@ -211,6 +211,12 @@ func (q *Control) SetQuota(targetPath string, quota Quota) error {
|
||||
return q.setProjectQuota(projectID, quota)
|
||||
}
|
||||
|
||||
// ClearQuota removes the map entry in the quotas map for targetPath.
|
||||
// It does so to prevent the map leaking entries as directories are deleted.
|
||||
func (q *Control) ClearQuota(targetPath string) {
|
||||
delete(q.quotas, targetPath)
|
||||
}
|
||||
|
||||
// setProjectQuota - set the quota for project id on xfs block device
|
||||
func (q *Control) setProjectQuota(projectID uint32, quota Quota) error {
|
||||
var d C.fs_disk_quota_t
|
||||
|
||||
4
vendor/github.com/containers/storage/drivers/zfs/zfs.go
generated
vendored
4
vendor/github.com/containers/storage/drivers/zfs/zfs.go
generated
vendored
@@ -57,12 +57,12 @@ func Init(base string, opt graphdriver.Options) (graphdriver.Driver, error) {
|
||||
return nil, fmt.Errorf("the 'zfs' command is not available: %w", graphdriver.ErrPrerequisites)
|
||||
}
|
||||
|
||||
file, err := os.OpenFile("/dev/zfs", os.O_RDWR, 0600)
|
||||
file, err := unix.Open("/dev/zfs", unix.O_RDWR, 0600)
|
||||
if err != nil {
|
||||
logger.Debugf("cannot open /dev/zfs: %v", err)
|
||||
return nil, fmt.Errorf("could not open /dev/zfs: %v: %w", err, graphdriver.ErrPrerequisites)
|
||||
}
|
||||
defer file.Close()
|
||||
defer unix.Close(file)
|
||||
|
||||
options, err := parseOptions(opt.DriverOptions)
|
||||
if err != nil {
|
||||
|
||||
16
vendor/github.com/containers/storage/layers.go
generated
vendored
16
vendor/github.com/containers/storage/layers.go
generated
vendored
@@ -299,6 +299,9 @@ type rwLayerStore interface {
|
||||
|
||||
// Clean up unreferenced layers
|
||||
GarbageCollect() error
|
||||
|
||||
// supportsShifting() returns true if the driver.Driver.SupportsShifting().
|
||||
supportsShifting() bool
|
||||
}
|
||||
|
||||
type layerStore struct {
|
||||
@@ -806,15 +809,14 @@ func (r *layerStore) saveLayers(saveLocations layerLocations) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var opts *ioutils.AtomicFileWriterOptions
|
||||
opts := ioutils.AtomicFileWriterOptions{}
|
||||
if location == volatileLayerLocation {
|
||||
opts = &ioutils.AtomicFileWriterOptions{
|
||||
NoSync: true,
|
||||
}
|
||||
opts.NoSync = true
|
||||
}
|
||||
if err := ioutils.AtomicWriteFileWithOpts(rpath, jldata, 0600, opts); err != nil {
|
||||
if err := ioutils.AtomicWriteFileWithOpts(rpath, jldata, 0600, &opts); err != nil {
|
||||
return err
|
||||
}
|
||||
r.layerspathsModified[locationIndex] = opts.ModTime
|
||||
}
|
||||
lw, err := r.lockfile.RecordWrite()
|
||||
if err != nil {
|
||||
@@ -2234,6 +2236,10 @@ func (r *layerStore) LayersByUncompressedDigest(d digest.Digest) ([]Layer, error
|
||||
return r.layersByDigestMap(r.byuncompressedsum, d)
|
||||
}
|
||||
|
||||
func (r *layerStore) supportsShifting() bool {
|
||||
return r.driver.SupportsShifting()
|
||||
}
|
||||
|
||||
func closeAll(closes ...func() error) (rErr error) {
|
||||
for _, f := range closes {
|
||||
if err := f(); err != nil {
|
||||
|
||||
26
vendor/github.com/containers/storage/pkg/ioutils/fswriters.go
generated
vendored
26
vendor/github.com/containers/storage/pkg/ioutils/fswriters.go
generated
vendored
@@ -4,6 +4,7 @@ import (
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
)
|
||||
|
||||
// AtomicFileWriterOptions specifies options for creating the atomic file writer.
|
||||
@@ -13,6 +14,9 @@ type AtomicFileWriterOptions struct {
|
||||
// storage after it has been written and before it is moved to
|
||||
// the specified path.
|
||||
NoSync bool
|
||||
// On successful return from Close() this is set to the mtime of the
|
||||
// newly written file.
|
||||
ModTime time.Time
|
||||
}
|
||||
|
||||
var defaultWriterOptions = AtomicFileWriterOptions{}
|
||||
@@ -74,6 +78,11 @@ func AtomicWriteFileWithOpts(filename string, data []byte, perm os.FileMode, opt
|
||||
if err1 := f.Close(); err == nil {
|
||||
err = err1
|
||||
}
|
||||
|
||||
if opts != nil {
|
||||
opts.ModTime = f.modTime
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -87,6 +96,7 @@ type atomicFileWriter struct {
|
||||
writeErr error
|
||||
perm os.FileMode
|
||||
noSync bool
|
||||
modTime time.Time
|
||||
}
|
||||
|
||||
func (w *atomicFileWriter) Write(dt []byte) (int, error) {
|
||||
@@ -109,9 +119,25 @@ func (w *atomicFileWriter) Close() (retErr error) {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// fstat before closing the fd
|
||||
info, statErr := w.f.Stat()
|
||||
if statErr == nil {
|
||||
w.modTime = info.ModTime()
|
||||
}
|
||||
// We delay error reporting until after the real call to close()
|
||||
// to match the traditional linux close() behaviour that an fd
|
||||
// is invalid (closed) even if close returns failure. While
|
||||
// weird, this allows a well defined way to not leak open fds.
|
||||
|
||||
if err := w.f.Close(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if statErr != nil {
|
||||
return statErr
|
||||
}
|
||||
|
||||
if err := os.Chmod(w.f.Name(), w.perm); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
830
vendor/github.com/containers/storage/store.go
generated
vendored
830
vendor/github.com/containers/storage/store.go
generated
vendored
File diff suppressed because it is too large
Load Diff
2
vendor/github.com/containers/storage/userns.go
generated
vendored
2
vendor/github.com/containers/storage/userns.go
generated
vendored
@@ -264,7 +264,7 @@ func (s *store) getAutoUserNS(options *types.AutoUserNsOptions, image *Image, rl
|
||||
}
|
||||
}
|
||||
if s.autoNsMaxSize > 0 && size > s.autoNsMaxSize {
|
||||
return nil, nil, fmt.Errorf("the container needs a user namespace with size %q that is bigger than the maximum value allowed with userns=auto %q", size, s.autoNsMaxSize)
|
||||
return nil, nil, fmt.Errorf("the container needs a user namespace with size %v that is bigger than the maximum value allowed with userns=auto %v", size, s.autoNsMaxSize)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user