[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: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH v2 1/1] qemu-char: socket backend: disconnect on write error |
Date: |
Fri, 24 Feb 2017 16:31:07 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 |
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)?
Paolo