Skip to contentSkip to conversation

Qio next patches

GIT PULL Daniel P. Berrangé 2 participants 4 messages Jun 28, 2018

lore
Share & tools
lore
#0 lore raw

The following changes since commit 00928a421d47f49691cace1207481b7aad31b1f1:

Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20180626' into staging (2018-06-26 18:23:49 +0100)

are available in the Git repository at:

https://github.com/berrange/qemu tags/qio-next-pull-request

for you to fetch changes up to 10aef3e986b4ae3fd909308bdd41c4e7ee1d1d04:

Delete AF_UNIX socket after close (2018-06-28 13:06:44 +0100)

----------------------------------------------------------------
Merge qio 2018-06-28 v2

Misc bug fixes for sockets channels

----------------------------------------------------------------

Pavel Balaev (1):
Delete AF_UNIX socket after close

linzhecheng (1):
socket: dont't free msgfds if error equals EAGAIN

 chardev/char-socket.c |  4 ++--
 io/channel-socket.c   | 18 +++++++++++++++++-
 2 files changed, 19 insertions(+), 3 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

[Qemu-devel] [PULL v2 1/2] socket: dont't free msgfds if error equals EAGAIN

From: linzhecheng <[email protected]>

If we see EAGAIN, no data was sent over the socket, so we still have to retry sending of msgfds next time.

---
 chardev/char-socket.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
chardev/char-socket.c +2 -2
index 159e69c3b1..17519ec589 100644
@@ -134,8 +134,8 @@ static int tcp_chr_write(Chardev *chr, const uint8_t *buf, int len)
                                         s->write_msgfds,
                                         s->write_msgfds_num);
 
-        /* free the written msgfds, no matter what */
-        if (s->write_msgfds_num) {
+        /* free the written msgfds in any cases other than errno==EAGAIN */
+        if (EAGAIN != errno && s->write_msgfds_num) {
             g_free(s->write_msgfds);
             s->write_msgfds = 0;
             s->write_msgfds_num = 0;
Signature · 1 line
2.17.1
#2 lore raw

[Qemu-devel] [PULL v2 2/2] Delete AF_UNIX socket after close

In reply to Daniel P. Berrangé

From: Pavel Balaev <[email protected]>

Since version 2.12.0 AF_UNIX socket created for QMP exchange is not deleted on instance shutdown.

This is due to the fact that function qio_channel_socket_finalize() is called after qio_channel_socket_close().

---
 io/channel-socket.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
io/channel-socket.c +17 -1
index 57cfb4d3a6..b50e63a053 100644
@@ -685,8 +685,10 @@ qio_channel_socket_close(QIOChannel *ioc,
                          Error **errp)
 {
     QIOChannelSocket *sioc = QIO_CHANNEL_SOCKET(ioc);
+    int rc = 0;
 
     if (sioc->fd != -1) {
+        SocketAddress *addr = socket_local_address(sioc->fd, errp);
 #ifdef WIN32
         WSAEventSelect(sioc->fd, NULL, 0);
 #endif
@@ -697,8 +699,22 @@ qio_channel_socket_close(QIOChannel *ioc,
             return -1;
         }
         sioc->fd = -1;
+
+        if (addr && addr->type == SOCKET_ADDRESS_TYPE_UNIX
+            && addr->u.q_unix.path) {
+            if (unlink(addr->u.q_unix.path) < 0 && errno != ENOENT) {
+                error_setg_errno(errp, errno,
+                                 "Failed to unlink socket %s",
+                                 addr->u.q_unix.path);
+                rc = -1;
+            }
+        }
+
+        if (addr) {
+            qapi_free_SocketAddress(addr);
+        }
     }
-    return 0;
+    return rc;
 }
 
 static int
Signature · 1 line
2.17.1
#3 lore raw
In reply to Daniel P. Berrangé
Quoted 17 lines · Daniel P. Berrangé

The following changes since commit 00928a421d47f49691cace1207481b7aad31b1f1:

   Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20180626' into staging (2018-06-26 18:23:49 +0100)

are available in the Git repository at:

https://github.com/berrange/qemu tags/qio-next-pull-request

for you to fetch changes up to 10aef3e986b4ae3fd909308bdd41c4e7ee1d1d04:

   Delete AF_UNIX socket after close (2018-06-28 13:06:44 +0100)

----------------------------------------------------------------
Merge qio 2018-06-28 v2

Misc bug fixes for sockets channels

Quoted 7 lines

----------------------------------------------------------------

Pavel Balaev (1):
Delete AF_UNIX socket after close

linzhecheng (1):
socket: dont't free msgfds if error equals EAGAIN

Our mails crossed. Do you want a v3 that fixes the typo in the subject line of 1/2?

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org