From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=51147 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PaPYg-0000eE-R5 for qemu-devel@nongnu.org; Wed, 05 Jan 2011 04:21:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PaPYf-0002Ra-JP for qemu-devel@nongnu.org; Wed, 05 Jan 2011 04:21:30 -0500 Received: from mail-gw0-f45.google.com ([74.125.83.45]:61658) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PaPYf-0002RT-Dd for qemu-devel@nongnu.org; Wed, 05 Jan 2011 04:21:29 -0500 Received: by gwj23 with SMTP id 23so7545935gwj.4 for ; Wed, 05 Jan 2011 01:21:28 -0800 (PST) Sender: Paolo Bonzini Message-ID: <4D24382E.8080903@redhat.com> Date: Wed, 05 Jan 2011 10:21:50 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <4D005006.9080307@cn.fujitsu.com> <4D07378B.3050901@cn.fujitsu.com> <4D0EB06D.6060001@cn.fujitsu.com> <29897010-A575-4C94-8016-C0FC03652B64@web.de> <4D102795.9040107@cn.fujitsu.com> In-Reply-To: <4D102795.9040107@cn.fujitsu.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH v2] disable sigcld handling before calling pclose() List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wen Congyang Cc: =?ISO-8859-1?Q?Andreas_F=E4rber?= , qemu-devel , Luiz Capitulino On 12/21/2010 05:05 AM, Wen Congyang wrote: > When I use the command 'virsh save' to save the domain state, > I receive the following error message: > operation failed: Migration unexpectedly failed. > > I debug the qemu by adding some printf(), and find the function > pclose() returns -1. > > I use strace to trace qemu, the log is as the following: > ====== > close(17) = 0 > --- SIGCHLD (Child exited) @ 0 (0) --- > wait4(-1, NULL, WNOHANG, NULL) = 22016 > rt_sigreturn(0) = 0 > wait4(22016, 0x7fff7f1034fc, 0, NULL) = -1 ECHILD (No child processes) > ====== > > We wait the child twice: one is in signal SIGCHLD handling and the other > one is in pclose(). > > We should disable sigcld handling before calling pclose(). I wondered whether we need SIGCHLD handling at all. fork is called only from: - xen_domain_watcher in hw/xen_domainbuild.c - launch_script in net/tap.c - SLIRP's fork_exec ("mini inetd") For the first, the child will always "outlive" the parent. For the second, we do waitpid in the function. So SLIRP is the only real user of the SIGCHLD handler and in fact this: http://www.google.com/codesearch/p?hl=en#tGk9u3ZS0cw/pub/Linux/system/network/serial/slirp-1.0.9.tar.gz|s3yKHVXI6eg/slirp-1.0.9/src/main.c suggests that the handler came from there (search for do_wait). Would anybody object to removing the support for Samba under SLIRP and all the resulting cruft? Paolo