[CRIU] [PATCH 11/13] crtools: restore nested mount namespaces
Cyrill Gorcunov
gorcunov at gmail.com
Tue Mar 11 08:56:41 PDT 2014
On Tue, Mar 11, 2014 at 07:18:27PM +0400, Andrey Vagin wrote:
> + } else {
> + char *mnt_roots = get_mnt_roots(false);
I guess this could be simplified to
path[PATH_MAX];
snprintf(path, sizeof(path), "%s/%d%s",
mnt_roots, nsid->id, me->mountpoint);
pm->mountpoint = strdup(path);
if (!pm->mountpoint)
goto err;
BUT this could be done on top, once series is merged.
The series looks good to me.
> +
> + BUG_ON(mnt_roots == NULL);
> +
> + /* All non-root mount namespaces are restored in
> + * a separate temporary directory, then a process with
> + * minimal pid will creates a new mount namespace and
> + * changes the root filesystem (pivot_root).
> + */
> +
> + len = snprintf(NULL, 0, "%s/%d%s",
> + mnt_roots, nsid->id, me->mountpoint);
> +
> + pm->mountpoint = xmalloc(len + 1);
> + if (pm->mountpoint == NULL)
> + goto err;
> +
> + snprintf(pm->mountpoint, len + 1,
> + "%s/%d%s", mnt_roots, nsid->id, me->mountpoint);
> + }
More information about the CRIU
mailing list