Give a name to the only mount we care about

Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
v0.8
Paul "TBBle" Hampson 2020-07-24 20:40:46 +10:00
parent 4e69b50469
commit f9b8fc64b1
1 changed files with 8 additions and 6 deletions

View File

@ -25,25 +25,27 @@ func (lm *localMounter) Mount() (string, error) {
return "", errors.Wrapf(errdefs.ErrNotImplemented, "request to mount %d layers, only 1 is supported", len(lm.mounts))
}
if lm.mounts[0].Type == "bind" || lm.mounts[0].Type == "rbind" {
m := lm.mounts[0]
if m.Type == "bind" || m.Type == "rbind" {
ro := false
for _, opt := range lm.mounts[0].Options {
for _, opt := range m.Options {
if opt == "ro" {
ro = true
break
}
}
if !ro {
return lm.mounts[0].Source, nil
return m.Source, nil
}
}
// Windows mounts always activate in-place, so the target of the mount must be the source directory.
// See https://github.com/containerd/containerd/pull/2366
dir := lm.mounts[0].Source
dir := m.Source
if err := lm.mounts[0].Mount(dir); err != nil {
return "", errors.Wrapf(err, "failed to mount in-place: %v", lm.mounts[0])
if err := m.Mount(dir); err != nil {
return "", errors.Wrapf(err, "failed to mount in-place: %v", m)
}
lm.target = dir
return lm.target, nil