[CRIU] [PATCH 1/3] crtools: allow to use --inherit-fd on dump to mark inhereted descriptors

Pavel Emelyanov xemul at parallels.com
Thu Nov 26 05:57:35 PST 2015


On 11/26/2015 12:32 PM, Andrey Vagin wrote:
> From: Andrew Vagin <avagin at virtuozzo.com>
> 
> Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
> ---
>  crtools.c       |  4 ----
>  files.c         | 14 +++++++++-----
>  include/files.h |  1 +
>  3 files changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/crtools.c b/crtools.c
> index 123ad06..0a4b8b5 100644
> --- a/crtools.c
> +++ b/crtools.c
> @@ -597,10 +597,6 @@ int main(int argc, char *argv[], char *envp[])
>  		return 1;
>  
>  	if (!list_empty(&opts.inherit_fds)) {
> -		if (strcmp(argv[optind], "restore")) {
> -			pr_err("--inherit-fd is restore-only option\n");
> -			return 1;
> -		}

No, the inherit-fd should remain restore-only option. Justification:

The "external" file descriptor can be restored in may ways. E.g. for sockets
we can connect() it by hands. For files we can pre-open one before going
into chroot. Maybe other ways are possible. And for _any_ of them we can
inherit it from the parent. Thus inheritance is _one_ of the ways to
_restore_ things.

So the question is -- how to tell criu that some fd is "external" on dump.
I suggest using other option(s) for this. Maybe provide the unified
--external-fd one that looks like --inherit-fd. And obsolete the -x with
it.

-- Pavel


More information about the CRIU mailing list