From patchwork Thu Apr 6 21:29:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Richard W.M. Jones" X-Patchwork-Id: 9668493 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 4A70F602B8 for ; Thu, 6 Apr 2017 21:30:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 72EDC285CB for ; Thu, 6 Apr 2017 21:30:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 677F6285D4; Thu, 6 Apr 2017 21:30:44 +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 D215F285CB for ; Thu, 6 Apr 2017 21:30:43 +0000 (UTC) Received: from localhost ([::1]:47765 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cwEzK-0004S2-9f for patchwork-qemu-devel@patchwork.kernel.org; Thu, 06 Apr 2017 17:30:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56598) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cwEyP-00049b-Qc for qemu-devel@nongnu.org; Thu, 06 Apr 2017 17:29:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cwEyO-0000wM-9f for qemu-devel@nongnu.org; Thu, 06 Apr 2017 17:29:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59314) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cwEyJ-0000qJ-Ju; Thu, 06 Apr 2017 17:29:39 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4A4116E775; Thu, 6 Apr 2017 21:29:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4A4116E775 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=rjones@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 4A4116E775 Received: from localhost (ovpn-116-64.ams2.redhat.com [10.36.116.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id B2F6117D56; Thu, 6 Apr 2017 21:29:37 +0000 (UTC) Date: Thu, 6 Apr 2017 22:29:36 +0100 From: "Richard W.M. Jones" To: Eric Blake Message-ID: <20170406212936.GA28793@redhat.com> References: <1488314205-16264-1-git-send-email-kwolf@redhat.com> <1488314205-16264-44-git-send-email-kwolf@redhat.com> <20170406205939.GA28584@redhat.com> <20170406211537.GR30620@redhat.com> <616fdb8b-2c41-9718-d5b3-e335e78745e4@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <616fdb8b-2c41-9718-d5b3-e335e78745e4@redhat.com> User-Agent: Mutt/1.5.20 (2009-12-10) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 06 Apr 2017 21:29:38 +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: Re: [Qemu-devel] [PULL 43/46] block: Assertions for write permissions 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 , qemu-devel@nongnu.org, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP On Thu, Apr 06, 2017 at 04:23:19PM -0500, Eric Blake wrote: > On 04/06/2017 04:15 PM, Richard W.M. Jones wrote: > > >>>> +++ b/block/io.c > >>>> @@ -945,6 +945,8 @@ static int coroutine_fn bdrv_co_do_copy_on_readv(BdrvChild *child, > >>>> size_t skip_bytes; > >>>> int ret; > >>>> > >>>> + assert(child->perm & (BLK_PERM_WRITE_UNCHANGED | BLK_PERM_WRITE)); > >>> > > > https://bugzilla.redhat.com/show_bug.cgi?id=1439922 > > > > There is also a minimal reproducer in comment 2. > > If it helps, backtrace shows: > > #4 0x0000555555c09f10 in bdrv_co_do_copy_on_readv > (child=0x555556990180, offset=0, bytes=512, qiov=0x7fffffffd0c0) at > block/io.c:948 > #5 0x0000555555c0a33d in bdrv_aligned_preadv (child=0x555556990180, > req=0x7fffb6dffec0, offset=0, bytes=512, align=1, qiov=0x7fffffffd0c0, > flags=1) > at block/io.c:1058 > #6 0x0000555555c0a8c3 in bdrv_co_preadv (child=0x555556990180, > offset=0, bytes=512, qiov=0x7fffffffd0c0, flags=BDRV_REQ_COPY_ON_READ) > at block/io.c:1166 > #7 0x0000555555bf7ccf in blk_co_preadv (blk=0x555556a2bc20, offset=0, > bytes=512, qiov=0x7fffffffd0c0, flags=0) at block/block-backend.c:927 > #8 0x0000555555bf7e19 in blk_read_entry (opaque=0x7fffffffd0e0) > at block/block-backend.c:974 > #9 0x0000555555cc3015 in coroutine_trampoline (i0=1485566720, i1=21845) > at util/coroutine-ucontext.c:79 The patch that fixes this is simply: It has no ill effects that I can see, and fixes the libguestfs test suite, but I'm assuming the assert was added for a reason so I'm not proposing this as a patch. Rich. diff --git a/block/io.c b/block/io.c index 2709a7007f..4f1a730e45 100644 --- a/block/io.c +++ b/block/io.c @@ -945,8 +945,6 @@ static int coroutine_fn bdrv_co_do_copy_on_readv(BdrvChild *child, size_t skip_bytes; int ret; - assert(child->perm & (BLK_PERM_WRITE_UNCHANGED | BLK_PERM_WRITE)); - /* Cover entire cluster so no additional backing file I/O is required when * allocating cluster in the image file. */