]> git.ipfire.org Git - thirdparty/libvirt.git/commit
rpc: fix race on stream abort/finish and server side abort
authorNikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Thu, 7 Feb 2019 12:58:39 +0000 (15:58 +0300)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 8 Feb 2019 15:51:45 +0000 (16:51 +0100)
commita5445a3706b0bcbb6ec3f4f0f9e03b853ccf911b
treebc366bc558368da9bb4317890e2fbde9fbdb0a64
parentdf2b31ffea45fe209f7b283dcfbd2bf6e91cf6ab
rpc: fix race on stream abort/finish and server side abort

Stream abort/finish can hang because we can receive abort message
from server and yet sent abort/finish message to server. The latter
will not be answered ever because after server sends abort message
it forgets the stream and messages for unknown stream are simply ignored.

We check for stream error at the very beginning of remoteStreamFinish/remoteStreamAbort
but stream error can be set after the check in another thread operating
on stream. Let's check for stream error under client lock similar
to what's done in [1].

[1] 833b901cb: stream: Check for stream EOF

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
src/rpc/virnetclient.c
src/rpc/virnetclientstream.c