[CRIU] [PATCH] zdtm/pty02: never close master before reading slave

Vladimir Davydov vdavydov at parallels.com
Fri Dec 5 03:39:42 PST 2014


Drop this. We want to have the master closed in the parent during
checkpoint/restore. Will fix.

On Fri, Dec 05, 2014 at 11:50:36AM +0300, Vladimir Davydov wrote:
> We may close the master before reading the slave if the child runs first
> when the parent wakes it up using task_waiter_complete. In this case the
> subsequent read from the slave will return 0 resulting in a false
> positive test failure:
> 
> 13:23:42.194: 30914: ERR: pty02.c:89: read(slave) failed (errno = 11 (Resource temporarily unavailable))
> 
> We must assure that the master is closed only after the read has been
> completed.
> 
> Also note errno = EAGAIN in the failure report above, which looks really
> confusing. Let's print the actual number of bytes read/written along
> with the errno while reporting a read/write failure to make the error
> reporting clearer in this test.
> 
> Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
> Cc: Cyrill Gorcunov <gorcunov at parallels.com>
> ---
>  test/zdtm/live/static/pty02.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/test/zdtm/live/static/pty02.c b/test/zdtm/live/static/pty02.c
> index 5bad3fccde3f..e90ab60aae10 100644
> --- a/test/zdtm/live/static/pty02.c
> +++ b/test/zdtm/live/static/pty02.c
> @@ -62,7 +62,7 @@ int main(int argc, char *argv[])
>  
>  		ret = write(new_master, teststr, sizeof(teststr) - 1);
>  		if (ret != sizeof(teststr) - 1) {
> -			err("write(new_master) failed");
> +			err("write(new_master) failed (ret = %d)", ret);
>  			exit_shot_parent(1);
>  		}
>  
> @@ -76,7 +76,6 @@ int main(int argc, char *argv[])
>  	}
>  
>  	task_waiter_wait4(&t, pid);
> -	close(master);
>  
>  	test_daemon();
>  	test_waitsig();
> @@ -86,7 +85,7 @@ int main(int argc, char *argv[])
>  
>  	ret = read(slave, buf, sizeof(teststr) - 1);
>  	if (ret != sizeof(teststr) - 1) {
> -		err("read(slave) failed");
> +		err("read(slave) failed (ret = %d)", ret);
>  		return 1;
>  	}
>  
> @@ -95,6 +94,7 @@ int main(int argc, char *argv[])
>  		return 1;
>  	}
>  
> +	close(master);
>  	close(slave);
>  
>  	pass();
> -- 
> 1.7.10.4
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list