mirror of
https://github.com/containers/skopeo.git
synced 2025-09-28 05:25:48 +00:00
Vendor in containers/(common, storage, image)
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
22
vendor/github.com/containers/storage/drivers/overlay/overlay.go
generated
vendored
22
vendor/github.com/containers/storage/drivers/overlay/overlay.go
generated
vendored
@@ -26,7 +26,6 @@ import (
|
||||
"github.com/containers/storage/pkg/directory"
|
||||
"github.com/containers/storage/pkg/fsutils"
|
||||
"github.com/containers/storage/pkg/idtools"
|
||||
"github.com/containers/storage/pkg/locker"
|
||||
"github.com/containers/storage/pkg/mount"
|
||||
"github.com/containers/storage/pkg/parsers"
|
||||
"github.com/containers/storage/pkg/system"
|
||||
@@ -119,7 +118,6 @@ type Driver struct {
|
||||
supportsDType bool
|
||||
supportsVolatile *bool
|
||||
usingMetacopy bool
|
||||
locker *locker.Locker
|
||||
|
||||
supportsIDMappedMounts *bool
|
||||
}
|
||||
@@ -422,7 +420,6 @@ func Init(home string, options graphdriver.Options) (graphdriver.Driver, error)
|
||||
supportsDType: supportsDType,
|
||||
usingMetacopy: usingMetacopy,
|
||||
supportsVolatile: supportsVolatile,
|
||||
locker: locker.New(),
|
||||
options: *opts,
|
||||
}
|
||||
|
||||
@@ -942,6 +939,16 @@ func (d *Driver) create(id, parent string, opts *graphdriver.CreateOpts, disable
|
||||
rootUID = int(st.UID())
|
||||
rootGID = int(st.GID())
|
||||
}
|
||||
|
||||
if _, err := system.Lstat(dir); err == nil {
|
||||
logrus.Warnf("Trying to create a layer %#v while directory %q already exists; removing it first", id, dir)
|
||||
// Don’t just os.RemoveAll(dir) here; d.Remove also removes the link in linkDir,
|
||||
// so that we can’t end up with two symlinks in linkDir pointing to the same layer.
|
||||
if err := d.Remove(id); err != nil {
|
||||
return errors.Wrapf(err, "removing a pre-existing layer directory %q", dir)
|
||||
}
|
||||
}
|
||||
|
||||
if err := idtools.MkdirAllAndChownNew(dir, 0700, idPair); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -1175,9 +1182,6 @@ func (d *Driver) optsAppendMappings(opts string, uidMaps, gidMaps []idtools.IDMa
|
||||
|
||||
// Remove cleans the directories that are created for this id.
|
||||
func (d *Driver) Remove(id string) error {
|
||||
d.locker.Lock(id)
|
||||
defer d.locker.Unlock(id)
|
||||
|
||||
dir := d.dir(id)
|
||||
lid, err := ioutil.ReadFile(path.Join(dir, "link"))
|
||||
if err == nil {
|
||||
@@ -1311,8 +1315,6 @@ func (d *Driver) Get(id string, options graphdriver.MountOpts) (_ string, retErr
|
||||
}
|
||||
|
||||
func (d *Driver) get(id string, disableShifting bool, options graphdriver.MountOpts) (_ string, retErr error) {
|
||||
d.locker.Lock(id)
|
||||
defer d.locker.Unlock(id)
|
||||
dir, inAdditionalStore := d.dir2(id)
|
||||
if _, err := os.Stat(dir); err != nil {
|
||||
return "", err
|
||||
@@ -1397,7 +1399,7 @@ func (d *Driver) get(id string, disableShifting bool, options graphdriver.MountO
|
||||
}
|
||||
for err == nil {
|
||||
absLowers = append(absLowers, filepath.Join(dir, nameWithSuffix("diff", diffN)))
|
||||
relLowers = append(relLowers, dumbJoin(string(link), "..", nameWithSuffix("diff", diffN)))
|
||||
relLowers = append(relLowers, dumbJoin(linkDir, string(link), "..", nameWithSuffix("diff", diffN)))
|
||||
diffN++
|
||||
st, err = os.Stat(filepath.Join(dir, nameWithSuffix("diff", diffN)))
|
||||
if err == nil && !permsKnown {
|
||||
@@ -1637,8 +1639,6 @@ func (d *Driver) get(id string, disableShifting bool, options graphdriver.MountO
|
||||
|
||||
// Put unmounts the mount path created for the give id.
|
||||
func (d *Driver) Put(id string) error {
|
||||
d.locker.Lock(id)
|
||||
defer d.locker.Unlock(id)
|
||||
dir := d.dir(id)
|
||||
if _, err := os.Stat(dir); err != nil {
|
||||
return err
|
||||
|
Reference in New Issue
Block a user