[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] xenconsoled: clean-up after all dead domains


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Tue, 04 Sep 2012 14:44:09 +0000
  • Delivery-date: Tue, 04 Sep 2012 14:44:21 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User David Vrabel <david.vrabel@xxxxxxxxxx>
# Date 1346406124 -3600
# Node ID 574d7bd438e56f0c2370653f0e740651a66bcdbd
# Parent  ebe7b65c6f5952b8e5a4f332a1b71706e67a7fba
xenconsoled: clean-up after all dead domains

xenconsoled expected domains that are being shutdown to end up in the
the DYING state and would only clean-up such domains.  HVM domains
either didn't enter the DYING state or weren't in long enough for
xenconsoled to notice.

For every shutdown HVM domain, xenconsoled would leak memory, grow its
list of domains and (if guest console logging was enabled) leak the
log file descriptor.  If the file descriptors were leaked and enough
HVM domains were shutdown, no more console connections would work as
the evtchn device could not be opened.  Guests would then block
waiting to send console output.

Fix this by tagging domains that exist in enum_domains().  Afterwards,
all untagged domains are assumed to be dead and are shutdown and
cleaned up.

Signed-off-by: David Vrabel <david.vrabel@xxxxxxxxxx>
Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Committed-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---


diff -r ebe7b65c6f59 -r 574d7bd438e5 tools/console/daemon/io.c
--- a/tools/console/daemon/io.c Fri Aug 31 10:42:04 2012 +0100
+++ b/tools/console/daemon/io.c Fri Aug 31 10:42:04 2012 +0100
@@ -84,6 +84,7 @@ struct domain {
        int slave_fd;
        int log_fd;
        bool is_dead;
+       unsigned last_seen;
        struct buffer buffer;
        struct domain *next;
        char *conspath;
@@ -727,12 +728,16 @@ static void shutdown_domain(struct domai
        d->xce_handle = NULL;
 }
 
+static unsigned enum_pass = 0;
+
 void enum_domains(void)
 {
        int domid = 1;
        xc_dominfo_t dominfo;
        struct domain *dom;
 
+       enum_pass++;
+
        while (xc_domain_getinfo(xc, domid, 1, &dominfo) == 1) {
                dom = lookup_domain(dominfo.domid);
                if (dominfo.dying) {
@@ -740,8 +745,10 @@ void enum_domains(void)
                                shutdown_domain(dom);
                } else {
                        if (dom == NULL)
-                               create_domain(dominfo.domid);
+                               dom = create_domain(dominfo.domid);
                }
+               if (dom)
+                       dom->last_seen = enum_pass;
                domid = dominfo.domid + 1;
        }
 }
@@ -1069,6 +1076,9 @@ void handle_io(void)
                                                           &writefds))
                                handle_tty_write(d);
 
+                       if (d->last_seen != enum_pass)
+                               shutdown_domain(d);
+
                        if (d->is_dead)
                                cleanup_domain(d);
                }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.