From: Dima Stepanov <dimastep@yandex-team.ru>
To: Li Feng <fengli@smartx.com>
Cc: "Fam Zheng" <fam@euphon.net>, "Kevin Wolf" <kwolf@redhat.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"open list:Block layer core" <qemu-block@nongnu.org>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Jason Wang" <jasowang@redhat.com>, QEMU <qemu-devel@nongnu.org>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
"Raphael Norwitz" <raphael.norwitz@nutanix.com>,
Gonglei <arei.gonglei@huawei.com>,
"Marc-André Lureau" <marcandre.lureau@gmail.com>,
yc-core@yandex-team.ru, "Paolo Bonzini" <pbonzini@redhat.com>,
"Max Reitz" <mreitz@redhat.com>
Subject: Re: [RFC PATCH v1 3/7] char-socket: initialize reconnect timer only if close is emitted
Date: Mon, 27 Apr 2020 12:38:33 +0300 [thread overview]
Message-ID: <20200427093824.GA8175@dimastep-nix> (raw)
In-Reply-To: <CAHckoCz7ZjKQu6XkFNA9DLH4RMbjGRTpZDAwyiRbUB2_Zw7+NQ@mail.gmail.com>
On Sun, Apr 26, 2020 at 03:26:58PM +0800, Li Feng wrote:
> This patch is trying to fix the same issue with me.
> However, our fix is different.
>
> I think that check the s->reconnect_timer is better.
I also thought about your solution:
- if (s->reconnect_time) {
+ if (s->reconnect_time && !s->reconnect_timer) {
But was afraid of possible side effects. Since Marc-André approved your
fix, i'm also good with your approach. In this case i'll remove this
patch from the v2 patchset.
Thanks for handling it!
>
> Thanks,
> Feng Li
>
> Marc-André Lureau <marcandre.lureau@gmail.com> 于2020年4月24日周五 上午3:16写道:
>
>
> >
> > Hi
> >
> > On Thu, Apr 23, 2020 at 8:41 PM Dima Stepanov <dimastep@yandex-team.ru> wrote:
> > >
> > > During vhost-user reconnect functionality testing the following assert
> > > was hit:
> > > qemu-system-x86_64: chardev/char-socket.c:125:
> > > qemu_chr_socket_restart_timer: Assertion `!s->reconnect_timer' failed.
> > > Aborted (core dumped)
> >
> > That looks related to "[PATCH 3/4] char-socket: avoid double call
> > tcp_chr_free_connection"
> >
> > > This is observed only if the connection is closed by the vhost-user-blk
> > > daemon during the initialization routine. In this case the
> > > tcp_chr_disconnect_locked() routine is called twice. First time it is
> > > called in the tcp_chr_write() routine, after getting the SIGPIPE signal.
> > > Second time it is called when vhost_user_blk_connect() routine return
> > > error. In general it looks correct, because the initialization routine
> > > can return error in many cases.
> > > The tcp_chr_disconnect_locked() routine could be fixed. The timer will
> > > be restarted only if the close event is emitted.
> > >
> > > Signed-off-by: Dima Stepanov <dimastep@yandex-team.ru>
> > > ---
> > > chardev/char-socket.c | 10 +++++-----
> > > 1 file changed, 5 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/chardev/char-socket.c b/chardev/char-socket.c
> > > index c128cca..83ca4d9 100644
> > > --- a/chardev/char-socket.c
> > > +++ b/chardev/char-socket.c
> > > @@ -476,7 +476,7 @@ static void update_disconnected_filename(SocketChardev *s)
> > > static void tcp_chr_disconnect_locked(Chardev *chr)
> > > {
> > > SocketChardev *s = SOCKET_CHARDEV(chr);
> > > - bool emit_close = s->state == TCP_CHARDEV_STATE_CONNECTED;
> > > + bool was_connected = s->state == TCP_CHARDEV_STATE_CONNECTED;
> > >
> > > tcp_chr_free_connection(chr);
> > >
> > > @@ -485,11 +485,11 @@ static void tcp_chr_disconnect_locked(Chardev *chr)
> > > chr, NULL, chr->gcontext);
> > > }
> > > update_disconnected_filename(s);
> > > - if (emit_close) {
> > > + if (was_connected) {
> > > qemu_chr_be_event(chr, CHR_EVENT_CLOSED);
> > > - }
> > > - if (s->reconnect_time) {
> > > - qemu_chr_socket_restart_timer(chr);
> > > + if (s->reconnect_time) {
> > > + qemu_chr_socket_restart_timer(chr);
> > > + }
> > > }
> > > }
> > >
> > > --
> > > 2.7.4
> > >
> > >
> >
> >
> > --
> > Marc-André Lureau
>
> --
> The SmartX email address is only for business purpose. Any sent message
> that is not related to the business is not authorized or permitted by
> SmartX.
> 本邮箱为北京志凌海纳科技有限公司(SmartX)工作邮箱. 如本邮箱发出的邮件与工作无关,该邮件未得到本公司任何的明示或默示的授权.
>
>
next prev parent reply other threads:[~2020-04-27 9:39 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-23 18:39 [RFC PATCH v1 0/7] vhost-user reconnect issues during vhost initialization Dima Stepanov
2020-04-23 18:39 ` [RFC PATCH v1 1/7] contrib/vhost-user-blk: add option to simulate disconnect on init Dima Stepanov
[not found] ` <20200422160206.GA30919@localhost.localdomain>
2020-04-24 10:17 ` Marc-André Lureau
2020-04-25 9:30 ` Dima Stepanov
2020-04-23 18:39 ` [RFC PATCH v1 2/7] char-socket: return -1 in case of disconnect during tcp_chr_write Dima Stepanov
2020-04-23 20:10 ` Marc-André Lureau
[not found] ` <ca921f6f56104bcbb664424f97558ec3@HE1PR08MB2650.eurprd08.prod.outlook.com>
2020-04-24 9:55 ` Anton Nefedov
2020-04-23 18:39 ` [RFC PATCH v1 3/7] char-socket: initialize reconnect timer only if close is emitted Dima Stepanov
2020-04-23 19:16 ` Marc-André Lureau
2020-04-26 7:26 ` Li Feng
2020-04-27 9:38 ` Dima Stepanov [this message]
2020-04-23 18:39 ` [RFC PATCH v1 4/7] vhost: introduce wrappers to set guest notifiers for virtio device Dima Stepanov
2020-04-23 18:39 ` [RFC PATCH v1 5/7] vhost-user-blk: add mechanism to track the guest notifiers init state Dima Stepanov
[not found] ` <20200422161750.GC31091@localhost.localdomain>
2020-04-24 9:17 ` Dima Stepanov
2020-04-23 18:39 ` [RFC PATCH v1 6/7] vhost: check vring address before calling unmap Dima Stepanov
2020-04-23 18:39 ` [RFC PATCH v1 7/7] vhost: add device started check in migration set log Dima Stepanov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200427093824.GA8175@dimastep-nix \
--to=dimastep@yandex-team.ru \
--cc=arei.gonglei@huawei.com \
--cc=dgilbert@redhat.com \
--cc=fam@euphon.net \
--cc=fengli@smartx.com \
--cc=jasowang@redhat.com \
--cc=kwolf@redhat.com \
--cc=marcandre.lureau@gmail.com \
--cc=mreitz@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=raphael.norwitz@nutanix.com \
--cc=stefanha@redhat.com \
--cc=yc-core@yandex-team.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).