From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MvWTT-0003vv-Ur for qemu-devel@nongnu.org; Wed, 07 Oct 2009 09:22:36 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MvWTO-0003sK-GH for qemu-devel@nongnu.org; Wed, 07 Oct 2009 09:22:34 -0400 Received: from [199.232.76.173] (port=40306 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MvWTN-0003sA-4w for qemu-devel@nongnu.org; Wed, 07 Oct 2009 09:22:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:5637) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MvWTM-0003B9-Er for qemu-devel@nongnu.org; Wed, 07 Oct 2009 09:22:28 -0400 Date: Wed, 7 Oct 2009 15:20:06 +0200 From: "Michael S. Tsirkin" Message-ID: <20091007132006.GA9668@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [PATCH] Revert "posix-aio-compat: avoid signal race when spawning a thread" List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: malc , qemu-devel@nongnu.org, anthony@codemonkey.ws This reverts commit ee3993069ff55fa6f1c64daf1e09963e340db8e4. With commit ee3993069ff55fa6f1c64daf1e09963e340db8e4, winxp installation on a raw format file fails during disk format, with a message "your disk may be damaged". Signed-off-by: Michael S. Tsirkin Cc: malc --- malc, care to describe what the problem you are solving here is? All, could everyone please start being nice and post patches and give time for review before applying? Thanks! posix-aio-compat.c | 14 +++++--------- 1 files changed, 5 insertions(+), 9 deletions(-) diff --git a/posix-aio-compat.c b/posix-aio-compat.c index 400d898..68cbec8 100644 --- a/posix-aio-compat.c +++ b/posix-aio-compat.c @@ -301,9 +301,14 @@ static size_t handle_aiocb_rw(struct qemu_paiocb *aiocb) static void *aio_thread(void *unused) { pid_t pid; + sigset_t set; pid = getpid(); + /* block all signals */ + if (sigfillset(&set)) die("sigfillset"); + if (sigprocmask(SIG_BLOCK, &set, NULL)) die("sigprocmask"); + while (1) { struct qemu_paiocb *aiocb; size_t ret = 0; @@ -364,18 +369,9 @@ static void *aio_thread(void *unused) static void spawn_thread(void) { - sigset_t set, oldset; - cur_threads++; idle_threads++; - - /* block all signals */ - if (sigfillset(&set)) die("sigfillset"); - if (sigprocmask(SIG_SETMASK, &set, &oldset)) die("sigprocmask"); - thread_create(&thread_id, &attr, aio_thread, NULL); - - if (sigprocmask(SIG_SETMASK, &oldset, NULL)) die("sigprocmask restore"); } static void qemu_paio_submit(struct qemu_paiocb *aiocb) -- 1.6.5.rc2