From nobody Fri Dec 19 06:16:34 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565948661; cv=none; d=zoho.com; s=zohoarc; b=Ry0H0oFsP6mDIbC2/4XaZxucAasc2KSVWqUpB2wumLEoVPMNh9WHRHm3WCCuZK4gnQojRnY72t907yeGJwyPl0gGO/daBqS7aksU9vmzuMLYFit2jUzIi9RySKSA4eXPkJ5/1Jn6Sho/kboUlnA+7o09qVmMvW+roO4W5FE0cWc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565948661; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Ev8dPSCWRMJ30CVYQ97uYDTegAym/OwwbwlwGRyitZk=; b=PSPmyCfmy5KlFOrrqKKIZGPvF6GjZJesWngpiGmprNeNOoCFID5vCl8Pj1R1hd+vu3YE4xwQl5SH/CYBp3oAaRrijDeKv62SEBvaihrFRY+8POG0Nyi7mxE2qwUZwBWrEVsiTp0d+6KJ4L75E0L9SLNLlFkbpxpa9pEIN87SKNY= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565948661328921.3118611805412; Fri, 16 Aug 2019 02:44:21 -0700 (PDT) Received: from localhost ([::1]:52562 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyYmR-0001u1-Ps for importer@patchew.org; Fri, 16 Aug 2019 05:44:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59643) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyYdV-0000BK-TU for qemu-devel@nongnu.org; Fri, 16 Aug 2019 05:35:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hyYdU-0003rn-MN for qemu-devel@nongnu.org; Fri, 16 Aug 2019 05:35:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56350) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hyYdS-0003og-DK; Fri, 16 Aug 2019 05:35: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 AFCA2306046D; Fri, 16 Aug 2019 09:35:01 +0000 (UTC) Received: from localhost.localdomain.com (dhcp-200-226.str.redhat.com [10.33.200.226]) by smtp.corp.redhat.com (Postfix) with ESMTP id DC63B5C1D6; Fri, 16 Aug 2019 09:34:58 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Fri, 16 Aug 2019 11:34:36 +0200 Message-Id: <20190816093439.14262-14-kwolf@redhat.com> In-Reply-To: <20190816093439.14262-1-kwolf@redhat.com> References: <20190816093439.14262-1-kwolf@redhat.com> MIME-Version: 1.0 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.41]); Fri, 16 Aug 2019 09:35:01 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 13/16] mirror: Keep mirror_top_bs drained after dropping permissions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" mirror_top_bs is currently implicitly drained through its connection to the source or the target node. However, the drain section for target_bs ends early after moving mirror_top_bs from src to target_bs, so that requests can already be restarted while mirror_top_bs is still present in the chain, but has dropped all permissions and therefore runs into an assertion failure like this: qemu-system-x86_64: block/io.c:1634: bdrv_co_write_req_prepare: Assertion `child->perm & BLK_PERM_WRITE' failed. Keep mirror_top_bs drained until all graph changes have completed. Cc: qemu-stable@nongnu.org Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz --- block/mirror.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/block/mirror.c b/block/mirror.c index 9f5c59ece1..642d6570cc 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -656,7 +656,10 @@ static int mirror_exit_common(Job *job) s->target =3D NULL; =20 /* We don't access the source any more. Dropping any WRITE/RESIZE is - * required before it could become a backing file of target_bs. */ + * required before it could become a backing file of target_bs. Not ha= ving + * these permissions any more means that we can't allow any new reques= ts on + * mirror_top_bs from now on, so keep it drained. */ + bdrv_drained_begin(mirror_top_bs); bs_opaque->stop =3D true; bdrv_child_refresh_perms(mirror_top_bs, mirror_top_bs->backing, &error_abort); @@ -724,6 +727,7 @@ static int mirror_exit_common(Job *job) bs_opaque->job =3D NULL; =20 bdrv_drained_end(src); + bdrv_drained_end(mirror_top_bs); s->in_drain =3D false; bdrv_unref(mirror_top_bs); bdrv_unref(src); --=20 2.20.1