All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL v2 0/2] Qio next patches
@ 2018-06-28 12:08 Daniel P. Berrangé
  2018-06-28 12:08 ` [Qemu-devel] [PULL v2 1/2] socket: dont't free msgfds if error equals EAGAIN Daniel P. Berrangé
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Daniel P. Berrangé @ 2018-06-28 12:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Daniel P. Berrangé,
	Paolo Bonzini, Gerd Hoffmann, Peter Maydell,
	Marc-André Lureau

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(-)

-- 
2.17.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PULL v2 1/2] socket: dont't free msgfds if error equals EAGAIN
  2018-06-28 12:08 [Qemu-devel] [PULL v2 0/2] Qio next patches Daniel P. Berrangé
@ 2018-06-28 12:08 ` Daniel P. Berrangé
  2018-06-28 12:08 ` [Qemu-devel] [PULL v2 2/2] Delete AF_UNIX socket after close Daniel P. Berrangé
  2018-06-28 12:21 ` [Qemu-devel] [PULL v2 0/2] Qio next patches Eric Blake
  2 siblings, 0 replies; 4+ messages in thread
From: Daniel P. Berrangé @ 2018-06-28 12:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Daniel P. Berrangé,
	Paolo Bonzini, Gerd Hoffmann, Peter Maydell,
	Marc-André Lureau, linzhecheng

From: linzhecheng <linzhecheng@huawei.com>

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

Signed-off-by: linzhecheng <linzhecheng@huawei.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 chardev/char-socket.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/chardev/char-socket.c b/chardev/char-socket.c
index 159e69c3b1..17519ec589 100644
--- a/chardev/char-socket.c
+++ b/chardev/char-socket.c
@@ -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;
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PULL v2 2/2] Delete AF_UNIX socket after close
  2018-06-28 12:08 [Qemu-devel] [PULL v2 0/2] Qio next patches Daniel P. Berrangé
  2018-06-28 12:08 ` [Qemu-devel] [PULL v2 1/2] socket: dont't free msgfds if error equals EAGAIN Daniel P. Berrangé
@ 2018-06-28 12:08 ` Daniel P. Berrangé
  2018-06-28 12:21 ` [Qemu-devel] [PULL v2 0/2] Qio next patches Eric Blake
  2 siblings, 0 replies; 4+ messages in thread
From: Daniel P. Berrangé @ 2018-06-28 12:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Daniel P. Berrangé,
	Paolo Bonzini, Gerd Hoffmann, Peter Maydell,
	Marc-André Lureau, Pavel Balaev

From: Pavel Balaev <mail@void.so>

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().

Signed-off-by: Pavel Balaev <mail@void.so>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 io/channel-socket.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/io/channel-socket.c b/io/channel-socket.c
index 57cfb4d3a6..b50e63a053 100644
--- a/io/channel-socket.c
+++ b/io/channel-socket.c
@@ -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
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PULL v2 0/2] Qio next patches
  2018-06-28 12:08 [Qemu-devel] [PULL v2 0/2] Qio next patches Daniel P. Berrangé
  2018-06-28 12:08 ` [Qemu-devel] [PULL v2 1/2] socket: dont't free msgfds if error equals EAGAIN Daniel P. Berrangé
  2018-06-28 12:08 ` [Qemu-devel] [PULL v2 2/2] Delete AF_UNIX socket after close Daniel P. Berrangé
@ 2018-06-28 12:21 ` Eric Blake
  2 siblings, 0 replies; 4+ messages in thread
From: Eric Blake @ 2018-06-28 12:21 UTC (permalink / raw)
  To: Daniel P. Berrangé, qemu-devel
  Cc: Paolo Bonzini, Gerd Hoffmann, Marc-André Lureau, Peter Maydell

On 06/28/2018 07:08 AM, Daniel P. Berrangé wrote:
> 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

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

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-06-28 12:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-28 12:08 [Qemu-devel] [PULL v2 0/2] Qio next patches Daniel P. Berrangé
2018-06-28 12:08 ` [Qemu-devel] [PULL v2 1/2] socket: dont't free msgfds if error equals EAGAIN Daniel P. Berrangé
2018-06-28 12:08 ` [Qemu-devel] [PULL v2 2/2] Delete AF_UNIX socket after close Daniel P. Berrangé
2018-06-28 12:21 ` [Qemu-devel] [PULL v2 0/2] Qio next patches Eric Blake

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.