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

[Xen-changelog] [xen-unstable] xend: Fix file resouce leak on resume of suspended managed domains.



# HG changeset patch
# User Keir Fraser <keir@xxxxxxxxxxxxx>
# Date 1192195841 -3600
# Node ID 628f8ec692a0153af03a81b04f41b9edfcca7aad
# Parent  1c4203730ff673fc440f9d202e25a5a45a429aba
xend: 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@xxxxxxx>
---
 tools/python/xen/xend/XendDomain.py |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletion(-)

diff -r 1c4203730ff6 -r 628f8ec692a0 tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py       Fri Oct 12 13:06:16 2007 +0100
+++ b/tools/python/xen/xend/XendDomain.py       Fri Oct 12 14:30:41 2007 +0100
@@ -886,6 +886,7 @@ class XendDomain:
         self.domains_lock.acquire()
         try:
             try:
+                fd = None
                 dominfo = self.domain_lookup_nr(domname)
 
                 if not dominfo:
@@ -908,8 +909,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)
@@ -921,6 +923,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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
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®.