Fix I/O errors in libvirtd daemon, and hang/crash in remote client upon I/O error

This commit is contained in:
Daniel P. Berrange 2009-02-17 09:44:18 +00:00
parent 3a53ab7913
commit 4dce547640
4 changed files with 28 additions and 4 deletions

View File

@ -1,3 +1,12 @@
Tue Feb 10 11:14:07 GMT 2009 Daniel P. Berrange <berrange@redhat.com>
Fix I/O errors in libvirtd daemon, and hang/crash in remote
client upon I/O error.
* qemud/event.c: Treat POLLNVAL as VIR_EVENT_HANDLE_ERROR
* src/domain_conf.c: Initialize monitor FD to -1
* src/remote_internal.c: Remove call object from waitDispatch
queue upon I/O failure, since call is about to free it.
Mon Feb 16 17:59:04 EST 2009 Cole Robinson <crobinso@redhat.com>
* src/virsh.c, src/Makefile.am: Don't pass flags to DumpXML

View File

@ -657,6 +657,8 @@ virPollEventToEventHandleType(int events)
ret |= VIR_EVENT_HANDLE_WRITABLE;
if(events & POLLERR)
ret |= VIR_EVENT_HANDLE_ERROR;
if(events & POLLNVAL) /* Treat NVAL as error, since libvirt doesn't distinguish */
ret |= VIR_EVENT_HANDLE_ERROR;
if(events & POLLHUP)
ret |= VIR_EVENT_HANDLE_HANGUP;
return ret;

View File

@ -504,6 +504,7 @@ virDomainObjPtr virDomainAssignDef(virConnectPtr conn,
domain->state = VIR_DOMAIN_SHUTOFF;
domain->def = def;
domain->monitor_watch = -1;
domain->monitor = -1;
if (VIR_REALLOC_N(doms->objs, doms->count + 1) < 0) {
virReportOOMError(conn);

View File

@ -6192,17 +6192,17 @@ processCalls(virConnectPtr conn,
continue;
virReportSystemError(in_open ? NULL : conn, errno,
"%s", _("poll on socket failed"));
return -1;
goto error;
}
if (fds[0].revents & POLLOUT) {
if (processCallSend(conn, priv, in_open) < 0)
return -1;
goto error;
}
if (fds[0].revents & POLLIN) {
if (processCallRecv(conn, priv, in_open) < 0)
return -1;
goto error;
}
/* Iterate through waiting threads and if
@ -6253,9 +6253,21 @@ processCalls(virConnectPtr conn,
if (fds[0].revents & (POLLHUP | POLLERR)) {
errorf(in_open ? NULL : conn, VIR_ERR_INTERNAL_ERROR,
"%s", _("received hangup / error event on socket"));
return -1;
goto error;
}
}
error:
priv->waitDispatch = thiscall->next;
DEBUG("Giving up the buck due to I/O error %d %p %p", thiscall->proc_nr, thiscall, priv->waitDispatch);
/* See if someone else is still waiting
* and if so, then pass the buck ! */
if (priv->waitDispatch) {
DEBUG("Passing the buck to %d %p", priv->waitDispatch->proc_nr, priv->waitDispatch);
virCondSignal(&priv->waitDispatch->cond);
}
return -1;
}
/*