From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=55246 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q4V4z-00040v-E1 for qemu-devel@nongnu.org; Tue, 29 Mar 2011 05:19:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q4V4y-0006Q2-6x for qemu-devel@nongnu.org; Tue, 29 Mar 2011 05:19:13 -0400 Received: from mail-px0-f174.google.com ([209.85.212.174]:60891) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q4V4y-0006Px-17 for qemu-devel@nongnu.org; Tue, 29 Mar 2011 05:19:12 -0400 Received: by pxi15 with SMTP id 15so865831pxi.33 for ; Tue, 29 Mar 2011 02:19:11 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <4D91A409.2070108@redhat.com> Date: Tue, 29 Mar 2011 11:19:05 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1299691270-16328-1-git-send-email-pbonzini@redhat.com> <4D870B5A.9050107@redhat.com> In-Reply-To: <4D870B5A.9050107@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 0/2] avoid races on exec migration List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Anthony Liguori , Juan Quintela On 03/21/2011 09:24 AM, Paolo Bonzini wrote: > On 03/09/2011 06:21 PM, Paolo Bonzini wrote: >> QEMU has a sigchld handler that reaps any child process. -smb is the >> only user of it and, in fact, QEMU inherited it from slirp. However, >> this handler causes 'exec' based migration to randomly return 'status: >> failed' in the monitor. This happens when the signal handler for SIGCHLD >> is ran before the pclose() of exec migration. >> >> The return status of fclose() is passed back as return status of >> qemu_fclose(). If qemu_fclose() fails, then the exec_close() in >> migration-exec.c returns a error code. This causes migrate_fd_cleanup() >> to return an error, and thus finally we see why 'status: failed' occurs: >> >> if (migrate_fd_cleanup(s)< 0) { >> if (old_vm_running) { >> vm_start(); >> } >> state = MIG_STATE_ERROR; >> } >> >> To avoid this, register the pids in a list and, on SIGCHLD, set up a >> bottom-half that would go through the pids and reap them. >> >> Since I'm at it, I'm moving iohandler stuff out of vl.c. The new >> file isn't a perfect place to add the child watcher, but it's arguably >> better than vl.c. >> >> This should be applied to both master and stable. >> >> Paolo Bonzini (2): >> extract I/O handler lists to iohandler.c >> add a service to reap zombies >> >> Makefile.objs | 2 +- >> iohandler.c | 193 >> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ >> os-posix.c | 9 --- >> qemu-common.h | 4 + >> slirp/misc.c | 5 +- >> vl.c | 106 ++------------------------------ >> 6 files changed, 207 insertions(+), 112 deletions(-) >> create mode 100644 iohandler.c >> > > Ping? Ping^2? Paolo