On 12/12/2017 06:36 AM, Marc Hartmayer wrote:
The lock for @client must not only be held for the duration of
checking whether the client wants to close, but also for as long as
we're closing the client.
Signed-off-by: Marc Hartmayer <mhartmay(a)linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy(a)linux.vnet.ibm.com>
Reviewed-by: Stefan Zimmermann <stzi(a)linux.vnet.ibm.com>
---
src/libvirt_remote.syms | 3 ++-
src/rpc/virnetserver.c | 12 ++++++++----
src/rpc/virnetserverclient.c | 25 ++++++++++++++-----------
src/rpc/virnetserverclient.h | 3 ++-
4 files changed, 26 insertions(+), 17 deletions(-)
Reviewed-by: John Ferlan <jferlan(a)redhat.com>
John
(minor nit below)
[...]
diff --git a/src/rpc/virnetserverclient.c
b/src/rpc/virnetserverclient.c
index 0ee299e2d6ec..96fd1e6d15c2 100644
--- a/src/rpc/virnetserverclient.c
+++ b/src/rpc/virnetserverclient.c
[...]
-bool virNetServerClientWantClose(virNetServerClientPtr client)
+
+/* @client needs to be locked by the caller */
+bool virNetServerClientWantCloseLocked(virNetServerClientPtr client)
Seeing as you added the "newer" extra line between functions you could
also have used the "newer" multi-line function decl:
bool
virNetServerClient...
{
- bool wantClose;
- virObjectLock(client);
- wantClose = client->wantClose;
- virObjectUnlock(client);
- return wantClose;
+ return client->wantClose;
}
[...]