From nobody Mon Feb 9 04:21:45 2026 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 150408766790523.002108720392357; Wed, 30 Aug 2017 03:07:47 -0700 (PDT) Received: from localhost ([::1]:49438 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dmzuS-0006AU-Fy for importer@patchew.org; Wed, 30 Aug 2017 06:07:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58287) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dmztQ-0005mk-8B for qemu-devel@nongnu.org; Wed, 30 Aug 2017 06:06:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dmztM-00045V-H2 for qemu-devel@nongnu.org; Wed, 30 Aug 2017 06:06:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58766) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dmztA-0003zO-BG; Wed, 30 Aug 2017 06:06:24 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2ED03356F3; Wed, 30 Aug 2017 10:06:23 +0000 (UTC) Received: from lemon.redhat.com (ovpn-12-48.pek2.redhat.com [10.72.12.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5FA9E87CA5; Wed, 30 Aug 2017 10:06:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2ED03356F3 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=famz@redhat.com From: Fam Zheng To: qemu-devel@nongnu.org Date: Wed, 30 Aug 2017 18:06:05 +0800 Message-Id: <20170830100605.22694-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 30 Aug 2017 10:06:23 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] block: Cleanup BMDS in bdrv_close_all 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: , Cc: Kevin Wolf , Fam Zheng , qemu-block@nongnu.org, Juan Quintela , qemu-stable@nongnu.org, peterx@redhat.com, Max Reitz , "Dr. David Alan Gilbert" 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" This fixes the assertion due to op blockers added by BMDS: block.c:3248: bdrv_delete: Assertion `bdrv_op_blocker_is_empty(bs)' failed. Reproducer: simply start block migration and quit QEMU before it ends. Cc: qemu-stable@nongnu.org Signed-off-by: Fam Zheng Reviewed-by: Juan Quintela --- block.c | 2 ++ migration/block.c | 2 +- migration/block.h | 1 + stubs/Makefile.objs | 1 + stubs/block-migration.c | 6 ++++++ 5 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 stubs/block-migration.c diff --git a/block.c b/block.c index 3308814bba..508a57274d 100644 --- a/block.c +++ b/block.c @@ -43,6 +43,7 @@ #include "qemu/cutils.h" #include "qemu/id.h" #include "qapi/util.h" +#include "migration/block.h" =20 #ifdef CONFIG_BSD #include @@ -3111,6 +3112,7 @@ static void bdrv_close(BlockDriverState *bs) =20 void bdrv_close_all(void) { + block_migration_cleanup_bmds(); block_job_cancel_sync_all(); nbd_export_close_all(); =20 diff --git a/migration/block.c b/migration/block.c index 9171f60028..c059e48484 100644 --- a/migration/block.c +++ b/migration/block.c @@ -673,7 +673,7 @@ static int64_t get_remaining_dirty(void) =20 =20 /* Called with iothread lock taken. */ -static void block_migration_cleanup_bmds(void) +void block_migration_cleanup_bmds(void) { BlkMigDevState *bmds; AioContext *ctx; diff --git a/migration/block.h b/migration/block.h index 22ebe94259..8bae1cf55a 100644 --- a/migration/block.h +++ b/migration/block.h @@ -42,4 +42,5 @@ static inline uint64_t blk_mig_bytes_total(void) #endif /* CONFIG_LIVE_BLOCK_MIGRATION */ =20 void migrate_set_block_enabled(bool value, Error **errp); +void block_migration_cleanup_bmds(void); #endif /* MIGRATION_BLOCK_H */ diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs index e69c217aff..7540913767 100644 --- a/stubs/Makefile.objs +++ b/stubs/Makefile.objs @@ -19,6 +19,7 @@ stub-obj-y +=3D is-daemonized.o stub-obj-$(CONFIG_LINUX_AIO) +=3D linux-aio.o stub-obj-y +=3D machine-init-done.o stub-obj-y +=3D migr-blocker.o +stub-obj-y +=3D block-migration.o stub-obj-y +=3D change-state-handler.o stub-obj-y +=3D monitor.o stub-obj-y +=3D notify-event.o diff --git a/stubs/block-migration.c b/stubs/block-migration.c new file mode 100644 index 0000000000..855f15c757 --- /dev/null +++ b/stubs/block-migration.c @@ -0,0 +1,6 @@ +#include "qemu/osdep.h" +#include "migration/block.h" + +void block_migration_cleanup_bmds(void) +{ +} --=20 2.13.5