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

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



# HG changeset patch
# User Keir Fraser <keir@xxxxxxxxxxxxx>
# Date 1192195841 -3600
# Node ID 22b20c9f0f65c1dbe824b7aa2433d2ef872bf859
# Parent  3a5f2601ac57a89a77f41d1c5855a6fee624465f
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>
xen-unstable changeset:   16106:628f8ec692a0153af03a81b04f41b9edfcca7aad
xen-unstable date:        Fri Oct 12 14:30:41 2007 +0100
---
 tools/python/xen/xend/XendDomain.py |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletion(-)

diff -r 3a5f2601ac57 -r 22b20c9f0f65 tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py       Thu Oct 11 19:23:40 2007 +0100
+++ b/tools/python/xen/xend/XendDomain.py       Fri Oct 12 14:30:41 2007 +0100
@@ -864,6 +864,7 @@ class XendDomain:
         self.domains_lock.acquire()
         try:
             try:
+                fd = None
                 dominfo = self.domain_lookup_nr(domname)
 
                 if not dominfo:
@@ -886,8 +887,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)
@@ -899,6 +901,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®.