1. 04 Aug, 2019 2 commits
    • Sunil Muthuswamy's avatar
      vsock: correct removal of socket from the list · 8a474bc4
      Sunil Muthuswamy authored
      commit d5afa82c upstream.
      
      The current vsock code for removal of socket from the list is both
      subject to race and inefficient. It takes the lock, checks whether
      the socket is in the list, drops the lock and if the socket was on the
      list, deletes it from the list. This is subject to race because as soon
      as the lock is dropped once it is checked for presence, that condition
      cannot be relied upon for any decision. It is also inefficient because
      if the socket is present in the list, it takes the lock twice.
      Signed-off-by: default avatarSunil Muthuswamy <sunilmut@microsoft.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8a474bc4
    • Sunil Muthuswamy's avatar
      hv_sock: Add support for delayed close · 9d3586bc
      Sunil Muthuswamy authored
      commit a9eeb998 upstream.
      
      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: default avatarSunil Muthuswamy <sunilmut@microsoft.com>
      Reviewed-by: default avatarDexuan Cui <decui@microsoft.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9d3586bc
  2. 31 Jul, 2019 38 commits