From patchwork Tue Apr 11 14:50:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Reitz X-Patchwork-Id: 9675589 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8451D60234 for ; Tue, 11 Apr 2017 14:51:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 72B6E285A0 for ; Tue, 11 Apr 2017 14:51:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 63CD2285BF; Tue, 11 Apr 2017 14:51:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0F0CA285A0 for ; Tue, 11 Apr 2017 14:51:55 +0000 (UTC) Received: from localhost ([::1]:39627 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cxx98-0008T9-77 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 11 Apr 2017 10:51:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53858) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cxx8c-0008Rh-RE for qemu-devel@nongnu.org; Tue, 11 Apr 2017 10:51:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cxx8c-0007jr-2g for qemu-devel@nongnu.org; Tue, 11 Apr 2017 10:51:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55426) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cxx8X-0007g2-FB; Tue, 11 Apr 2017 10:51:17 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5106775EBA; Tue, 11 Apr 2017 14:51:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5106775EBA Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=mreitz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 5106775EBA Received: from localhost (ovpn-204-201.brq.redhat.com [10.40.204.201]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5A92E18EE9; Tue, 11 Apr 2017 14:50:53 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Tue, 11 Apr 2017 16:50:50 +0200 Message-Id: <20170411145050.31290-1-mreitz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 11 Apr 2017 14:51:16 +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 for-2.9?] block/io: Comment out permission assertions 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 , Laurent Vivier , Fam Zheng , qemu-devel@nongnu.org, Max Reitz , Stefan Hajnoczi Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP In case of block migration, there may be writes to BlockBackends that do not have the write permission taken. Before this issue is fixed (which is not going to happen in 2.9), we therefore cannot assert that this is the case. Suggested-by: Kevin Wolf Signed-off-by: Max Reitz Reviewed-by: Kevin Wolf Tested-by: Kevin Wolf Tested-by: Laurent Vivier --- block.c | 6 +++++- block/io.c | 12 ++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/block.c b/block.c index 086a12df97..1fbbb8d606 100644 --- a/block.c +++ b/block.c @@ -3274,7 +3274,11 @@ int bdrv_truncate(BdrvChild *child, int64_t offset) BlockDriver *drv = bs->drv; int ret; - assert(child->perm & BLK_PERM_RESIZE); + /* FIXME: Some format block drivers use this function instead of implicitly + * growing their file by writing beyond its end. + * See bdrv_aligned_pwritev() for an explanation why we currently + * cannot assert this permission in that case. */ + // assert(child->perm & BLK_PERM_RESIZE); if (!drv) return -ENOMEDIUM; diff --git a/block/io.c b/block/io.c index bae6947032..8706bfa578 100644 --- a/block/io.c +++ b/block/io.c @@ -1345,8 +1345,16 @@ static int coroutine_fn bdrv_aligned_pwritev(BdrvChild *child, assert(!waited || !req->serialising); assert(req->overlap_offset <= offset); assert(offset + bytes <= req->overlap_offset + req->overlap_bytes); - assert(child->perm & BLK_PERM_WRITE); - assert(end_sector <= bs->total_sectors || child->perm & BLK_PERM_RESIZE); + /* FIXME: Block migration uses the BlockBackend of the guest device at a + * point when it has not yet taken write permissions. This will be + * fixed by a future patch, but for now we have to bypass this + * assertion for block migration to work. */ + // assert(child->perm & BLK_PERM_WRITE); + /* FIXME: Because of the above, we also cannot guarantee that all format + * BDS take the BLK_PERM_RESIZE permission on their file BDS, since + * they are not obligated to do so if they do not have any parent + * that has taken the permission to write to them. */ + // assert(end_sector <= bs->total_sectors || child->perm & BLK_PERM_RESIZE); ret = notifier_with_return_list_notify(&bs->before_write_notifiers, req);