mirror of
https://github.com/containers/podman.git
synced 2025-12-09 15:19:35 +08:00
vendor: update c/{buildah,common,image,storage}
Update to latest main to see if everything passes in preparation for the first 5.3 release candidate. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
4
vendor/github.com/containers/storage/drivers/driver.go
generated
vendored
4
vendor/github.com/containers/storage/drivers/driver.go
generated
vendored
@@ -189,14 +189,14 @@ type Driver interface {
|
||||
type DriverWithDifferOutput struct {
|
||||
Differ Differ
|
||||
Target string
|
||||
Size int64
|
||||
Size int64 // Size of the uncompressed layer, -1 if unknown. Must be known if UncompressedDigest is set.
|
||||
UIDs []uint32
|
||||
GIDs []uint32
|
||||
UncompressedDigest digest.Digest
|
||||
CompressedDigest digest.Digest
|
||||
Metadata string
|
||||
BigData map[string][]byte
|
||||
TarSplit []byte
|
||||
TarSplit []byte // nil if not available
|
||||
TOCDigest digest.Digest
|
||||
// RootDirMode is the mode of the root directory of the layer, if specified.
|
||||
RootDirMode *os.FileMode
|
||||
|
||||
48
vendor/github.com/containers/storage/drivers/quota/projectquota_supported.go
generated
vendored
48
vendor/github.com/containers/storage/drivers/quota/projectquota_supported.go
generated
vendored
@@ -18,6 +18,16 @@ package quota
|
||||
#include <linux/quota.h>
|
||||
#include <linux/dqblk_xfs.h>
|
||||
|
||||
#ifndef FS_XFLAG_PROJINHERIT
|
||||
struct fsxattr {
|
||||
__u32 fsx_xflags;
|
||||
__u32 fsx_extsize;
|
||||
__u32 fsx_nextents;
|
||||
__u32 fsx_projid;
|
||||
unsigned char fsx_pad[12];
|
||||
};
|
||||
#define FS_XFLAG_PROJINHERIT 0x00000200
|
||||
#endif
|
||||
#ifndef FS_IOC_FSGETXATTR
|
||||
#define FS_IOC_FSGETXATTR _IOR ('X', 31, struct fsxattr)
|
||||
#endif
|
||||
@@ -162,6 +172,11 @@ func NewControl(basePath string) (*Control, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Clear inherit flag from top-level directory if necessary.
|
||||
if err := stripProjectInherit(basePath); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
//
|
||||
// get first project id to be used for next container
|
||||
//
|
||||
@@ -339,6 +354,8 @@ func setProjectID(targetPath string, projectID uint32) error {
|
||||
}
|
||||
defer closeDir(dir)
|
||||
|
||||
logrus.Debugf("Setting quota project ID %d on %s", projectID, targetPath)
|
||||
|
||||
var fsx C.struct_fsxattr
|
||||
_, _, errno := unix.Syscall(unix.SYS_IOCTL, getDirFd(dir), C.FS_IOC_FSGETXATTR,
|
||||
uintptr(unsafe.Pointer(&fsx)))
|
||||
@@ -346,6 +363,7 @@ func setProjectID(targetPath string, projectID uint32) error {
|
||||
return fmt.Errorf("failed to get projid for %s: %w", targetPath, errno)
|
||||
}
|
||||
fsx.fsx_projid = C.__u32(projectID)
|
||||
fsx.fsx_xflags |= C.FS_XFLAG_PROJINHERIT
|
||||
_, _, errno = unix.Syscall(unix.SYS_IOCTL, getDirFd(dir), C.FS_IOC_FSSETXATTR,
|
||||
uintptr(unsafe.Pointer(&fsx)))
|
||||
if errno != 0 {
|
||||
@@ -355,6 +373,36 @@ func setProjectID(targetPath string, projectID uint32) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// stripProjectInherit strips the project inherit flag from a directory.
|
||||
// Used on the top-level directory to ensure project IDs are only inherited for
|
||||
// files in directories we set quotas on - not the directories we want to set
|
||||
// the quotas on, as that would make everything use the same project ID.
|
||||
func stripProjectInherit(targetPath string) error {
|
||||
dir, err := openDir(targetPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer closeDir(dir)
|
||||
|
||||
var fsx C.struct_fsxattr
|
||||
_, _, errno := unix.Syscall(unix.SYS_IOCTL, getDirFd(dir), C.FS_IOC_FSGETXATTR,
|
||||
uintptr(unsafe.Pointer(&fsx)))
|
||||
if errno != 0 {
|
||||
return fmt.Errorf("failed to get xfs attrs for %s: %w", targetPath, errno)
|
||||
}
|
||||
if fsx.fsx_xflags&C.FS_XFLAG_PROJINHERIT != 0 {
|
||||
// Flag is set, need to clear it.
|
||||
logrus.Debugf("Clearing PROJINHERIT flag from directory %s", targetPath)
|
||||
fsx.fsx_xflags = fsx.fsx_xflags &^ C.FS_XFLAG_PROJINHERIT
|
||||
_, _, errno = unix.Syscall(unix.SYS_IOCTL, getDirFd(dir), C.FS_IOC_FSSETXATTR,
|
||||
uintptr(unsafe.Pointer(&fsx)))
|
||||
if errno != 0 {
|
||||
return fmt.Errorf("failed to clear PROJINHERIT for %s: %w", targetPath, errno)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// findNextProjectID - find the next project id to be used for containers
|
||||
// by scanning driver home directory to find used project ids
|
||||
func (q *Control) findNextProjectID() error {
|
||||
|
||||
Reference in New Issue
Block a user