Re: [PATCH v2 10/11] vsock_test: skip read() in test_stream*close tests on a VMCI host

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello!

On 08/01/2019 06:25 PM, Stefano Garzarella wrote:

> When VMCI transport is used, if the guest closes a connection,
> all data is gone and EOF is returned, so we should skip the read
> of data written by the peer before closing the connection.
> 
> Reported-by: Jorgen Hansen <jhansen@xxxxxxxxxx>
> Signed-off-by: Stefano Garzarella <sgarzare@xxxxxxxxxx>
> ---
>  tools/testing/vsock/vsock_test.c | 26 ++++++++++++++++++++++++--
>  1 file changed, 24 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/vsock/vsock_test.c b/tools/testing/vsock/vsock_test.c
> index cb606091489f..64adf45501ca 100644
> --- a/tools/testing/vsock/vsock_test.c
> +++ b/tools/testing/vsock/vsock_test.c
[...]
> @@ -79,16 +80,27 @@ static void test_stream_client_close_server(const struct test_opts *opts)
>  		exit(EXIT_FAILURE);
>  	}
>  
> +	local_cid = vsock_get_local_cid(fd);
> +
>  	control_expectln("CLOSED");
>  
>  	send_byte(fd, -EPIPE);
> -	recv_byte(fd, 1);
> +
> +	/* Skip the read of data wrote by the peer if we are on VMCI and

   s/wrote/written/?

> +	 * we are on the host side, because when the guest closes a
> +	 * connection, all data is gone and EOF is returned.
> +	 */
> +	if (!(opts->transport == TEST_TRANSPORT_VMCI &&
> +	    local_cid == VMADDR_CID_HOST))
> +		recv_byte(fd, 1);
> +
>  	recv_byte(fd, 0);
>  	close(fd);
>  }
[...]

MBR, Sergei
_______________________________________________
Virtualization mailing list
Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linuxfoundation.org/mailman/listinfo/virtualization



[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux