[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v6 03/33] vhost-user: disconnect on HUP
From: |
marcandre . lureau |
Subject: |
[Qemu-devel] [PATCH v6 03/33] vhost-user: disconnect on HUP |
Date: |
Wed, 27 Jul 2016 01:14:57 +0400 |
From: Marc-André Lureau <address@hidden>
In some cases, qemu_chr_fe_read_all() on HUP event doesn't raise
CHR_EVENT_CLOSED because the read/recv function returns -1 on
disconnected peers (for example with tch_chr_recv, an ECONNRESET errno
overwritten as EIO).
It is simpler to explicitely disconnect on HUP, rising CHR_EVENT_CLOSED
if it wasn't disconnected already.
Signed-off-by: Marc-André Lureau <address@hidden>
---
net/vhost-user.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/net/vhost-user.c b/net/vhost-user.c
index 2af212b..2cac32e 100644
--- a/net/vhost-user.c
+++ b/net/vhost-user.c
@@ -188,12 +188,8 @@ static gboolean net_vhost_user_watch(GIOChannel *chan,
GIOCondition cond,
void *opaque)
{
VhostUserState *s = opaque;
- uint8_t buf[1];
- /* We don't actually want to read anything, but CHR_EVENT_CLOSED will be
- * raised as a side-effect of the read.
- */
- qemu_chr_fe_read_all(s->chr, buf, sizeof(buf));
+ qemu_chr_disconnect(s->chr);
return FALSE;
}
--
2.9.0
- [Qemu-devel] [PATCH v6 00/33] vhost-user reconnect fixes, marcandre . lureau, 2016/07/26
- [Qemu-devel] [PATCH v6 01/33] misc: indentation, marcandre . lureau, 2016/07/26
- [Qemu-devel] [PATCH v6 02/33] vhost-user: minor simplification, marcandre . lureau, 2016/07/26
- [Qemu-devel] [PATCH v6 03/33] vhost-user: disconnect on HUP,
marcandre . lureau <=
- [Qemu-devel] [PATCH v6 04/33] vhost: don't assume opaque is a fd, use backend cleanup, marcandre . lureau, 2016/07/26
- [Qemu-devel] [PATCH v6 05/33] vhost: make vhost_log_put() idempotent, marcandre . lureau, 2016/07/26
- [Qemu-devel] [PATCH v6 06/33] vhost: assert the log was cleaned up, marcandre . lureau, 2016/07/26
- [Qemu-devel] [PATCH v6 07/33] vhost: fix cleanup on not fully initialized device, marcandre . lureau, 2016/07/26
- [Qemu-devel] [PATCH v6 08/33] vhost: make vhost_dev_cleanup() idempotent, marcandre . lureau, 2016/07/26
- [Qemu-devel] [PATCH v6 09/33] vhost-net: always call vhost_dev_cleanup() on failure, marcandre . lureau, 2016/07/26
- [Qemu-devel] [PATCH v6 10/33] vhost: fix calling vhost_dev_cleanup() after vhost_dev_init(), marcandre . lureau, 2016/07/26
- [Qemu-devel] [PATCH v6 11/33] vhost: do not assert() on vhost_ops failure, marcandre . lureau, 2016/07/26
- [Qemu-devel] [PATCH v6 12/33] vhost: add missing VHOST_OPS_DEBUG, marcandre . lureau, 2016/07/26
- [Qemu-devel] [PATCH v6 14/33] qemu-char: fix qemu_chr_fe_set_msgfds() crash when disconnected, marcandre . lureau, 2016/07/26