WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Protect cleanupDomain with the refresh_shutdown_lock. Th

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Protect cleanupDomain with the refresh_shutdown_lock. This stops the device
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 21 Mar 2006 16:08:07 +0000
Delivery-date: Tue, 21 Mar 2006 16:10:19 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User emellor@xxxxxxxxxxxxxxxxxxxxxx
# Node ID d77f0f6ebecea31e25c694ca049fd63c14af02f9
# Parent  045bee6e1ebd9c9c4cea8edf921cf33684066782
Protect cleanupDomain with the refresh_shutdown_lock.  This stops the device
and watch teardown being run concurrently from multiple threads, silencing
the No such file or directory error when tearing down the control/shutdown
watch, and reducing load on the store.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>

diff -r 045bee6e1ebd -r d77f0f6ebece tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Tue Mar 21 11:26:38 2006
+++ b/tools/python/xen/xend/XendDomainInfo.py   Tue Mar 21 11:41:33 2006
@@ -24,6 +24,7 @@
 
 """
 
+import errno
 import logging
 import string
 import time
@@ -893,7 +894,7 @@
                 self.domid, timeout)
             threading.Timer(timeout, self.refreshShutdown).start()
 
-        return 1
+        return True
 
 
     def shutdown(self, reason):
@@ -1246,30 +1247,34 @@
         """Cleanup domain resources; release devices.  Idempotent.  Nothrow
         guarantee."""
 
-        self.unwatchShutdown()
-
-        self.release_devices()
-
-        if self.image:
+        self.refresh_shutdown_lock.acquire()
+        try:
+            self.unwatchShutdown()
+
+            self.release_devices()
+
+            if self.image:
+                try:
+                    self.image.destroy()
+                except:
+                    log.exception(
+                        "XendDomainInfo.cleanup: image.destroy() failed.")
+                self.image = None
+
             try:
-                self.image.destroy()
+                self.removeDom()
             except:
-                log.exception(
-                    "XendDomainInfo.cleanup: image.destroy() failed.")
-            self.image = None
-
-        try:
-            self.removeDom()
-        except:
-            log.exception("Removing domain path failed.")
-
-        try:
-            if not self.info['name'].startswith(ZOMBIE_PREFIX):
-                self.info['name'] = ZOMBIE_PREFIX + self.info['name']
-        except:
-            log.exception("Renaming Zombie failed.")
-
-        self.state_set(STATE_DOM_SHUTDOWN)
+                log.exception("Removing domain path failed.")
+
+            try:
+                if not self.info['name'].startswith(ZOMBIE_PREFIX):
+                    self.info['name'] = ZOMBIE_PREFIX + self.info['name']
+            except:
+                log.exception("Renaming Zombie failed.")
+
+            self.state_set(STATE_DOM_SHUTDOWN)
+        finally:
+            self.refresh_shutdown_lock.release()
 
 
     def cleanupVm(self):
@@ -1301,7 +1306,8 @@
 
     def unwatchShutdown(self):
         """Remove the watch on the domain's control/shutdown node, if any.
-        Idempotent.  Nothrow guarantee."""
+        Idempotent.  Nothrow guarantee.  Expects to be protected by the
+        refresh_shutdown_lock."""
 
         try:
             try:

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Protect cleanupDomain with the refresh_shutdown_lock. This stops the device, Xen patchbot -unstable <=