[CRIU] [PATCH] zdtm: check mnt_id in /proc/PID/fdinfo/X

Pavel Emelyanov xemul at parallels.com
Thu Apr 24 00:11:28 PDT 2014


On 04/24/2014 12:35 AM, Andrey Vagin wrote:
> Nested mount namespaces should be checked only if fdinfo contains mnt_id

We already have the "ms kernel" feature in criu check and zdtm uses one.
BTW, the mntid checker in criu doesn't handle this as well.

> Signed-off-by: Andrey Vagin <avagin at openvz.org>
> ---
>  test/zdtm.sh                        |  2 ++
>  test/zdtm/live/static/mountpoints.c | 14 ++++++++------
>  2 files changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/test/zdtm.sh b/test/zdtm.sh
> index 2c222a0..4de131d 100755
> --- a/test/zdtm.sh
> +++ b/test/zdtm.sh
> @@ -188,6 +188,8 @@ COMPILE_ONLY=0
>  BATCH_TEST=0
>  SPECIFIED_NAME_USED=0
>  
> +cat /proc/self/fdinfo/1 | grep -q mnt_id || export ZDTM_NOSUBNS=1
> +
>  zdtm_sep()
>  { (
>  	set +x
> diff --git a/test/zdtm/live/static/mountpoints.c b/test/zdtm/live/static/mountpoints.c
> index 139be7e..65c2eb3 100644
> --- a/test/zdtm/live/static/mountpoints.c
> +++ b/test/zdtm/live/static/mountpoints.c
> @@ -78,7 +78,7 @@ static int test_fn(int argc, char **argv)
>  	struct ns_exec_args args;
>  	bool private = false;
>  	mode_t old_mask;
> -	pid_t pid;
> +	pid_t pid = -1;
>  
>  	if (!getenv("ZDTM_REEXEC")) {
>  		setenv("ZDTM_REEXEC", "1", 0);
> @@ -276,10 +276,12 @@ done:
>  	if (fd == -1)
>  		return 1;
>  
> -	pid = clone(ns_child, args.stack_ptr, CLONE_NEWNS | SIGCHLD, &args);
> -	if (pid < 0) {
> -		err("Unable to fork child");
> -		return 1;
> +	if (getenv("ZDTM_NOSUBNS") == NULL) {
> +		pid = clone(ns_child, args.stack_ptr, CLONE_NEWNS | SIGCHLD, &args);
> +		if (pid < 0) {
> +			err("Unable to fork child");
> +			return 1;
> +		}
>  	}
>  
>  	test_daemon();
> @@ -336,7 +338,7 @@ done:
>  		}
>  	}
>  
> -	{
> +	if (pid > 0) {
>  		kill(pid, SIGTERM);
>  		int status = 1;
>  		wait(&status);
> 




More information about the CRIU mailing list