]> xenbits.xensource.com Git - libvirt.git/commitdiff
Fix I/O errors in libvirtd daemon, and hang/crash in remote client upon I/O error
authorDaniel P. Berrange <berrange@redhat.com>
Tue, 17 Feb 2009 09:44:18 +0000 (09:44 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Tue, 17 Feb 2009 09:44:18 +0000 (09:44 +0000)
ChangeLog
qemud/event.c
src/domain_conf.c
src/remote_internal.c

index 13a854d4dc20da3b65c0d43c2fdaad521c4699dc..ed86cafea70e63cd760d445fcb9f1a54e52329b4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index 550d28c07ebba50a49f09eb291407a3005dc1fab..c9ea5638d56a2d8a09750b59fa17bf002b5c72f3 100644 (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;
index e46bf43b28a57905145d33a9a09f779bcc99e614..622665c4c4516174fdf59426800760fff2c57ab8 100644 (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);
index a14822ae4868de72cc600a3b9e75a296e6809443..eda61778081c55027ca052c9b4a4301a0e6b504a 100644 (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;
 }
 
 /*