diff options
Diffstat (limited to 'runsc/boot/fs.go')
-rw-r--r-- | runsc/boot/fs.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/runsc/boot/fs.go b/runsc/boot/fs.go index e5b7663d0..82bbea4d7 100644 --- a/runsc/boot/fs.go +++ b/runsc/boot/fs.go @@ -288,11 +288,21 @@ func mountSubmount(ctx context.Context, spec *specs.Spec, conf *Config, mns *fs. if useOverlay { log.Debugf("Adding overlay on top of mount %q", m.Destination) - if inode, err = addOverlay(ctx, conf, inode, m.Type, mf); err != nil { + inode, err = addOverlay(ctx, conf, inode, m.Type, mf) + if err != nil { return err } } + // Create destination in case it doesn't exist. This is required, in addition + // to 'addSubmountOverlay', in case there are symlinks to create directories + // in the right location, e.g. + // mount: /var/run/secrets, may be created in '/run/secrets' if + // '/var/run' => '/var'. + if err := mkdirAll(ctx, mns, m.Destination); err != nil { + return err + } + root := mns.Root() defer root.DecRef() dirent, err := mns.FindInode(ctx, root, nil, m.Destination, linux.MaxSymlinkTraversals) |