{"id":807569,"url":"http://patchwork.ozlabs.org/api/1.2/patches/807569/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20170830100605.22694-1-famz@redhat.com/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/1.2/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170830100605.22694-1-famz@redhat.com>","list_archive_url":null,"date":"2017-08-30T10:06:05","name":"block: Cleanup BMDS in bdrv_close_all","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"b57ec9d437e7cf71609feb9bb99f9b743444867f","submitter":{"id":24872,"url":"http://patchwork.ozlabs.org/api/1.2/people/24872/?format=json","name":"Fam Zheng","email":"famz@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20170830100605.22694-1-famz@redhat.com/mbox/","series":[{"id":575,"url":"http://patchwork.ozlabs.org/api/1.2/series/575/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=575","date":"2017-08-30T10:06:05","name":"block: Cleanup BMDS in bdrv_close_all","version":1,"mbox":"http://patchwork.ozlabs.org/series/575/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/807569/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/807569/checks/","tags":{},"related":[],"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx06.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx06.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=famz@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xj1QF3HPjz9t0F\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 30 Aug 2017 20:07:15 +1000 (AEST)","from localhost ([::1]:49436 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dmztv-0005nd-Iy\n\tfor incoming@patchwork.ozlabs.org; Wed, 30 Aug 2017 06:07:11 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:58287)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <famz@redhat.com>) id 1dmztQ-0005mk-8B\n\tfor qemu-devel@nongnu.org; Wed, 30 Aug 2017 06:06:41 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <famz@redhat.com>) id 1dmztM-00045V-H2\n\tfor qemu-devel@nongnu.org; Wed, 30 Aug 2017 06:06:40 -0400","from mx1.redhat.com ([209.132.183.28]:58766)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <famz@redhat.com>)\n\tid 1dmztA-0003zO-BG; Wed, 30 Aug 2017 06:06:24 -0400","from smtp.corp.redhat.com\n\t(int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 2ED03356F3;\n\tWed, 30 Aug 2017 10:06:23 +0000 (UTC)","from lemon.redhat.com (ovpn-12-48.pek2.redhat.com [10.72.12.48])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 5FA9E87CA5;\n\tWed, 30 Aug 2017 10:06:07 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 2ED03356F3","From":"Fam Zheng <famz@redhat.com>","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\n\t(mx1.redhat.com [10.5.110.30]);\n\tWed, 30 Aug 2017 10:06:23 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[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":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Kevin Wolf <kwolf@redhat.com>, Fam Zheng <famz@redhat.com>,\n\tqemu-block@nongnu.org, Juan Quintela <quintela@redhat.com>,\n\tqemu-stable@nongnu.org, peterx@redhat.com,\n\tMax Reitz <mreitz@redhat.com>, \n\t\"Dr. David Alan Gilbert\" <dgilbert@redhat.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"},"content":"This fixes the assertion due to op blockers added by BMDS:\n\nblock.c:3248: bdrv_delete: Assertion `bdrv_op_blocker_is_empty(bs)' failed.\n\nReproducer: simply start block migration and quit QEMU before it ends.\n\nCc: qemu-stable@nongnu.org\nSigned-off-by: Fam Zheng <famz@redhat.com>\n---\n block.c                 | 2 ++\n migration/block.c       | 2 +-\n migration/block.h       | 1 +\n stubs/Makefile.objs     | 1 +\n stubs/block-migration.c | 6 ++++++\n 5 files changed, 11 insertions(+), 1 deletion(-)\n create mode 100644 stubs/block-migration.c","diff":"diff --git a/block.c b/block.c\nindex 3308814bba..508a57274d 100644\n--- a/block.c\n+++ b/block.c\n@@ -43,6 +43,7 @@\n #include \"qemu/cutils.h\"\n #include \"qemu/id.h\"\n #include \"qapi/util.h\"\n+#include \"migration/block.h\"\n \n #ifdef CONFIG_BSD\n #include <sys/ioctl.h>\n@@ -3111,6 +3112,7 @@ static void bdrv_close(BlockDriverState *bs)\n \n void bdrv_close_all(void)\n {\n+    block_migration_cleanup_bmds();\n     block_job_cancel_sync_all();\n     nbd_export_close_all();\n \ndiff --git a/migration/block.c b/migration/block.c\nindex 9171f60028..c059e48484 100644\n--- a/migration/block.c\n+++ b/migration/block.c\n@@ -673,7 +673,7 @@ static int64_t get_remaining_dirty(void)\n \n \n /* Called with iothread lock taken.  */\n-static void block_migration_cleanup_bmds(void)\n+void block_migration_cleanup_bmds(void)\n {\n     BlkMigDevState *bmds;\n     AioContext *ctx;\ndiff --git a/migration/block.h b/migration/block.h\nindex 22ebe94259..8bae1cf55a 100644\n--- a/migration/block.h\n+++ b/migration/block.h\n@@ -42,4 +42,5 @@ static inline uint64_t blk_mig_bytes_total(void)\n #endif /* CONFIG_LIVE_BLOCK_MIGRATION */\n \n void migrate_set_block_enabled(bool value, Error **errp);\n+void block_migration_cleanup_bmds(void);\n #endif /* MIGRATION_BLOCK_H */\ndiff --git a/stubs/Makefile.objs b/stubs/Makefile.objs\nindex e69c217aff..7540913767 100644\n--- a/stubs/Makefile.objs\n+++ b/stubs/Makefile.objs\n@@ -19,6 +19,7 @@ stub-obj-y += is-daemonized.o\n stub-obj-$(CONFIG_LINUX_AIO) += linux-aio.o\n stub-obj-y += machine-init-done.o\n stub-obj-y += migr-blocker.o\n+stub-obj-y += block-migration.o\n stub-obj-y += change-state-handler.o\n stub-obj-y += monitor.o\n stub-obj-y += notify-event.o\ndiff --git a/stubs/block-migration.c b/stubs/block-migration.c\nnew file mode 100644\nindex 0000000000..855f15c757\n--- /dev/null\n+++ b/stubs/block-migration.c\n@@ -0,0 +1,6 @@\n+#include \"qemu/osdep.h\"\n+#include \"migration/block.h\"\n+\n+void block_migration_cleanup_bmds(void)\n+{\n+}\n","prefixes":[]}