[CRIU] [PATCH] zdtm/tempfs_subns: sync children with the main process

Andrei Vagin avagin at virtuozzo.com
Thu Dec 7 19:55:35 MSK 2017


Applied

On Thu, Nov 30, 2017 at 01:55:36AM +0300, Andrei Vagin wrote:
> From: Andrei Vagin <avagin at virtuozzo.com>
> 
> All static tests has to stop any activity before C/R.
> 
> ./tempfs_subns --pidfile=tempfs_subns.pid --outfile=tempfs_subns.out --dirname=tempfs_subns.test
> Run criu dump
> Unable to kill 128: [Errno 3] No such process
> Run criu restore
> 7: Old mounts lost: []
> 7: New mounts appeared: [('/rootfs/criu/test', '/'), ('/', '/proc'), ('/', '/dev/pts')]
> :
> 
> Signed-off-by: Andrei Vagin <avagin at virtuozzo.com>
> ---
>  test/zdtm/static/tempfs_subns.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/test/zdtm/static/tempfs_subns.c b/test/zdtm/static/tempfs_subns.c
> index 42195b57c..610f427d7 100644
> --- a/test/zdtm/static/tempfs_subns.c
> +++ b/test/zdtm/static/tempfs_subns.c
> @@ -42,26 +42,26 @@ int main(int argc, char **argv)
>  
>  		pid = fork();
>  		if (pid == 0) {
> -			if (write(fds[1], &fd, sizeof(fd)) != sizeof(fd)) {
> -				pr_perror("write");
> -				return 1;
> -			}
>  			if (unshare(CLONE_NEWNS)) {
>  				pr_perror("unshare");
>  				return 1;
>  			}
>  			prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0);
> +			if (write(fds[1], &fd, sizeof(fd)) != sizeof(fd)) {
> +				pr_perror("write");
> +				return 1;
> +			}
>  			while (1)
>  				sleep(1);
>  			return 1;
>  		}
>  		pid = fork();
>  		if (pid == 0) {
> +			prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0);
>  			if (write(fds[1], &fd, sizeof(fd)) != sizeof(fd)) {
>  				pr_perror("write");
>  				return 1;
>  			}
> -			prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0);
>  			while (1)
>  				sleep(1);
>  			return 1;
> -- 
> 2.13.6
> 


More information about the CRIU mailing list