john.levon@sun.com
2007-Oct-12 13:27 UTC
[Xen-devel] [PATCH] Fix file resouce leak on resume of suspended managed domains
# HG changeset patch # User john.levon@sun.com # Date 1192195547 25200 # Node ID 53138c4401b249907c7b29bb5a2eeeabfa8c9b8d # Parent 2d3217b3425dd8516468581863461c573b6361ae Fix file resouce leak on resume of suspended managed domains When a suspended managed domain is resumed, the checkpoint file is removed, but xend retains a reference to the removed file. This represents a resource leak. Fixed by ensuring that the file reference is closed correctly. Signed-off-by: Gary Pennington <gary.pennington@sun.com> diff --git a/tools/python/xen/xend/XendDomain.py b/tools/python/xen/xend/XendDomain.py --- a/tools/python/xen/xend/XendDomain.py +++ b/tools/python/xen/xend/XendDomain.py @@ -903,6 +903,7 @@ class XendDomain: self.domains_lock.acquire() try: try: + fd = None dominfo = self.domain_lookup_nr(domname) if not dominfo: @@ -925,8 +926,9 @@ class XendDomain: oflags = os.O_RDONLY if hasattr(os, "O_LARGEFILE"): oflags |= os.O_LARGEFILE + fd = os.open(chkpath, oflags) XendCheckpoint.restore(self, - os.open(chkpath, oflags), + fd, dominfo, paused = start_paused) os.unlink(chkpath) @@ -938,6 +940,8 @@ class XendDomain: log.exception("Exception occurred when resuming") raise XendError("Error occurred when resuming: %s" % str(ex)) finally: + if fd is not None: + os.close(fd) self.domains_lock.release() _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel