mount: Handle deleted bindmounts

To handle deleted bindmounts we simply create
the former directory bindmount lived at, mount
the target and remove the directory back.

For this sake we add @deleted entry into the image.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Cyrill Gorcunov 2015-08-17 23:09:48 +03:00 committed by Pavel Emelyanov
parent 60f6ec7dd6
commit 80ef8fd2fb
4 changed files with 33 additions and 2 deletions

View file

@ -29,6 +29,7 @@
#include "sysfs_parse.h"
#include "seccomp.h"
#include "namespaces.h"
#include "files-reg.h"
#include "protobuf.h"
#include "protobuf/fdinfo.pb-c.h"
@ -1008,6 +1009,7 @@ replace:
static int parse_mountinfo_ent(char *str, struct mount_info *new, char **fsname)
{
struct fd_link root_link;
unsigned int kmaj, kmin;
int ret, n;
char *sub, *opt = NULL;
@ -1027,6 +1029,13 @@ static int parse_mountinfo_ent(char *str, struct mount_info *new, char **fsname)
cure_path(new->mountpoint);
cure_path(new->root);
root_link.len = strlen(new->root);
strcpy(root_link.name, new->root);
if (strip_deleted(&root_link)) {
strcpy(new->root, root_link.name);
new->deleted = true;
}
new->mountpoint = xrealloc(new->mountpoint, strlen(new->mountpoint) + 1);
if (!new->mountpoint)
goto err;