qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL v3 0/2] Qio next patches
@ 2018-06-28 12:38 Daniel P. Berrangé
  2018-06-28 12:38 ` [Qemu-devel] [PULL v3 1/2] socket: don'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:38 UTC (permalink / raw)
  To: qemu-devel
  Cc: Gerd Hoffmann, Daniel P. Berrangé, Peter Maydell,
	Marc-André Lureau, Paolo Bonzini

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 d66f78e1eaa832f73c771d9df1b606fe75d52a50:

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

----------------------------------------------------------------
Merge qio 2018-06-28 v3

Misc bug fixes for sockets channels

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

Pavel Balaev (1):
  Delete AF_UNIX socket after close

linzhecheng (1):
  socket: don'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 v3 1/2] socket: don't free msgfds if error equals EAGAIN
  2018-06-28 12:38 [Qemu-devel] [PULL v3 0/2] Qio next patches Daniel P. Berrangé
@ 2018-06-28 12:38 ` Daniel P. Berrangé
  2018-06-28 12:38 ` [Qemu-devel] [PULL v3 2/2] Delete AF_UNIX socket after close Daniel P. Berrangé
  2018-06-29  8:03 ` [Qemu-devel] [PULL v3 0/2] Qio next patches Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Daniel P. Berrangé @ 2018-06-28 12:38 UTC (permalink / raw)
  To: qemu-devel
  Cc: Gerd Hoffmann, Daniel P. Berrangé, Peter Maydell,
	Marc-André Lureau, Paolo Bonzini, 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 v3 2/2] Delete AF_UNIX socket after close
  2018-06-28 12:38 [Qemu-devel] [PULL v3 0/2] Qio next patches Daniel P. Berrangé
  2018-06-28 12:38 ` [Qemu-devel] [PULL v3 1/2] socket: don't free msgfds if error equals EAGAIN Daniel P. Berrangé
@ 2018-06-28 12:38 ` Daniel P. Berrangé
  2018-06-29  8:03 ` [Qemu-devel] [PULL v3 0/2] Qio next patches Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Daniel P. Berrangé @ 2018-06-28 12:38 UTC (permalink / raw)
  To: qemu-devel
  Cc: Gerd Hoffmann, Daniel P. Berrangé, Peter Maydell,
	Marc-André Lureau, Paolo Bonzini, 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 v3 0/2] Qio next patches
  2018-06-28 12:38 [Qemu-devel] [PULL v3 0/2] Qio next patches Daniel P. Berrangé
  2018-06-28 12:38 ` [Qemu-devel] [PULL v3 1/2] socket: don't free msgfds if error equals EAGAIN Daniel P. Berrangé
  2018-06-28 12:38 ` [Qemu-devel] [PULL v3 2/2] Delete AF_UNIX socket after close Daniel P. Berrangé
@ 2018-06-29  8:03 ` Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2018-06-29  8:03 UTC (permalink / raw)
  To: Daniel P. Berrangé
  Cc: QEMU Developers, Gerd Hoffmann, Marc-André Lureau,
	Paolo Bonzini

On 28 June 2018 at 13:38, Daniel P. Berrangé <berrange@redhat.com> 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 d66f78e1eaa832f73c771d9df1b606fe75d52a50:
>
>   Delete AF_UNIX socket after close (2018-06-28 13:36:59 +0100)
>
> ----------------------------------------------------------------
> Merge qio 2018-06-28 v3
>
> Misc bug fixes for sockets channels
>
> ----------------------------------------------------------------
Applied, thanks.

-- PMM

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

end of thread, other threads:[~2018-06-29  8:03 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:38 [Qemu-devel] [PULL v3 0/2] Qio next patches Daniel P. Berrangé
2018-06-28 12:38 ` [Qemu-devel] [PULL v3 1/2] socket: don't free msgfds if error equals EAGAIN Daniel P. Berrangé
2018-06-28 12:38 ` [Qemu-devel] [PULL v3 2/2] Delete AF_UNIX socket after close Daniel P. Berrangé
2018-06-29  8:03 ` [Qemu-devel] [PULL v3 0/2] Qio next patches Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).