All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] socket: dont't free msgfds if error equals EAGAIN
@ 2018-05-29  2:52 linzhecheng
  2018-05-29  9:11 ` Marc-André Lureau
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: linzhecheng @ 2018-05-29  2:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, wangxinxin.wang, linzhecheng

Signed-off-by: linzhecheng <linzhecheng@huawei.com>

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.12.2.windows.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH] socket: dont't free msgfds if error equals EAGAIN
@ 2018-05-29  8:20 linzhecheng
  2018-05-29  8:41 ` Gonglei (Arei)
  0 siblings, 1 reply; 9+ messages in thread
From: linzhecheng @ 2018-05-29  8:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: pbonzini, wangxin (U),
	berrange, peterx, marcandre.lureau, eblake, Gonglei (Arei)

CC'ing Daniel P. Berrangé , Peter Xu, Marc-André Lureau, Eric Blake, Gonglei

> -----邮件原件-----
> 发件人: linzhecheng
> 发送时间: 2018年5月29日 10:53
> 收件人: qemu-devel@nongnu.org
> 抄送: pbonzini@redhat.com; wangxin (U) <wangxinxin.wang@huawei.com>;
> linzhecheng <linzhecheng@huawei.com>
> 主题: [PATCH] socket: dont't free msgfds if error equals EAGAIN
> 
> Signed-off-by: linzhecheng <linzhecheng@huawei.com>
> 
> 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.12.2.windows.2
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH] socket: dont't free msgfds if error equals EAGAIN
@ 2018-05-29  9:33 linzhecheng
  2018-05-29 19:33 ` Eric Blake
  0 siblings, 1 reply; 9+ messages in thread
From: linzhecheng @ 2018-05-29  9:33 UTC (permalink / raw)
  To: Marc-André Lureau
  Cc: QEMU, Paolo Bonzini, wangxin (U), Gonglei (Arei),
	peterx, eblake, berrange

I think this patch doesn't fix my issue. For more details, please see Gonglei's reply.
https://lists.gnu.org/archive/html/qemu-devel/2018-05/msg06296.html

> -----邮件原件-----
> 发件人: Marc-André Lureau [mailto:marcandre.lureau@gmail.com]
> 发送时间: 2018年5月29日 17:11
> 收件人: linzhecheng <linzhecheng@huawei.com>
> 抄送: QEMU <qemu-devel@nongnu.org>; Paolo Bonzini
> <pbonzini@redhat.com>; wangxin (U) <wangxinxin.wang@huawei.com>
> 主题: Re: [Qemu-devel] [PATCH] socket: dont't free msgfds if error equals
> EAGAIN
> 
> Hi
> 
> On Tue, May 29, 2018 at 4:52 AM, linzhecheng <linzhecheng@huawei.com>
> wrote:
> > Signed-off-by: linzhecheng <linzhecheng@huawei.com>
> >
> > 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;
> > --
> 
> It is already fix since v2.12:
> 
> commit c863fdec6aff6b5a4ca8fff1537b80d9f8b97726
> Author: Daniel P. Berrangé <berrange@redhat.com>
> Date:   Thu Feb 22 12:13:51 2018 +0000
> 
>     chardev: fix handling of EAGAIN for TCP chardev
> 
> > 2.12.2.windows.2
> >
> >
> >
> 
> 
> 
> --
> Marc-André Lureau

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

end of thread, other threads:[~2018-06-01 11:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-29  2:52 [Qemu-devel] [PATCH] socket: dont't free msgfds if error equals EAGAIN linzhecheng
2018-05-29  9:11 ` Marc-André Lureau
2018-05-30  2:56 ` Peter Xu
2018-06-01 11:46 ` Daniel P. Berrangé
2018-05-29  8:20 linzhecheng
2018-05-29  8:41 ` Gonglei (Arei)
2018-05-29  9:33 linzhecheng
2018-05-29 19:33 ` Eric Blake
2018-05-30  9:05   ` Gonglei (Arei)

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.