From nobody Wed May 1 20:57:17 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.zoho.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 1493916900713780.4018814532739; Thu, 4 May 2017 09:55:00 -0700 (PDT) Received: from localhost ([::1]:43073 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6K1r-0000xR-7T for importer@patchew.org; Thu, 04 May 2017 12:54:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56072) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6Jzu-000895-4i for qemu-devel@nongnu.org; Thu, 04 May 2017 12:52:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d6Jzt-0003nC-14 for qemu-devel@nongnu.org; Thu, 04 May 2017 12:52:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45574) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d6Jzp-0003lx-VX; Thu, 04 May 2017 12:52:54 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C2794804EF; Thu, 4 May 2017 16:52:52 +0000 (UTC) Received: from noname.redhat.com (ovpn-117-230.ams2.redhat.com [10.36.117.230]) by smtp.corp.redhat.com (Postfix) with ESMTP id 64C8E1715B; Thu, 4 May 2017 16:52:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C2794804EF Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kwolf@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com C2794804EF From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 4 May 2017 18:52:36 +0200 Message-Id: <1493916761-32319-2-git-send-email-kwolf@redhat.com> In-Reply-To: <1493916761-32319-1-git-send-email-kwolf@redhat.com> References: <1493916761-32319-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 04 May 2017 16:52:52 +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 1/6] migration: Unify block node activation error handling 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: kwolf@redhat.com, famz@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com 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" Migration code activates all block driver nodes on the destination when the migration completes. It does so by calling bdrv_invalidate_cache_all() and blk_resume_after_migration(). There is one code path for precopy and one for postcopy migration, resulting in four function calls, which used to have three different failure modes. This patch unifies the behaviour so that failure to activate all block nodes is non-fatal, but the error message is logged and the VM isn't automatically started. 'cont' will retry activating the block nodes. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- migration/migration.c | 16 +++++----------- migration/savevm.c | 12 +++++------- qmp.c | 18 +++++++++--------- 3 files changed, 19 insertions(+), 27 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 353f272..7cb0af2 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -338,20 +338,14 @@ 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 */ + /* 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) { - migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE, - MIGRATION_STATUS_FAILED); - error_report_err(local_err); - migrate_decompress_threads_join(); - exit(EXIT_FAILURE); + if (!local_err) { + blk_resume_after_migration(&local_err); } - - /* If we get an error here, just don't restart the VM yet. */ - blk_resume_after_migration(&local_err); if (local_err) { - error_free(local_err); + error_report_err(local_err); local_err =3D NULL; autostart =3D false; } diff --git a/migration/savevm.c b/migration/savevm.c index a00c1ab..0004f43 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1616,16 +1616,14 @@ static void loadvm_postcopy_handle_run_bh(void *opa= que) =20 qemu_announce_self(); =20 - /* Make sure all file formats flush their mutable metadata */ + /* 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); + if (!local_err) { + blk_resume_after_migration(&local_err); } - - /* If we get an error here, just don't restart the VM yet. */ - blk_resume_after_migration(&local_err); if (local_err) { - error_free(local_err); + error_report_err(local_err); local_err =3D NULL; autostart =3D false; } diff --git a/qmp.c b/qmp.c index ab74cd7..25b5050 100644 --- a/qmp.c +++ b/qmp.c @@ -196,15 +196,15 @@ void qmp_cont(Error **errp) } =20 /* Continuing after completed migration. Images have been inactivated = to - * allow the destination to take control. Need to get control back now= . */ - if (runstate_check(RUN_STATE_FINISH_MIGRATE) || - runstate_check(RUN_STATE_POSTMIGRATE)) - { - bdrv_invalidate_cache_all(&local_err); - if (local_err) { - error_propagate(errp, local_err); - return; - } + * allow the destination to take control. Need to get control back now. + * + * If there are no inactive block nodes (e.g. because the VM was just + * paused rather than completing a migration), bdrv_inactivate_all() s= imply + * doesn't do anything. */ + bdrv_invalidate_cache_all(&local_err); + if (local_err) { + error_propagate(errp, local_err); + return; } =20 blk_resume_after_migration(&local_err); --=20 1.8.3.1 From nobody Wed May 1 20:57:17 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.zoho.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 1493916903899692.6556681760981; Thu, 4 May 2017 09:55:03 -0700 (PDT) Received: from localhost ([::1]:43074 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6K1u-00010v-Fn for importer@patchew.org; Thu, 04 May 2017 12:55:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56105) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6Jzw-0008Aj-3U for qemu-devel@nongnu.org; Thu, 04 May 2017 12:53:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d6Jzu-0003o3-UY for qemu-devel@nongnu.org; Thu, 04 May 2017 12:53:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37236) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d6Jzr-0003mE-Id; Thu, 04 May 2017 12:52:55 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 770197F3E1; Thu, 4 May 2017 16:52:54 +0000 (UTC) Received: from noname.redhat.com (ovpn-117-230.ams2.redhat.com [10.36.117.230]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1AB6B1715B; Thu, 4 May 2017 16:52:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 770197F3E1 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kwolf@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 770197F3E1 From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 4 May 2017 18:52:37 +0200 Message-Id: <1493916761-32319-3-git-send-email-kwolf@redhat.com> In-Reply-To: <1493916761-32319-1-git-send-email-kwolf@redhat.com> References: <1493916761-32319-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 04 May 2017 16:52:54 +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 2/6] block: New BdrvChildRole.activate() for blk_resume_after_migration() 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: kwolf@redhat.com, famz@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com 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" Instead of manually calling blk_resume_after_migration() in migration code after doing bdrv_invalidate_cache_all(), integrate the BlockBackend activation with cache invalidation into a single function. This is achieved with a new callback in BdrvChildRole that is called by bdrv_invalidate_cache_all(). Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- block.c | 12 +++++++++- block/block-backend.c | 56 +++++++++++++++++++++++--------------------= ---- include/block/block.h | 2 -- include/block/block_int.h | 5 +++++ migration/migration.c | 3 --- migration/savevm.c | 3 --- qmp.c | 6 ----- 7 files changed, 44 insertions(+), 43 deletions(-) diff --git a/block.c b/block.c index 70ca7b4..3e7f124 100644 --- a/block.c +++ b/block.c @@ -3958,7 +3958,7 @@ void bdrv_init_with_whitelist(void) =20 void bdrv_invalidate_cache(BlockDriverState *bs, Error **errp) { - BdrvChild *child; + BdrvChild *child, *parent; Error *local_err =3D NULL; int ret; =20 @@ -3994,6 +3994,16 @@ void bdrv_invalidate_cache(BlockDriverState *bs, Err= or **errp) error_setg_errno(errp, -ret, "Could not refresh total sector count= "); return; } + + QLIST_FOREACH(parent, &bs->parents, next_parent) { + if (parent->role->activate) { + parent->role->activate(parent, &local_err); + if (local_err) { + error_propagate(errp, local_err); + return; + } + } + } } =20 void bdrv_invalidate_cache_all(Error **errp) diff --git a/block/block-backend.c b/block/block-backend.c index f5bf13e..a7ce72b 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -130,6 +130,32 @@ static const char *blk_root_get_name(BdrvChild *child) return blk_name(child->opaque); } =20 +/* + * Notifies the user of the BlockBackend that migration has completed. qdev + * devices can tighten their permissions in response (specifically revoke + * shared write permissions that we needed for storage migration). + * + * If an error is returned, the VM cannot be allowed to be resumed. + */ +static void blk_root_activate(BdrvChild *child, Error **errp) +{ + BlockBackend *blk =3D child->opaque; + Error *local_err =3D NULL; + + if (!blk->disable_perm) { + return; + } + + blk->disable_perm =3D false; + + blk_set_perm(blk, blk->perm, blk->shared_perm, &local_err); + if (local_err) { + error_propagate(errp, local_err); + blk->disable_perm =3D true; + return; + } +} + static const BdrvChildRole child_root =3D { .inherit_options =3D blk_root_inherit_options, =20 @@ -140,6 +166,8 @@ static const BdrvChildRole child_root =3D { =20 .drained_begin =3D blk_root_drained_begin, .drained_end =3D blk_root_drained_end, + + .activate =3D blk_root_activate, }; =20 /* @@ -601,34 +629,6 @@ void blk_get_perm(BlockBackend *blk, uint64_t *perm, u= int64_t *shared_perm) *shared_perm =3D blk->shared_perm; } =20 -/* - * Notifies the user of all BlockBackends that migration has completed. qd= ev - * devices can tighten their permissions in response (specifically revoke - * shared write permissions that we needed for storage migration). - * - * If an error is returned, the VM cannot be allowed to be resumed. - */ -void blk_resume_after_migration(Error **errp) -{ - BlockBackend *blk; - Error *local_err =3D NULL; - - for (blk =3D blk_all_next(NULL); blk; blk =3D blk_all_next(blk)) { - if (!blk->disable_perm) { - continue; - } - - blk->disable_perm =3D false; - - blk_set_perm(blk, blk->perm, blk->shared_perm, &local_err); - if (local_err) { - error_propagate(errp, local_err); - blk->disable_perm =3D true; - return; - } - } -} - static int blk_do_attach_dev(BlockBackend *blk, void *dev) { if (blk->dev) { diff --git a/include/block/block.h b/include/block/block.h index 877fbb0..80d51d8 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -369,8 +369,6 @@ void bdrv_invalidate_cache(BlockDriverState *bs, Error = **errp); void bdrv_invalidate_cache_all(Error **errp); int bdrv_inactivate_all(void); =20 -void blk_resume_after_migration(Error **errp); - /* Ensure contents are flushed to disk. */ int bdrv_flush(BlockDriverState *bs); int coroutine_fn bdrv_co_flush(BlockDriverState *bs); diff --git a/include/block/block_int.h b/include/block/block_int.h index 1b4d08e..5637925 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -473,6 +473,11 @@ struct BdrvChildRole { void (*drained_begin)(BdrvChild *child); void (*drained_end)(BdrvChild *child); =20 + /* Notifies the parent that the child has been activated (e.g. when + * migration is completing) and it can start requesting permissions and + * doing I/O on it. */ + void (*activate)(BdrvChild *child, Error **errp); + void (*attach)(BdrvChild *child); void (*detach)(BdrvChild *child); }; diff --git a/migration/migration.c b/migration/migration.c index 7cb0af2..0d230f4 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -341,9 +341,6 @@ static void process_incoming_migration_bh(void *opaque) /* 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) { - blk_resume_after_migration(&local_err); - } if (local_err) { error_report_err(local_err); local_err =3D NULL; diff --git a/migration/savevm.c b/migration/savevm.c index 0004f43..5689615 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1619,9 +1619,6 @@ static void loadvm_postcopy_handle_run_bh(void *opaqu= e) /* 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) { - blk_resume_after_migration(&local_err); - } if (local_err) { error_report_err(local_err); local_err =3D NULL; diff --git a/qmp.c b/qmp.c index 25b5050..f656940 100644 --- a/qmp.c +++ b/qmp.c @@ -207,12 +207,6 @@ void qmp_cont(Error **errp) return; } =20 - blk_resume_after_migration(&local_err); - if (local_err) { - error_propagate(errp, local_err); - return; - } - if (runstate_check(RUN_STATE_INMIGRATE)) { autostart =3D 1; } else { --=20 1.8.3.1 From nobody Wed May 1 20:57:17 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.zoho.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 14939170383765.622992246322042; Thu, 4 May 2017 09:57:18 -0700 (PDT) Received: from localhost ([::1]:43088 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6K45-0002sP-0q for importer@patchew.org; Thu, 04 May 2017 12:57:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56120) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6Jzw-0008BH-PS for qemu-devel@nongnu.org; Thu, 04 May 2017 12:53:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d6Jzv-0003ot-Qy for qemu-devel@nongnu.org; Thu, 04 May 2017 12:53:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37250) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d6Jzt-0003mx-C6; Thu, 04 May 2017 12:52:57 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4300B7F3E1; Thu, 4 May 2017 16:52:56 +0000 (UTC) Received: from noname.redhat.com (ovpn-117-230.ams2.redhat.com [10.36.117.230]) by smtp.corp.redhat.com (Postfix) with ESMTP id C3E2C1715B; Thu, 4 May 2017 16:52:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4300B7F3E1 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kwolf@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 4300B7F3E1 From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 4 May 2017 18:52:38 +0200 Message-Id: <1493916761-32319-4-git-send-email-kwolf@redhat.com> In-Reply-To: <1493916761-32319-1-git-send-email-kwolf@redhat.com> References: <1493916761-32319-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 04 May 2017 16:52:56 +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 3/6] block: Drop permissions when migration completes 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: kwolf@redhat.com, famz@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com 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" With image locking, permissions affect other qemu processes as well. We want to be sure that the destination can run, so let's drop permissions on the source when migration completes. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- block.c | 12 +++++++++++- block/block-backend.c | 25 +++++++++++++++++++++++++ include/block/block_int.h | 7 ++++--- 3 files changed, 40 insertions(+), 4 deletions(-) diff --git a/block.c b/block.c index 3e7f124..c3e7ebd 100644 --- a/block.c +++ b/block.c @@ -4028,7 +4028,7 @@ void bdrv_invalidate_cache_all(Error **errp) static int bdrv_inactivate_recurse(BlockDriverState *bs, bool setting_flag) { - BdrvChild *child; + BdrvChild *child, *parent; int ret; =20 if (!setting_flag && bs->drv->bdrv_inactivate) { @@ -4047,6 +4047,16 @@ static int bdrv_inactivate_recurse(BlockDriverState = *bs, =20 if (setting_flag) { bs->open_flags |=3D BDRV_O_INACTIVE; + + QLIST_FOREACH(parent, &bs->parents, next_parent) { + if (parent->role->inactivate) { + ret =3D parent->role->inactivate(parent); + if (ret < 0) { + bs->open_flags &=3D ~BDRV_O_INACTIVE; + return ret; + } + } + } } return 0; } diff --git a/block/block-backend.c b/block/block-backend.c index a7ce72b..f3a6008 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -156,6 +156,30 @@ static void blk_root_activate(BdrvChild *child, Error = **errp) } } =20 +static int blk_root_inactivate(BdrvChild *child) +{ + BlockBackend *blk =3D child->opaque; + + if (blk->disable_perm) { + return 0; + } + + /* Only inactivate BlockBackends for guest devices (which are inactive= at + * this point because the VM is stopped) and unattached monitor-owned + * BlockBackends. If there is still any other user like a block job, t= hen + * we simply can't inactivate the image. */ + if (!blk->dev && !blk->name[0]) { + return -EPERM; + } + + blk->disable_perm =3D true; + if (blk->root) { + bdrv_child_try_set_perm(blk->root, 0, BLK_PERM_ALL, &error_abort); + } + + return 0; +} + static const BdrvChildRole child_root =3D { .inherit_options =3D blk_root_inherit_options, =20 @@ -168,6 +192,7 @@ static const BdrvChildRole child_root =3D { .drained_end =3D blk_root_drained_end, =20 .activate =3D blk_root_activate, + .inactivate =3D blk_root_inactivate, }; =20 /* diff --git a/include/block/block_int.h b/include/block/block_int.h index 5637925..5750a44 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -473,10 +473,11 @@ struct BdrvChildRole { void (*drained_begin)(BdrvChild *child); void (*drained_end)(BdrvChild *child); =20 - /* Notifies the parent that the child has been activated (e.g. when - * migration is completing) and it can start requesting permissions and - * doing I/O on it. */ + /* Notifies the parent that the child has been activated/inactivated (= e.g. + * when migration is completing) and it can start/stop requesting + * permissions and doing I/O on it. */ void (*activate)(BdrvChild *child, Error **errp); + int (*inactivate)(BdrvChild *child); =20 void (*attach)(BdrvChild *child); void (*detach)(BdrvChild *child); --=20 1.8.3.1 From nobody Wed May 1 20:57:17 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.zoho.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 1493916904891300.3122000288321; Thu, 4 May 2017 09:55:04 -0700 (PDT) Received: from localhost ([::1]:43075 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6K1v-00011F-Hn for importer@patchew.org; Thu, 04 May 2017 12:55:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56157) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6K00-0008Cv-4T for qemu-devel@nongnu.org; Thu, 04 May 2017 12:53:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d6Jzx-0003rR-Bq for qemu-devel@nongnu.org; Thu, 04 May 2017 12:53:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58656) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d6Jzu-0003nn-UO; Thu, 04 May 2017 12:52:59 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CFAE3C059741; Thu, 4 May 2017 16:52:57 +0000 (UTC) Received: from noname.redhat.com (ovpn-117-230.ams2.redhat.com [10.36.117.230]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8F97F1715B; Thu, 4 May 2017 16:52:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com CFAE3C059741 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kwolf@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com CFAE3C059741 From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 4 May 2017 18:52:39 +0200 Message-Id: <1493916761-32319-5-git-send-email-kwolf@redhat.com> In-Reply-To: <1493916761-32319-1-git-send-email-kwolf@redhat.com> References: <1493916761-32319-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 04 May 2017 16:52:58 +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 4/6] block: Inactivate parents before children 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: kwolf@redhat.com, famz@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com 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" The proper order for inactivating block nodes is that first the parents get inactivated and then the children. If we do things in this order, we can assert that we didn't accidentally leave a parent activated when one of its child nodes is inactive. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- block.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/block.c b/block.c index c3e7ebd..773bd64 100644 --- a/block.c +++ b/block.c @@ -762,6 +762,13 @@ static void bdrv_child_cb_drained_end(BdrvChild *child) bdrv_drained_end(bs); } =20 +static int bdrv_child_cb_inactivate(BdrvChild *child) +{ + BlockDriverState *bs =3D child->opaque; + assert(bs->open_flags & BDRV_O_INACTIVE); + return 0; +} + /* * Returns the options and flags that a temporary snapshot should get, bas= ed on * the originally requested flags (the originally requested image will have @@ -822,6 +829,7 @@ const BdrvChildRole child_file =3D { .inherit_options =3D bdrv_inherited_options, .drained_begin =3D bdrv_child_cb_drained_begin, .drained_end =3D bdrv_child_cb_drained_end, + .inactivate =3D bdrv_child_cb_inactivate, }; =20 /* @@ -843,6 +851,7 @@ const BdrvChildRole child_format =3D { .inherit_options =3D bdrv_inherited_fmt_options, .drained_begin =3D bdrv_child_cb_drained_begin, .drained_end =3D bdrv_child_cb_drained_end, + .inactivate =3D bdrv_child_cb_inactivate, }; =20 static void bdrv_backing_attach(BdrvChild *c) @@ -928,6 +937,7 @@ const BdrvChildRole child_backing =3D { .inherit_options =3D bdrv_backing_options, .drained_begin =3D bdrv_child_cb_drained_begin, .drained_end =3D bdrv_child_cb_drained_end, + .inactivate =3D bdrv_child_cb_inactivate, }; =20 static int bdrv_open_flags(BlockDriverState *bs, int flags) @@ -4038,13 +4048,6 @@ static int bdrv_inactivate_recurse(BlockDriverState = *bs, } } =20 - QLIST_FOREACH(child, &bs->children, next) { - ret =3D bdrv_inactivate_recurse(child->bs, setting_flag); - if (ret < 0) { - return ret; - } - } - if (setting_flag) { bs->open_flags |=3D BDRV_O_INACTIVE; =20 @@ -4058,6 +4061,14 @@ static int bdrv_inactivate_recurse(BlockDriverState = *bs, } } } + + QLIST_FOREACH(child, &bs->children, next) { + ret =3D bdrv_inactivate_recurse(child->bs, setting_flag); + if (ret < 0) { + return ret; + } + } + return 0; } =20 --=20 1.8.3.1 From nobody Wed May 1 20:57:17 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.zoho.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 1493917038890701.032767947549; Thu, 4 May 2017 09:57:18 -0700 (PDT) Received: from localhost ([::1]:43089 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6K45-0002sf-Kh for importer@patchew.org; Thu, 04 May 2017 12:57:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56183) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6K01-0008Es-Nl for qemu-devel@nongnu.org; Thu, 04 May 2017 12:53:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d6K00-0003wQ-LA for qemu-devel@nongnu.org; Thu, 04 May 2017 12:53:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47530) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d6Jzw-0003p8-Gx; Thu, 04 May 2017 12:53:00 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6E1B74E341; Thu, 4 May 2017 16:52:59 +0000 (UTC) Received: from noname.redhat.com (ovpn-117-230.ams2.redhat.com [10.36.117.230]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2844C1715B; Thu, 4 May 2017 16:52:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6E1B74E341 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kwolf@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 6E1B74E341 From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 4 May 2017 18:52:40 +0200 Message-Id: <1493916761-32319-6-git-send-email-kwolf@redhat.com> In-Reply-To: <1493916761-32319-1-git-send-email-kwolf@redhat.com> References: <1493916761-32319-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 04 May 2017 16:52:59 +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 5/6] block: Fix write/resize permissions for inactive images 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: kwolf@redhat.com, famz@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com 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" Format drivers for inactive nodes don't need write/resize permissions on their bs->file and can share write/resize with another VM (in fact, this is the whole point of keeping images inactive). Represent this fact in the op blocker system, so that image locking does the right thing without special-casing inactive images. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- block.c | 35 +++++++++++++++++++++++++++++++++-- include/block/block.h | 1 + 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/block.c b/block.c index 773bd64..cd89467 100644 --- a/block.c +++ b/block.c @@ -192,11 +192,20 @@ void path_combine(char *dest, int dest_size, } } =20 +/* Returns whether the image file is opened as read-only. Note that this c= an + * return false and writing to the image file is still not possible becaus= e the + * image is inactivated. */ bool bdrv_is_read_only(BlockDriverState *bs) { return bs->read_only; } =20 +/* Returns whether the image file can be written to right now */ +bool bdrv_is_writable(BlockDriverState *bs) +{ + return !bdrv_is_read_only(bs) && !(bs->open_flags & BDRV_O_INACTIVE); +} + int bdrv_can_set_read_only(BlockDriverState *bs, bool read_only, Error **e= rrp) { /* Do not set read_only if copy_on_read is enabled */ @@ -1512,7 +1521,7 @@ static int bdrv_check_perm(BlockDriverState *bs, uint= 64_t cumulative_perms, =20 /* Write permissions never work with read-only images */ if ((cumulative_perms & (BLK_PERM_WRITE | BLK_PERM_WRITE_UNCHANGED)) && - bdrv_is_read_only(bs)) + !bdrv_is_writable(bs)) { error_setg(errp, "Block node is read-only"); return -EPERM; @@ -1797,7 +1806,7 @@ void bdrv_format_default_perms(BlockDriverState *bs, = BdrvChild *c, bdrv_filter_default_perms(bs, c, role, perm, shared, &perm, &share= d); =20 /* Format drivers may touch metadata even if the guest doesn't wri= te */ - if (!bdrv_is_read_only(bs)) { + if (bdrv_is_writable(bs)) { perm |=3D BLK_PERM_WRITE | BLK_PERM_RESIZE; } =20 @@ -1823,6 +1832,10 @@ void bdrv_format_default_perms(BlockDriverState *bs,= BdrvChild *c, BLK_PERM_WRITE_UNCHANGED; } =20 + if (bs->open_flags & BDRV_O_INACTIVE) { + shared |=3D BLK_PERM_WRITE | BLK_PERM_RESIZE; + } + *nperm =3D perm; *nshared =3D shared; } @@ -3969,6 +3982,7 @@ void bdrv_init_with_whitelist(void) void bdrv_invalidate_cache(BlockDriverState *bs, Error **errp) { BdrvChild *child, *parent; + uint64_t perm, shared_perm; Error *local_err =3D NULL; int ret; =20 @@ -4005,6 +4019,16 @@ void bdrv_invalidate_cache(BlockDriverState *bs, Err= or **errp) return; } =20 + /* Update permissions, they may differ for inactive nodes */ + bdrv_get_cumulative_perm(bs, &perm, &shared_perm); + ret =3D bdrv_check_perm(bs, perm, shared_perm, NULL, &local_err); + if (ret < 0) { + bs->open_flags |=3D BDRV_O_INACTIVE; + error_propagate(errp, local_err); + return; + } + bdrv_set_perm(bs, perm, shared_perm); + QLIST_FOREACH(parent, &bs->parents, next_parent) { if (parent->role->activate) { parent->role->activate(parent, &local_err); @@ -4049,6 +4073,8 @@ static int bdrv_inactivate_recurse(BlockDriverState *= bs, } =20 if (setting_flag) { + uint64_t perm, shared_perm; + bs->open_flags |=3D BDRV_O_INACTIVE; =20 QLIST_FOREACH(parent, &bs->parents, next_parent) { @@ -4060,6 +4086,11 @@ static int bdrv_inactivate_recurse(BlockDriverState = *bs, } } } + + /* Update permissions, they may differ for inactive nodes */ + bdrv_get_cumulative_perm(bs, &perm, &shared_perm); + bdrv_check_perm(bs, perm, shared_perm, NULL, &error_abort); + bdrv_set_perm(bs, perm, shared_perm); } =20 QLIST_FOREACH(child, &bs->children, next) { diff --git a/include/block/block.h b/include/block/block.h index 80d51d8..90932b4 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -435,6 +435,7 @@ int bdrv_is_allocated_above(BlockDriverState *top, Bloc= kDriverState *base, int64_t sector_num, int nb_sectors, int *pnum); =20 bool bdrv_is_read_only(BlockDriverState *bs); +bool bdrv_is_writable(BlockDriverState *bs); int bdrv_can_set_read_only(BlockDriverState *bs, bool read_only, Error **e= rrp); int bdrv_set_read_only(BlockDriverState *bs, bool read_only, Error **errp); bool bdrv_is_sg(BlockDriverState *bs); --=20 1.8.3.1 From nobody Wed May 1 20:57:17 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.zoho.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 1493917043313762.894698840812; Thu, 4 May 2017 09:57:23 -0700 (PDT) Received: from localhost ([::1]:43090 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6K4A-0002wm-1k for importer@patchew.org; Thu, 04 May 2017 12:57:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56195) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6K02-0008Fr-C7 for qemu-devel@nongnu.org; Thu, 04 May 2017 12:53:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d6K01-0003xZ-Eq for qemu-devel@nongnu.org; Thu, 04 May 2017 12:53:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39066) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d6Jzy-0003rb-2C; Thu, 04 May 2017 12:53:02 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 04F3CC04B948; Thu, 4 May 2017 16:53:01 +0000 (UTC) Received: from noname.redhat.com (ovpn-117-230.ams2.redhat.com [10.36.117.230]) by smtp.corp.redhat.com (Postfix) with ESMTP id B8F161715B; Thu, 4 May 2017 16:52:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 04F3CC04B948 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kwolf@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 04F3CC04B948 From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 4 May 2017 18:52:41 +0200 Message-Id: <1493916761-32319-7-git-send-email-kwolf@redhat.com> In-Reply-To: <1493916761-32319-1-git-send-email-kwolf@redhat.com> References: <1493916761-32319-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 04 May 2017 16:53:01 +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 6/6] file-posix: Remove .bdrv_inactivate/invalidate_cache 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: kwolf@redhat.com, famz@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com 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" Now that the block layer takes care to request a lot less permissions for inactive nodes, the special-casing in file-posix isn't necessary any more. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- block/file-posix.c | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/block/file-posix.c b/block/file-posix.c index f1f924b..90a5f53 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -2190,35 +2190,6 @@ static void raw_abort_perm_update(BlockDriverState *= bs) raw_handle_perm_lock(bs, RAW_PL_ABORT, 0, 0, NULL); } =20 -static int raw_inactivate(BlockDriverState *bs) -{ - int ret; - uint64_t perm =3D 0; - uint64_t shared =3D BLK_PERM_ALL; - - ret =3D raw_handle_perm_lock(bs, RAW_PL_PREPARE, perm, shared, NULL); - if (ret) { - return ret; - } - raw_handle_perm_lock(bs, RAW_PL_COMMIT, perm, shared, NULL); - return 0; -} - - -static void raw_invalidate_cache(BlockDriverState *bs, Error **errp) -{ - BDRVRawState *s =3D bs->opaque; - int ret; - - assert(!(bdrv_get_flags(bs) & BDRV_O_INACTIVE)); - ret =3D raw_handle_perm_lock(bs, RAW_PL_PREPARE, s->perm, s->shared_pe= rm, - errp); - if (ret) { - return; - } - raw_handle_perm_lock(bs, RAW_PL_COMMIT, s->perm, s->shared_perm, NULL); -} - BlockDriver bdrv_file =3D { .format_name =3D "file", .protocol_name =3D "file", @@ -2249,8 +2220,6 @@ BlockDriver bdrv_file =3D { .bdrv_get_info =3D raw_get_info, .bdrv_get_allocated_file_size =3D raw_get_allocated_file_size, - .bdrv_inactivate =3D raw_inactivate, - .bdrv_invalidate_cache =3D raw_invalidate_cache, .bdrv_check_perm =3D raw_check_perm, .bdrv_set_perm =3D raw_set_perm, .bdrv_abort_perm_update =3D raw_abort_perm_update, @@ -2712,8 +2681,6 @@ static BlockDriver bdrv_host_device =3D { .bdrv_get_info =3D raw_get_info, .bdrv_get_allocated_file_size =3D raw_get_allocated_file_size, - .bdrv_inactivate =3D raw_inactivate, - .bdrv_invalidate_cache =3D raw_invalidate_cache, .bdrv_check_perm =3D raw_check_perm, .bdrv_set_perm =3D raw_set_perm, .bdrv_abort_perm_update =3D raw_abort_perm_update, --=20 1.8.3.1