qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 1/1] qemu-char: socket backend: disconnect on


From: Marc-André Lureau
Subject: Re: [Qemu-devel] [PATCH v2 1/1] qemu-char: socket backend: disconnect on write error
Date: Fri, 24 Feb 2017 16:00:57 +0000

Hi

On Fri, Feb 24, 2017 at 7:31 PM Paolo Bonzini <address@hidden> wrote:

>
>
> On 24/02/2017 15:46, Marc-André Lureau wrote:
> >
> >>> +        if (ret < 0 && errno != EAGAIN) {
> >>> +            if (tcp_chr_read_poll(chr) <= 0) {
> >>> +                tcp_chr_disconnect(chr);
> >>> +                return len;
> >>>
> >>
> >> This change breaks a number of assumption in vhost-user code. Until
> now, a
> >> vhost-user function assumed that dev->vhost_ops would remain as long as
> the
> >> function is running, so it may call vhost_ops callbacks several time,
> which
> >> may eventually fail to do io, but no crash would occur. The
> disconnection
> >> would be handled later with the HUP handler. Now, vhost_ops may be
> cleared
> >> during a write (chr_disconnect -> CHR_EVENT_CLOSED in
> >> net_vhost_user_event). This can be randomly reproduced with
> >> vhost-user-test -p /x86_64/vhost-user/flags-mismatch/subprocess
>
> Would it work to call tcp_chr_disconnect from an idle source (and
> destroy the source on the next connect)?
>

Yes, I have a solution in this direction: https://da.gd/NUZf7

Note that vhost code could reach disconnect on read and segv in similar
ways even if this commit was reverted. Delaying cleanup would solve that
case too. Otherwise, significant work needs to be done to make vhost more
robust on disconnect...
-- 
Marc-André Lureau


reply via email to

[Prev in Thread] Current Thread [Next in Thread]