Received: from eggs.gnu.org ([2001:4830:134:3::10]:56787) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVONt-00059l-Au for qemu-devel@nongnu.org; Mon, 15 Feb 2016 14:00:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aVONo-00070P-5K for qemu-devel@nongnu.org; Mon, 15 Feb 2016 14:00:33 -0500 Received: from mail-wm0-x22e.google.com ([2a00:1450:400c:c09::22e]:35678) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVONn-00070D-UP for qemu-devel@nongnu.org; Mon, 15 Feb 2016 14:00:28 -0500 Received: by mail-wm0-x22e.google.com with SMTP id c200so127203711wme.0 for ; Mon, 15 Feb 2016 11:00:27 -0800 (PST) Sender: Paolo Bonzini From: Paolo Bonzini Date: Mon, 15 Feb 2016 20:00:23 +0100 Message-Id: <1455562823-31250-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH] migration: fix incorrect memory_global_dirty_log_start outside BQL List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Dave Gilbert , Stefan Hajnoczi This can cause various segmentation faults or aborts in qemu-iotests test 091. Fixes: 5b82b703b69acc67b78b98a5efc897a3912719eb Cc: Dave Gilbert Cc: Stefan Hajnoczi Signed-off-by: Paolo Bonzini --- migration/ram.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/migration/ram.c b/migration/ram.c index 96c749f..704f6a9 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1920,6 +1920,9 @@ static int ram_save_setup(QEMUFile *f, void *opaque) acct_clear(); } + /* For memory_global_dirty_log_start below. */ + qemu_mutex_lock_iothread(); + qemu_mutex_lock_ramlist(); rcu_read_lock(); bytes_transferred = 0; @@ -1944,6 +1947,7 @@ static int ram_save_setup(QEMUFile *f, void *opaque) memory_global_dirty_log_start(); migration_bitmap_sync(); qemu_mutex_unlock_ramlist(); + qemu_mutex_unlock_iothread(); qemu_put_be64(f, ram_bytes_total() | RAM_SAVE_FLAG_MEM_SIZE); -- 2.5.0