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