]> xenbits.xensource.com Git - libvirt.git/commit
rpc: client: incapsulate error checks
authorNikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Thu, 7 Feb 2019 12:58:44 +0000 (15:58 +0300)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 8 Feb 2019 15:51:45 +0000 (16:51 +0100)
commitad063f6192665b39238eab96abd02b9d259bfce6
tree862b8398e7daa785fb3941f5fb744364140b3d22
parent8457fd50349927c2da25cc88dee3f62e931c2378
rpc: client: incapsulate error checks

Checking virNetClientStreamRaiseError without client lock
is racy which is fixed in [1] for example. Thus let's remove such checks
when we are sending message to server. And in other cases
(like virNetClientStreamRecvHole for example) let's move the check
into client stream code.

virNetClientStreamRecvPacket already have stream lock so we could
introduce another error checking function like virNetClientStreamRaiseErrorLocked
but as error is set when both client and stream lock are hold we
can remove locking from virNetClientStreamRaiseError because all
callers hold either client or stream lock.

Also let's split virNetClientStreamRaiseErrorLocked into checking
state function and checking message send status function. They are
same yet.

[1] 1b6a29c21: rpc: fix race on stream abort/finish and server side abort

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
src/libvirt_remote.syms
src/remote/remote_driver.c
src/rpc/virnetclient.c
src/rpc/virnetclientstream.c
src/rpc/virnetclientstream.h