From: Keir Fraser Date: Fri, 9 Jan 2009 10:04:24 +0000 (+0000) Subject: xend: Fix a ssl migration hang issue X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14014^2~85 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=a562362b254994095dafec4b5ded07d458cf19cd;p=xen.git xend: Fix a ssl migration hang issue When another VM is started by xend, the spawned qemu process will keep the p2cwrite file descriptor open. Thus there will be two open descriptors associated with the write end of the pipe. The read end of the pipe only sees EOF when the qemu process has terminated. Signed-off-by: Zhigang Wang --- diff --git a/tools/python/xen/util/oshelp.py b/tools/python/xen/util/oshelp.py index b5a0a2a371..3efc43d57f 100644 --- a/tools/python/xen/util/oshelp.py +++ b/tools/python/xen/util/oshelp.py @@ -5,7 +5,7 @@ def fcntl_setfd_cloexec(file, bool): f = fcntl.fcntl(file, fcntl.F_GETFD) if bool: f |= fcntl.FD_CLOEXEC else: f &= ~fcntl.FD_CLOEXEC - fcntl.fcntl(file, fcntl.F_SETFD) + fcntl.fcntl(file, fcntl.F_SETFD, f) def waitstatus_description(st): if os.WIFEXITED(st): diff --git a/tools/python/xen/xend/server/relocate.py b/tools/python/xen/xend/server/relocate.py index 007884b46a..6aa6f83d40 100644 --- a/tools/python/xen/xend/server/relocate.py +++ b/tools/python/xen/xend/server/relocate.py @@ -122,6 +122,8 @@ class RelocationProtocol(protocol.Protocol): if self.transport: self.send_reply(["ready", name]) p2cread, p2cwrite = os.pipe() + from xen.util import oshelp + oshelp.fcntl_setfd_cloexec(p2cwrite, True) threading.Thread(target=connection.SSLSocketServerConnection.recv2fd, args=(self.transport.sock, p2cwrite)).start() try: