net/virtio: fix interrupt unregistering for listening socket
authorIlya Maximets <i.maximets@ovn.org>
Wed, 17 Mar 2021 20:25:27 +0000 (21:25 +0100)
committerChenbo Xia <chenbo.xia@intel.com>
Wed, 7 Apr 2021 07:07:39 +0000 (09:07 +0200)
commit23abee9dea8b7469559389bea67af1b68e5a9b81
tree59eaeafd65aceaa936c128cc95fc9aa471943fea
parent968bbc7e2e50ca9fd68285589af236734fd2f920
net/virtio: fix interrupt unregistering for listening socket

virtio_user_dev_server_reconnect() is typically called from the
interrupt context while checking the link state:

  vhost_user_update_link_state()
  --> virtio_user_dev_server_reconnect()

Under this conditions callback unregistering always fails.  This means
that listenfd is never unregistered and continue to trigger interrupts.
For example, if second client will try to connect to the same socket,
the server will receive interrupts infinitely because it will not
accept them while listen fd is readable and generates epoll events.

Fix that by moving reconfiguration of interrupts out of the
interrupt context to alarm handler.

'virtio_user_dev_delayed_handler' renamed to
'virtio_user_dev_delayed_disconnect_handler' to better reflect its
purpose.

Additionally improved error logging around interrupt management.

Fixes: bd8f50a45d0f ("net/virtio-user: support server mode")
Cc: stable@dpdk.org
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
drivers/net/virtio/virtio_user/vhost_user.c
drivers/net/virtio/virtio_user/virtio_user_dev.c
drivers/net/virtio/virtio_user/virtio_user_dev.h