[CRIU] [PATCH 1/2] restore: don't pass cgroup nsroot= option to mount()
Pavel Emelyanov
xemul at virtuozzo.com
Thu Mar 24 00:11:45 PDT 2016
On 03/24/2016 12:41 AM, Tycho Andersen wrote:
> https://lkml.org/lkml/2016/3/21/777 introduces a new cgroup mount option
> called nsroot, but doesn't allow you to pass it to mount() to actually
> mount it. Let's chop this option off so that we don't get errors from
> mount().
What if this option comes in the middle of the options string?
> There may be better places to chop this off (e.g. perhaps on dump),
> although I think it is useful to have it in there for debugging purposes,
> and only costs us a few extra bytes to keep it in the images since we're
> going to have other cgroup options anyways.
>
> Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
> ---
> criu/mount.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/criu/mount.c b/criu/mount.c
> index a425828..be79999 100644
> --- a/criu/mount.c
> +++ b/criu/mount.c
> @@ -2866,6 +2866,18 @@ static int collect_mnt_from_image(struct mount_info **pms, struct ns_id *nsid)
> /* FIXME: abort unsupported early */
> pm->fstype = decode_fstype(me->fstype, me->fsname);
>
> + if (pm->fstype->code == FSTYPE__CGROUP) {
> + char *pos;
> +
> + pos = strstr(pm->options, "nsroot=");
> + if (pos > pm->options && *(pos-1) == ',')
> + pos--;
> + if (pos) {
> + pr_info("trimming nsroot option %s from cgroup mount\n", pos);
> + *pos = 0;
> + }
> + }
> +
> if (get_mp_root(me, pm))
> goto err;
>
>
More information about the CRIU
mailing list