mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-18 10:35:20 +00:00
Avoid bogus event loop wakeups in remote driver when doing RPC call
This commit is contained in:
parent
ed493909f7
commit
c790f6d25e
@ -1,3 +1,9 @@
|
||||
Tue Jan 20 11:43:53 GMT 2009 Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
* src/remote_internal.c: Disable event watch when doing an
|
||||
RPC call to avoid bogus event loop wakeups which would
|
||||
block on a lock
|
||||
|
||||
Tue Jan 20 11:28:53 GMT 2009 Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
* src/remote_internal.c: Add locking to all public API entry
|
||||
|
@ -754,9 +754,7 @@ doRemoteOpen (virConnectPtr conn,
|
||||
DEBUG0("Adding Handler for remote events");
|
||||
/* Set up a callback to listen on the socket data */
|
||||
if ((priv->watch = virEventAddHandle(priv->sock,
|
||||
VIR_EVENT_HANDLE_READABLE |
|
||||
VIR_EVENT_HANDLE_ERROR |
|
||||
VIR_EVENT_HANDLE_HANGUP,
|
||||
VIR_EVENT_HANDLE_READABLE,
|
||||
remoteDomainEventFired,
|
||||
conn, NULL)) < 0) {
|
||||
DEBUG0("virEventAddHandle failed: No addHandleImpl defined."
|
||||
@ -5555,11 +5553,11 @@ static int really_read (virConnectPtr conn, struct private_data *priv,
|
||||
* else Bad Things will happen in the XDR code.
|
||||
*/
|
||||
static int
|
||||
call (virConnectPtr conn, struct private_data *priv,
|
||||
int flags /* if we are in virConnectOpen */,
|
||||
int proc_nr,
|
||||
xdrproc_t args_filter, char *args,
|
||||
xdrproc_t ret_filter, char *ret)
|
||||
doCall (virConnectPtr conn, struct private_data *priv,
|
||||
int flags /* if we are in virConnectOpen */,
|
||||
int proc_nr,
|
||||
xdrproc_t args_filter, char *args,
|
||||
xdrproc_t ret_filter, char *ret)
|
||||
{
|
||||
char buffer[REMOTE_MESSAGE_MAX];
|
||||
char buffer2[4];
|
||||
@ -5750,6 +5748,34 @@ retry_read:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
call (virConnectPtr conn, struct private_data *priv,
|
||||
int flags /* if we are in virConnectOpen */,
|
||||
int proc_nr,
|
||||
xdrproc_t args_filter, char *args,
|
||||
xdrproc_t ret_filter, char *ret)
|
||||
{
|
||||
int rv;
|
||||
/*
|
||||
* Avoid needless wake-ups of the event loop in the
|
||||
* case where this call is being made from a different
|
||||
* thread than the event loop. These wake-ups would
|
||||
* cause the event loop thread to be blocked on the
|
||||
* mutex for the duration of the call
|
||||
*/
|
||||
if (priv->watch >= 0)
|
||||
virEventUpdateHandle(priv->watch, 0);
|
||||
|
||||
rv = doCall(conn, priv,flags, proc_nr,
|
||||
args_filter, args,
|
||||
ret_filter, ret);
|
||||
|
||||
if (priv->watch >= 0)
|
||||
virEventUpdateHandle(priv->watch, VIR_EVENT_HANDLE_READABLE);
|
||||
return rv;
|
||||
}
|
||||
|
||||
static int
|
||||
really_write_buf (virConnectPtr conn, struct private_data *priv,
|
||||
int in_open /* if we are in virConnectOpen */,
|
||||
|
Loading…
x
Reference in New Issue
Block a user