diff -r c3f280acf41a tools/ioemu/block-raw.c --- a/tools/ioemu/block-raw.c Mon Jun 18 16:59:06 2007 +0100 +++ b/tools/ioemu/block-raw.c Wed Jun 20 12:53:21 2007 +0800 @@ -166,7 +166,7 @@ typedef struct RawAIOCB { struct RawAIOCB *next; } RawAIOCB; -static int aio_sig_num = SIGUSR2; +int aio_sig_num = SIGUSR2; static RawAIOCB *first_aio; /* AIO issued */ static int aio_initialized = 0; diff -r c3f280acf41a tools/ioemu/vl.c --- a/tools/ioemu/vl.c Mon Jun 18 16:59:06 2007 +0100 +++ b/tools/ioemu/vl.c Wed Jun 20 13:55:26 2007 +0800 @@ -7059,6 +7059,19 @@ int main(int argc, char **argv) #endif char qemu_dm_logfilename[128]; + + /* The Qemu we're using is actually multi-threaded! this code block + ensures the SIGUSR2 is blocked by default when a new thread is + created, then only the threads that use the signal unblock it -- this + fixes a race condition in Qcow. */ + { + extern int aio_sig_num; + sigset_t set; + + sigemptyset(&set); + sigaddset(&set, aio_sig_num); + sigprocmask(SIG_BLOCK, &set, NULL); + } LIST_INIT (&vm_change_state_head); #ifndef _WIN32