]> git.baikalelectronics.ru Git - kernel.git/commit
hv_sock: Add support for delayed close
authorSunil Muthuswamy <sunilmut@microsoft.com>
Wed, 15 May 2019 00:56:05 +0000 (00:56 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 16 May 2019 19:10:05 +0000 (12:10 -0700)
commit1247effdcadf01b842655beee7c3069f57a28ed4
treedc2d29eaaba3e00e2870d910bff9976a6ce11bad
parentff6c3350e51050b86af3a7cf4cefafd1fa19e335
hv_sock: Add support for delayed close

Currently, hvsock does not implement any delayed or background close
logic. Whenever the hvsock socket is closed, a FIN is sent to the peer, and
the last reference to the socket is dropped, which leads to a call to
.destruct where the socket can hang indefinitely waiting for the peer to
close it's side. The can cause the user application to hang in the close()
call.

This change implements proper STREAM(TCP) closing handshake mechanism by
sending the FIN to the peer and the waiting for the peer's FIN to arrive
for a given timeout. On timeout, it will try to terminate the connection
(i.e. a RST). This is in-line with other socket providers such as virtio.

This change does not address the hang in the vmbus_hvsock_device_unregister
where it waits indefinitely for the host to rescind the channel. That
should be taken up as a separate fix.

Signed-off-by: Sunil Muthuswamy <sunilmut@microsoft.com>
Reviewed-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/vmw_vsock/hyperv_transport.c