From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Garzarella Subject: Re: [PATCH net 1/2] vsock: add half-closed socket details in the implementation notes Date: Fri, 11 Oct 2019 16:37:41 +0200 Message-ID: <20191011143741.frgdjcyee25wpcmf__44679.1987212904$1570805216$gmane$org@steredhat> References: <20191011130758.22134-1-sgarzare@redhat.com> <20191011130758.22134-2-sgarzare@redhat.com> <20191011101936-mutt-send-email-mst@kernel.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <20191011101936-mutt-send-email-mst@kernel.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: virtualization-bounces@lists.linux-foundation.org Errors-To: virtualization-bounces@lists.linux-foundation.org To: "Michael S. Tsirkin" Cc: kvm@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Adit Ranadive , Stefan Hajnoczi , virtualization@lists.linux-foundation.org, "David S. Miller" , Jorgen Hansen List-Id: virtualization@lists.linuxfoundation.org On Fri, Oct 11, 2019 at 10:22:30AM -0400, Michael S. Tsirkin wrote: > On Fri, Oct 11, 2019 at 03:07:57PM +0200, Stefano Garzarella wrote: > > vmci_transport never allowed half-closed socket on the host side. > > Since we want to have the same behaviour across all transports, we > > add a section in the "Implementation notes". > > > > Cc: Jorgen Hansen > > Cc: Adit Ranadive > > Signed-off-by: Stefano Garzarella > > --- > > net/vmw_vsock/af_vsock.c | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c > > index 2ab43b2bba31..27df57c2024b 100644 > > --- a/net/vmw_vsock/af_vsock.c > > +++ b/net/vmw_vsock/af_vsock.c > > @@ -83,6 +83,10 @@ > > * TCP_ESTABLISHED - connected > > * TCP_CLOSING - disconnecting > > * TCP_LISTEN - listening > > + * > > + * - Half-closed socket is supported only on the guest side. recv() on the host > > + * side should return EOF when the guest closes a connection, also if some > > + * data is still in the receive queue. > > */ > > > > #include > > That's a great way to lose data in a way that's hard to debug. > > VMCI sockets connect to a hypervisor so there's tight control > of what the hypervisor can do. > > But vhost vsocks connect to a fully fledged Linux, so > you can't assume this is safe. And application authors do not read > kernel source. Thanks for explaining. Discard this patch, I'll try to add a getsockopt() to allow the tests (and applications) to understand if half-closed socket is supported or not. Stefano