Thread (13 messages) flat view 13 messages, 3 authors, 2016-12-01

Re: [PATCH net] vhost_net: don't continue to call the recvmsg when meet errors

From: Jason Wang <hidden>
Date: 2016-12-01 03:15:07
Also in: lkml


On 2016年11月30日 21:40, Michael S. Tsirkin wrote:
On Wed, Nov 30, 2016 at 08:10:57PM +0800, Yunjian Wang wrote:
quoted
When we meet an error(err=-EBADFD) recvmsg,
How do you get EBADFD? Won't vhost_net_rx_peek_head_len
return 0 in this case, breaking the loop?
quoted
the error handling in vhost
handle_rx() will continue. This will cause a soft CPU lockup in vhost thread.

Signed-off-by: Yunjian Wang <redacted>
---
  drivers/vhost/net.c | 3 +++
  1 file changed, 3 insertions(+)
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 5dc128a..edc470b 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -717,6 +717,9 @@ static void handle_rx(struct vhost_net *net)
  			pr_debug("Discarded rx packet: "
  				 " len %d, expected %zd\n", err, sock_len);
  			vhost_discard_vq_desc(vq, headcount);
+			/* Don't continue to do, when meet errors. */
+			if (err < 0)
+				goto out;
You might get e.g. EAGAIN and I think you need to retry
in this case.
Yes.
quoted
  			continue;
  		}
  		/* Supply virtio_net_hdr if VHOST_NET_F_VIRTIO_NET_HDR */
-- 
1.9.5.msysgit.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help