mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
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@xensource.com>
This commit is contained in:
1 parent
7555524dd7
commit
1de73a0df0
1 file changed
+26
-20
@@ -24,6 +24,7 @@ Author: Mike Wray <mike.wray@hp.com>
|
||||
|
||||
"""
|
||||
|
||||
import errno
|
||||
import logging
|
||||
import string
|
||||
import time
|
||||
@@ -893,7 +894,7 @@ class XendDomainInfo:
|
||||
self.domid, timeout)
|
||||
threading.Timer(timeout, self.refreshShutdown).start()
|
||||
|
||||
return 1
|
||||
return True
|
||||
|
||||
|
||||
def shutdown(self, reason):
|
||||
@@ -1246,30 +1247,34 @@ class XendDomainInfo:
|
||||
"""Cleanup domain resources; release devices. Idempotent. Nothrow
|
||||
guarantee."""
|
||||
|
||||
self.unwatchShutdown()
|
||||
self.refresh_shutdown_lock.acquire()
|
||||
try:
|
||||
self.unwatchShutdown()
|
||||
|
||||
self.release_devices()
|
||||
self.release_devices()
|
||||
|
||||
if self.image:
|
||||
try:
|
||||
self.image.destroy()
|
||||
except:
|
||||
log.exception(
|
||||
"XendDomainInfo.cleanup: image.destroy() failed.")
|
||||
self.image = None
|
||||
|
||||
if self.image:
|
||||
try:
|
||||
self.image.destroy()
|
||||
self.removeDom()
|
||||
except:
|
||||
log.exception(
|
||||
"XendDomainInfo.cleanup: image.destroy() failed.")
|
||||
self.image = None
|
||||
log.exception("Removing domain path failed.")
|
||||
|
||||
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.")
|
||||
|
||||
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)
|
||||
self.state_set(STATE_DOM_SHUTDOWN)
|
||||
finally:
|
||||
self.refresh_shutdown_lock.release()
|
||||
|
||||
|
||||
def cleanupVm(self):
|
||||
@@ -1301,7 +1306,8 @@ class XendDomainInfo:
|
||||
|
||||
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:
|
||||
|
||||