From nobody Sat May 4 18:07:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1522332042116173.21142481847642; Thu, 29 Mar 2018 07:00:42 -0700 (PDT) Received: from localhost ([::1]:55086 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f1Y6Y-000530-U1 for importer@patchew.org; Thu, 29 Mar 2018 10:00:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42808) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f1Y3l-0002um-Jx for qemu-devel@nongnu.org; Thu, 29 Mar 2018 09:57:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f1Y3g-0008N9-OU for qemu-devel@nongnu.org; Thu, 29 Mar 2018 09:57:45 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:47558 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f1Y3g-0008Mq-Ka for qemu-devel@nongnu.org; Thu, 29 Mar 2018 09:57:40 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A0F511599FD for ; Thu, 29 Mar 2018 13:57:37 +0000 (UTC) Received: from dgilbert-t530.redhat.com (ovpn-117-104.ams2.redhat.com [10.36.117.104]) by smtp.corp.redhat.com (Postfix) with ESMTP id F041E10B2B44; Thu, 29 Mar 2018 13:57:36 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, marcandre.lureau@redhat.com, quintela@redhat.com Date: Thu, 29 Mar 2018 14:57:29 +0100 Message-Id: <20180329135730.95774-2-dgilbert@redhat.com> In-Reply-To: <20180329135730.95774-1-dgilbert@redhat.com> References: <20180329135730.95774-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Thu, 29 Mar 2018 13:57:37 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Thu, 29 Mar 2018 13:57:37 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'dgilbert@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 1/2] migration: fix pfd leak X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau Fix leak spotted by ASAN: Direct leak of 16 byte(s) in 1 object(s) allocated from: #0 0x7fe1abb80a38 in __interceptor_calloc (/lib64/libasan.so.4+0xdea38) #1 0x7fe1aaf1bf75 in g_malloc0 ../glib/gmem.c:124 #2 0x7fe1aaf1c249 in g_malloc0_n ../glib/gmem.c:355 #3 0x55f4841cfaa9 in postcopy_ram_fault_thread /home/elmarco/src/qemu/m= igration/postcopy-ram.c:596 #4 0x55f48479447b in qemu_thread_start /home/elmarco/src/qemu/util/qemu= -thread-posix.c:504 #5 0x7fe1a043550a in start_thread (/lib64/libpthread.so.0+0x750a) Regression introduced with commit 00fa4fc85b00f1a8a810068d158a7a66e88658eb. Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20180321113644.21899-1-marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Peter Xu Signed-off-by: Dr. David Alan Gilbert --- migration/postcopy-ram.c | 1 + 1 file changed, 1 insertion(+) diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index efd77939af..4a0b33b373 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -754,6 +754,7 @@ static void *postcopy_ram_fault_thread(void *opaque) } } trace_postcopy_ram_fault_thread_exit(); + g_free(pfd); return NULL; } =20 --=20 2.14.3 From nobody Sat May 4 18:07:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1522331974695211.58869237624185; Thu, 29 Mar 2018 06:59:34 -0700 (PDT) Received: from localhost ([::1]:54962 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f1Y53-0003kD-Eq for importer@patchew.org; Thu, 29 Mar 2018 09:59:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42809) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f1Y3l-0002un-K1 for qemu-devel@nongnu.org; Thu, 29 Mar 2018 09:57:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f1Y3g-0008NH-Og for qemu-devel@nongnu.org; Thu, 29 Mar 2018 09:57:45 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:35364 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f1Y3g-0008Ms-K7 for qemu-devel@nongnu.org; Thu, 29 Mar 2018 09:57:40 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8DA32402314E for ; Thu, 29 Mar 2018 13:57:38 +0000 (UTC) Received: from dgilbert-t530.redhat.com (ovpn-117-104.ams2.redhat.com [10.36.117.104]) by smtp.corp.redhat.com (Postfix) with ESMTP id DBB0A10B2B44; Thu, 29 Mar 2018 13:57:37 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, marcandre.lureau@redhat.com, quintela@redhat.com Date: Thu, 29 Mar 2018 14:57:30 +0100 Message-Id: <20180329135730.95774-3-dgilbert@redhat.com> In-Reply-To: <20180329135730.95774-1-dgilbert@redhat.com> References: <20180329135730.95774-1-dgilbert@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Thu, 29 Mar 2018 13:57:38 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Thu, 29 Mar 2018 13:57:38 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'dgilbert@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 2/2] migration: Don't activate block devices if using -S X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Dr. David Alan Gilbert" Activating the block devices causes the locks to be taken on the backing file. If we're running with -S and the destination libvirt hasn't started the destination with 'cont', it's expecting the locks are still untaken. Don't activate the block devices if we're not going to autostart the VM; 'cont' already will do that anyway. bz: https://bugzilla.redhat.com/show_bug.cgi?id=3D1560854 Signed-off-by: Dr. David Alan Gilbert Message-Id: <20180328170207.49512-1-dgilbert@redhat.com> Reviewed-by: Eric Blake Signed-off-by: Dr. David Alan Gilbert --- migration/migration.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 52a5092add..58bd382730 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -306,13 +306,21 @@ static void process_incoming_migration_bh(void *opaqu= e) Error *local_err =3D NULL; MigrationIncomingState *mis =3D opaque; =20 - /* Make sure all file formats flush their mutable metadata. - * If we get an error here, just don't restart the VM yet. */ - bdrv_invalidate_cache_all(&local_err); - if (local_err) { - error_report_err(local_err); - local_err =3D NULL; - autostart =3D false; + /* Only fire up the block code now if we're going to restart the + * VM, else 'cont' will do it. + * This causes file locking to happen; so we don't want it to happen + * unless we really are starting the VM. + */ + if (autostart && (!global_state_received() || + global_state_get_runstate() =3D=3D RUN_STATE_RUNNING)) { + /* Make sure all file formats flush their mutable metadata. + * If we get an error here, just don't restart the VM yet. */ + bdrv_invalidate_cache_all(&local_err); + if (local_err) { + error_report_err(local_err); + local_err =3D NULL; + autostart =3D false; + } } =20 /* --=20 2.14.3