From patchwork Fri Nov 20 16:16:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 1403881 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=virtuozzo.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=selector2 header.b=VHmwC2nj; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Cd1wx3fHbz9sT6 for ; Sat, 21 Nov 2020 03:20:17 +1100 (AEDT) Received: from localhost ([::1]:36844 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kg98x-0007cX-CF for incoming@patchwork.ozlabs.org; Fri, 20 Nov 2020 11:20:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60430) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kg95Y-0003bz-Ml; Fri, 20 Nov 2020 11:16:44 -0500 Received: from mail-am6eur05on2104.outbound.protection.outlook.com ([40.107.22.104]:54753 helo=EUR05-AM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kg95W-0004qy-UZ; Fri, 20 Nov 2020 11:16:44 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hukFMIgD5Gz0DrqHk6zQ3astFYEwxNt6tT33PTVQi5QwjYlf7OSa0PtosElCeAiZn71h+GIJKKTI8OJayPfFvDdhxEx71wBHS/b4JzP1xKLyHxfPFBp4Oo8jGMxz9vfPxK8KKLtvyR/RBXddWn3e1ZjQShfIRZqc9ywNuDHjK9F+dopExyuCrWa3O3qFnG2SOWFpv8zfmMApmj3K0PyeYuieM0JQre9fMEpMLsavhsQYEZRGLgDKG4d9OG5Sa6DF7lfiH4J1Wb/NfsN51mUXZs5uoUnWMQr4/xbP2aMFE1LzsUDuOA1Av3phq3JQYy7/Hn0DdKQH/nmKmA9QSiCzMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vMSncCLGZq4UmQ1TMkXjMLfz5K9FOnmYOIqXtxACM54=; b=hX3+PMU8ZRQCbo/6y/wrFEeNXN64paLNAHY7WtsfTl5w8ylyXSD99sGUIzxBYgK8OhBQLqYiWhYwfiRIJTbY1K+iVqzbhczr86gOsAwCStXvc70tyKw0beDyRRi+KOJA9T4KsXqBXByZihTn5NWW0U7NMnCMPyMVoUxtefO17aalk8MAKKsp+Y8N1pifdWsJ3fT7F/IN6NFvPeCeylwi3war35dq61O1IeCsu3rVnhW1dzFlPmKURB09BkQITLy54IaV+WMD1Ske92sEALS1SJHdOhHgZhVwuMlqgMEnmBEf4irsK4SGBdqnL2CHnplq5XV2wMxb4a+nCxXn/eCPpQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vMSncCLGZq4UmQ1TMkXjMLfz5K9FOnmYOIqXtxACM54=; b=VHmwC2njkSFyrm6MEIiVGFjxr7SP/OySg574VFHNmnh7TplpOVIJnODCfo3tKytuaDzkw6SyyG8u6pednyeBt4iSxP4nAeibUCjlXZHqABS8QMeb3KqNva+IjkJsaVMPgdR/zNyq1TNDE71dHaanRO6xJ2PiZX27cTmpXOD8tSs= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM7PR08MB5333.eurprd08.prod.outlook.com (2603:10a6:20b:104::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3564.26; Fri, 20 Nov 2020 16:16:37 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::fd02:1330:f620:1243]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::fd02:1330:f620:1243%9]) with mapi id 15.20.3589.021; Fri, 20 Nov 2020 16:16:37 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, jsnow@redhat.com, mreitz@redhat.com, kwolf@redhat.com, philmd@redhat.com, peter.maydell@linaro.org, berto@igalia.com, stefanha@redhat.com, pbonzini@redhat.com, vsementsov@virtuozzo.com, den@openvz.org, eblake@redhat.com Subject: [PATCH 1/5] abort-on-set-to-true Date: Fri, 20 Nov 2020 19:16:18 +0300 Message-Id: <20201120161622.1537-2-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20201120161622.1537-1-vsementsov@virtuozzo.com> References: <20201120161622.1537-1-vsementsov@virtuozzo.com> X-Originating-IP: [185.215.60.108] X-ClientProxiedBy: FR2P281CA0022.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:14::9) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from kvm.sw.ru (185.215.60.108) by FR2P281CA0022.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:14::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3611.13 via Frontend Transport; Fri, 20 Nov 2020 16:16:36 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cd5001b1-17b4-4f34-912a-08d88d6fa7e0 X-MS-TrafficTypeDiagnostic: AM7PR08MB5333: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1247; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +WQWeycv62dt7DdDug7qtg3PZymlJrt726UPVmxAX/7v9brACIjX4qjg1FTQvZvsu2OnhU/4GeoMdXiNo6dyy4q6N1P4x1TYfvyCv4WEfX3Rb7LJMpYuZApn4hVhSKtDjipy+lSrcaP/1B54gwknWb5Yy+07Dv1F6t5ME8AqxEpuwZjL556oPb85m5fJK/iylOqzx9l0xDj5Boh2sbQJxxmXe4A5kIXvIV1Hv8jCxLLynH4rWPuQa3Hi3JybYnnqVgVYLFCOr4EqeMIgxotQOoXqBiKLOh6PLoAOPOIwKO8uYG4Ckp2P+gJ0hGx/JDfp X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(366004)(136003)(376002)(39840400004)(396003)(6512007)(1076003)(2616005)(7416002)(6916009)(66556008)(2906002)(478600001)(83380400001)(52116002)(66476007)(66946007)(86362001)(26005)(5660300002)(316002)(6666004)(956004)(6506007)(36756003)(16526019)(6486002)(8936002)(186003)(8676002)(4326008); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: sebbPo+1m1K/qY6zIFoPb/O1ubfOWVHz/ECpwP3hAN4ZjO3PA+ShsTWPghRlYUYjxx1T0lHPsNoGUSWA5JFFqAK8jHqSLNx1PLmML3ebDbN3p5JqYkwMti2DbDVL3MBjlYFJlSgN4R++KM4AbH8glXzs4Id/pGp8JMJuvOuBuRGmhliv5UDc2rnPmZx17zYQWIWtFpoQBZCkw4uPm5Rg36ONbGblK3ga0RZVTvX+8pm/ckLn/mZXzr9FDaydd1dJZhXdvNWLRoE/+2HWfH8sJJdxNHQR0ckewIyHRYq1wEqaTid8xy4M8isOilNYW3ViH8Te0g38jUpYrM25blJ/iIcPprstzU38T+BTIeEmfhEzUBkxM5VFUAjQKpNxlCeWOygcRO1eb+DmzEQ4732aOFB/cHFJCzLUl3Mvy1CTYRKVmTR6rIhFajU+UBTYpinjZw9VP+MvzvQCBMHYwo9wnBdv8Jzffu0EOKavvUEGhU2Ke4qpLSNwiV8BvoYfaaEyuhcwGAW2uROGjfuAY8Zl4nIKg2p/WjHN4kQ7mFN0hL2GjHEE/NqkyXIXZTZmFEItiUFcqmusEKCBMWeGFKe2gNaECMjHLkd887MLnd7L17ffVaEqXIkmhoRvi7OmF/8fItVbwsMByJ+xRKggArqYDA== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: cd5001b1-17b4-4f34-912a-08d88d6fa7e0 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Nov 2020 16:16:37.3549 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: VsTCRoQ9DqVxzF5hGjn9aIRB7wIKBGUKe1R+zzsOAEwSzt/sTKZ3MhfaKu4qzbll/7OWt2adaKtcaaefc9Lf4mKd8K3JJTMY/5WC073TZiI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5333 Received-SPF: pass client-ip=40.107.22.104; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-AM6-obe.outbound.protection.outlook.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Vladimir Sementsov-Ogievskiy --- block.c | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/block.c b/block.c index f1cedac362..5e8dd98cec 100644 --- a/block.c +++ b/block.c @@ -84,6 +84,8 @@ static BlockDriverState *bdrv_open_inherit(const char *filename, /* If non-zero, use only whitelisted block drivers */ static int use_bdrv_whitelist; +bool abort_on_set_to_true = false; + #ifdef _WIN32 static int is_windows_drive_prefix(const char *filename) { @@ -2002,6 +2004,9 @@ static int bdrv_check_perm(BlockDriverState *bs, BlockReopenQueue *q, added_perms = cumulative_perms & ~current_perms; removed_shared_perms = current_shared & ~cumulative_shared_perms; + if ((added_perms || removed_shared_perms) && tighten_restrictions == &abort_on_set_to_true) { + abort(); + } *tighten_restrictions = added_perms || removed_shared_perms; } @@ -2066,12 +2071,17 @@ static int bdrv_check_perm(BlockDriverState *bs, BlockReopenQueue *q, bdrv_child_perm(bs, c->bs, c, c->role, q, cumulative_perms, cumulative_shared_perms, &cur_perm, &cur_shared); - ret = bdrv_child_check_perm(c, q, cur_perm, cur_shared, ignore_children, - tighten_restrictions ? &child_tighten_restr - : NULL, - errp); - if (tighten_restrictions) { - *tighten_restrictions |= child_tighten_restr; + if (tighten_restrictions == &abort_on_set_to_true) { + ret = bdrv_child_check_perm(c, q, cur_perm, cur_shared, ignore_children, + &abort_on_set_to_true, errp); + } else { + ret = bdrv_child_check_perm(c, q, cur_perm, cur_shared, ignore_children, + tighten_restrictions ? &child_tighten_restr + : NULL, + errp); + if (tighten_restrictions) { + *tighten_restrictions |= child_tighten_restr; + } } if (ret < 0) { return ret; @@ -2227,6 +2237,9 @@ static int bdrv_check_update_perm(BlockDriverState *bs, BlockReopenQueue *q, char *perm_names = bdrv_perm_names(new_used_perm & ~c->shared_perm); if (tighten_restrictions) { + if (tighten_restrictions == &abort_on_set_to_true) { + abort(); + } *tighten_restrictions = true; } @@ -2243,6 +2256,9 @@ static int bdrv_check_update_perm(BlockDriverState *bs, BlockReopenQueue *q, char *perm_names = bdrv_perm_names(c->perm & ~new_shared_perm); if (tighten_restrictions) { + if (tighten_restrictions == &abort_on_set_to_true) { + abort(); + } *tighten_restrictions = true; } @@ -2639,13 +2655,13 @@ static void bdrv_replace_child(BdrvChild *child, BlockDriverState *new_bs) /* Update permissions for old node. This is guaranteed to succeed * because we're just taking a parent away, so we're loosening * restrictions. */ - bool tighten_restrictions; int ret; + assert(abort_on_set_to_true == false); bdrv_get_cumulative_perm(old_bs, &perm, &shared_perm); ret = bdrv_check_perm(old_bs, NULL, perm, shared_perm, NULL, - &tighten_restrictions, NULL); - assert(tighten_restrictions == false); + &abort_on_set_to_true, NULL); + assert(abort_on_set_to_true == false); if (ret < 0) { /* We only tried to loosen restrictions, so errors are not fatal */ bdrv_abort_perm_update(old_bs); From patchwork Fri Nov 20 16:16:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 1403887 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=virtuozzo.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=selector2 header.b=rgm236Hs; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Cd1z239c6z9s1l for ; Sat, 21 Nov 2020 03:22:06 +1100 (AEDT) Received: from localhost ([::1]:44322 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kg9Ai-0002Pw-EF for incoming@patchwork.ozlabs.org; Fri, 20 Nov 2020 11:22:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60452) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kg95c-0003lo-02; Fri, 20 Nov 2020 11:16:48 -0500 Received: from mail-am6eur05on2104.outbound.protection.outlook.com ([40.107.22.104]:54753 helo=EUR05-AM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kg95Z-0004qy-DG; Fri, 20 Nov 2020 11:16:47 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Tt5u+WwyeopEad9usl66GWWpjPyrhKFPyNi1TM0aD55e2sIIEmqPDBrIJVk+O7XPS/GfTXdyvqNTkj95okXFF+ruREgP4d93QmhtV00a+YrDfp7CHMeAQPQUrLc94OuAP1mLLdWcV0V1yVz4wWoZbgm9A503Jsg1PJZvbUQgQwrMF84/nTjRcWEskGqqhKSPn+iiVHh1iKjzNa4Yzf7onn+SLHQTLNcuxz6VXY19RfqbvJqnlwFHk7AKP+0YoSXa7jjNjTo+HInm67pWgs5zqGC/TZUMwNN+QgWs//4/XISVy8YXilLT+u8YlCFRMy11c5N6o0AYBQh13IY859//8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wzklPuQgaY8GtbZwGNAlnHUKMDmqe45TItkylDwk4Ls=; b=Dd8L8e23gXkA4r3kxs584mlRZlO6f0u8rWKjlLUhEjggcYUMJhaClgCdIWWdK/cs+NQOqJxKmIXLMI186Mcts8/AvrvnKIgz0hRAlFTMHWwZpdlNxG9y46C3jhHp6mzyCNW/pOMeFRN+lYtyz9RB6NLvsz8rBmTkWlP3VvcUuoGbE4Ip0XTF3Okn/oYOpW9nxEN1Z8ZAtEDMonZ5obNr/UXsqCqA4PGtXEbHFkDB+JLtVRb0m+1kVJLKVoALptS989h0qCT2Gtdb63l5u6ZTsC18GUHarc9nBs86GU3xBPbPLkwG801Ca6qfiBMOc4tSNNcQcihNWJLLOY1sMvh0xw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wzklPuQgaY8GtbZwGNAlnHUKMDmqe45TItkylDwk4Ls=; b=rgm236HsEhAs3/DSGkLTBf1jW1O8Qqbvk7SGncYtL+FzZPO4PxwON2rf3pReIEgFmQr37jBlEIBKgBci0EwBULJdZpFhlf2JeZu9AVNBUz8Y+9yS1qHdtb8dN+m90DSkLA0J/QXsLriJk4TyOMe77YKav6jboiI9NfaJZ3ADwos= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM7PR08MB5333.eurprd08.prod.outlook.com (2603:10a6:20b:104::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3564.26; Fri, 20 Nov 2020 16:16:38 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::fd02:1330:f620:1243]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::fd02:1330:f620:1243%9]) with mapi id 15.20.3589.021; Fri, 20 Nov 2020 16:16:38 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, jsnow@redhat.com, mreitz@redhat.com, kwolf@redhat.com, philmd@redhat.com, peter.maydell@linaro.org, berto@igalia.com, stefanha@redhat.com, pbonzini@redhat.com, vsementsov@virtuozzo.com, den@openvz.org, eblake@redhat.com Subject: [PATCH 2/5] iotest-30-shorten: concentrate on failing test case Date: Fri, 20 Nov 2020 19:16:19 +0300 Message-Id: <20201120161622.1537-3-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20201120161622.1537-1-vsementsov@virtuozzo.com> References: <20201120161622.1537-1-vsementsov@virtuozzo.com> X-Originating-IP: [185.215.60.108] X-ClientProxiedBy: FR2P281CA0022.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:14::9) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from kvm.sw.ru (185.215.60.108) by FR2P281CA0022.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:14::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3611.13 via Frontend Transport; Fri, 20 Nov 2020 16:16:37 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e843fc6b-a876-493c-6352-08d88d6fa898 X-MS-TrafficTypeDiagnostic: AM7PR08MB5333: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3631; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TBuhbqN8OuZ3nLUF1SHvExf/cXqGRKOJydovtiDb+R7zYHZSd4vZz7CPS32GHWZMVKzbxtPGQ9qY5UzmgZv6lWAdYD/HIWMnGplf2sF1gj3VePsB458j11YKC7Vm2uV7SJYq4TMFNASwvG3xJK/xScAQhVOey/bPTJjgcgpK57iR5Mohb5rpFCjjJjx0HffFviZdYCXIVVO3+pHabg3E7SHb1iYOe0D/ZscAO5kLCNDCyVN64JwcP6mYz17lLzbEYGJ9BtYRRXRbjpZu55a6R2KbR6Oky8xollsWPhPUi8dShDnjsEYoZWuK1vOWKFOzQtoWgJLMSMounsuXprDuuQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(366004)(136003)(376002)(39840400004)(396003)(6512007)(1076003)(2616005)(7416002)(6916009)(66556008)(2906002)(478600001)(83380400001)(52116002)(66476007)(66946007)(86362001)(26005)(5660300002)(316002)(6666004)(956004)(6506007)(36756003)(16526019)(6486002)(8936002)(186003)(8676002)(4326008); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: HqfcYm6Lc78lvkueACGNKBZ3OkR94xpFq3CV6G4oGVk2NyoEAWxiBhCoyJDi+jx4/HNA26CqiENXT6TEG7Md1tbAOcIdW8VbhSppp/XNQesqF2U2NXs9PgDmzJNyIHsguYUvbD//xAzZHC7pPCBf211YrEZPdpaPd9rmzYLFG/8/iT1UIVKbvR3OkWPOaUZ+JUPMiuJrahfc5Jx8PQiOKO74SqaGdTJLBu1mbV2wxnapnIopZUZWgo0TBUjyrQ6nqxyeA0M7jhqfmK6k8EZFjWpnY6wIbxuziwtIZVnipzl9R4/OewFooJTDTCSf5eRkZWO62xQuwWlSqvNCFz37SlGgBQX8p1QEzZlbF7gKE/KHAOlIc1n6AuuIiMNLbCECnB1gL7+5q/HgSYXIRZq3ZzyYf99750KOsIfK291Qn9dCdmfQS5ECW6tdKwp94cNEVcfFokfe0vPAh2/jsrP7LGSGmx715hZ1w0ERA/x5/T5MIIBCm20CPco+i5MGgGFES/LOi79CoFE74X4qVXLfhBkDviQfdjQMOtsGonqcTCP0jQ3OSkoCXPOwFdm9x+Jnn01pLqMU7pul9yvqhvQ1yof6GAJzUnDw+6d55DcotZuuAdcew/cUfTLIYpOrQLuJvH4YuCB/5a5cimdCsydeDw== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: e843fc6b-a876-493c-6352-08d88d6fa898 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Nov 2020 16:16:38.4222 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: eKSRlDoByr1PAEEFfPtyiJsk4tKs+Q5/zamjizyGixFwMun114qR+jprXQUFgs9aPmL5MEkyvnZTB4jM7Qz8PHTQxXKz1HqsXvi/Hx9Mv7I= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5333 Received-SPF: pass client-ip=40.107.22.104; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-AM6-obe.outbound.protection.outlook.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/030 | 52 +++++++++++++++++++------------------- tests/qemu-iotests/030.out | 4 +-- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030 index dcb4b5d6a6..9e92ec3dd7 100755 --- a/tests/qemu-iotests/030 +++ b/tests/qemu-iotests/030 @@ -52,7 +52,7 @@ class TestSingleDrive(iotests.QMPTestCase): os.remove(mid_img) os.remove(backing_img) - def test_stream(self): + def ntest_stream(self): self.assert_no_active_block_jobs() result = self.vm.qmp('block-stream', device='drive0') @@ -67,7 +67,7 @@ class TestSingleDrive(iotests.QMPTestCase): qemu_io('-f', iotests.imgfmt, '-c', 'map', test_img), 'image file map does not match backing file after streaming') - def test_stream_intermediate(self): + def ntest_stream_intermediate(self): self.assert_no_active_block_jobs() self.assertNotEqual(qemu_io('-f', 'raw', '-rU', '-c', 'map', backing_img), @@ -86,7 +86,7 @@ class TestSingleDrive(iotests.QMPTestCase): qemu_io('-f', iotests.imgfmt, '-c', 'map', mid_img), 'image file map does not match backing file after streaming') - def test_stream_pause(self): + def ntest_stream_pause(self): self.assert_no_active_block_jobs() self.vm.pause_drive('drive0') @@ -116,7 +116,7 @@ class TestSingleDrive(iotests.QMPTestCase): qemu_io('-f', iotests.imgfmt, '-c', 'map', test_img), 'image file map does not match backing file after streaming') - def test_stream_no_op(self): + def ntest_stream_no_op(self): self.assert_no_active_block_jobs() # The image map is empty before the operation @@ -134,7 +134,7 @@ class TestSingleDrive(iotests.QMPTestCase): self.assertEqual(qemu_io('-f', iotests.imgfmt, '-c', 'map', test_img), empty_map, 'image file map changed after a no-op') - def test_stream_partial(self): + def ntest_stream_partial(self): self.assert_no_active_block_jobs() result = self.vm.qmp('block-stream', device='drive0', base=backing_img) @@ -149,16 +149,16 @@ class TestSingleDrive(iotests.QMPTestCase): qemu_io('-f', iotests.imgfmt, '-c', 'map', test_img), 'image file map does not match backing file after streaming') - def test_device_not_found(self): + def ntest_device_not_found(self): result = self.vm.qmp('block-stream', device='nonexistent') self.assert_qmp(result, 'error/desc', 'Cannot find device=nonexistent nor node_name=nonexistent') - def test_job_id_missing(self): + def ntest_job_id_missing(self): result = self.vm.qmp('block-stream', device='mid') self.assert_qmp(result, 'error/desc', "Invalid job ID ''") - def test_read_only(self): + def ntest_read_only(self): # Create a new file that we can attach (we need a read-only top) with iotests.FilePath('ro-top.img') as ro_top_path: qemu_img('create', '-f', iotests.imgfmt, ro_top_path, @@ -230,7 +230,7 @@ class TestParallelOps(iotests.QMPTestCase): # Test that it's possible to run several block-stream operations # in parallel in the same snapshot chain @unittest.skipIf(os.environ.get('QEMU_CHECK_BLOCK_AUTO'), 'disabled in CI') - def test_stream_parallel(self): + def ntest_stream_parallel(self): self.assert_no_active_block_jobs() # Check that the maps don't match before the streaming operations @@ -272,7 +272,7 @@ class TestParallelOps(iotests.QMPTestCase): # Test that it's not possible to perform two block-stream # operations if there are nodes involved in both. - def test_overlapping_1(self): + def ntest_overlapping_1(self): self.assert_no_active_block_jobs() # Set a speed limit to make sure that this job blocks the rest @@ -313,7 +313,7 @@ class TestParallelOps(iotests.QMPTestCase): # Similar to test_overlapping_1, but with block-commit # blocking the other jobs - def test_overlapping_2(self): + def ntest_overlapping_2(self): self.assertLessEqual(9, self.num_imgs) self.assert_no_active_block_jobs() @@ -349,7 +349,7 @@ class TestParallelOps(iotests.QMPTestCase): # Similar to test_overlapping_2, but here block-commit doesn't use the 'top' parameter. # Internally this uses a mirror block job, hence the separate test case. - def test_overlapping_3(self): + def ntest_overlapping_3(self): self.assertLessEqual(8, self.num_imgs) self.assert_no_active_block_jobs() @@ -377,7 +377,7 @@ class TestParallelOps(iotests.QMPTestCase): # In this case the base node of the stream job is the same as the # top node of commit job. Since this results in the commit filter # node being part of the stream chain, this is not allowed. - def test_overlapping_4(self): + def ntest_overlapping_4(self): self.assert_no_active_block_jobs() # Commit from node2 into node0 @@ -401,7 +401,7 @@ class TestParallelOps(iotests.QMPTestCase): # filter node. stream does not have a real dependency on its base # node, so even though commit removes it when it is done, there is # no conflict. - def test_overlapping_5(self): + def ntest_overlapping_5(self): self.assert_no_active_block_jobs() # Commit from node2 into node0 @@ -457,7 +457,7 @@ class TestParallelOps(iotests.QMPTestCase): # This is similar to test_stream_commit_1 but both jobs are slowed # down so they can run in parallel for a little while. - def test_stream_commit_2(self): + def ntest_stream_commit_2(self): self.assertLessEqual(8, self.num_imgs) self.assert_no_active_block_jobs() @@ -492,7 +492,7 @@ class TestParallelOps(iotests.QMPTestCase): self.assert_no_active_block_jobs() # Test the base_node parameter - def test_stream_base_node_name(self): + def ntest_stream_base_node_name(self): self.assert_no_active_block_jobs() self.assertNotEqual(qemu_io('-f', iotests.imgfmt, '-rU', '-c', 'map', self.imgs[4]), @@ -568,7 +568,7 @@ class TestQuorum(iotests.QMPTestCase): for img in self.backing: os.remove(img) - def test_stream_quorum(self): + def ntest_stream_quorum(self): self.assertNotEqual(qemu_io('-f', iotests.imgfmt, '-rU', '-c', 'map', self.children[0]), qemu_io('-f', iotests.imgfmt, '-rU', '-c', 'map', self.backing[0]), 'image file map matches backing file before streaming') @@ -601,7 +601,7 @@ class TestSmallerBackingFile(iotests.QMPTestCase): # If this hangs, then you are missing a fix to complete streaming when the # end of the backing file is reached. - def test_stream(self): + def ntest_stream(self): self.assert_no_active_block_jobs() result = self.vm.qmp('block-stream', device='drive0') @@ -659,7 +659,7 @@ class TestEIO(TestErrors): os.remove(backing_img) os.remove(self.blkdebug_file) - def test_report(self): + def ntest_report(self): self.assert_no_active_block_jobs() result = self.vm.qmp('block-stream', device='drive0') @@ -687,7 +687,7 @@ class TestEIO(TestErrors): self.assert_no_active_block_jobs() self.vm.shutdown() - def test_ignore(self): + def ntest_ignore(self): self.assert_no_active_block_jobs() result = self.vm.qmp('block-stream', device='drive0', on_error='ignore') @@ -720,7 +720,7 @@ class TestEIO(TestErrors): self.assert_no_active_block_jobs() self.vm.shutdown() - def test_stop(self): + def ntest_stop(self): self.assert_no_active_block_jobs() result = self.vm.qmp('block-stream', device='drive0', on_error='stop') @@ -763,7 +763,7 @@ class TestEIO(TestErrors): self.assert_no_active_block_jobs() self.vm.shutdown() - def test_enospc(self): + def ntest_enospc(self): self.assert_no_active_block_jobs() result = self.vm.qmp('block-stream', device='drive0', on_error='enospc') @@ -809,7 +809,7 @@ class TestENOSPC(TestErrors): os.remove(backing_img) os.remove(self.blkdebug_file) - def test_enospc(self): + def ntest_enospc(self): self.assert_no_active_block_jobs() result = self.vm.qmp('block-stream', device='drive0', on_error='enospc') @@ -870,7 +870,7 @@ class TestStreamStop(iotests.QMPTestCase): os.remove(test_img) os.remove(backing_img) - def test_stream_stop(self): + def ntest_stream_stop(self): self.assert_no_active_block_jobs() self.vm.pause_drive('drive0') @@ -918,7 +918,7 @@ class TestSetSpeed(iotests.QMPTestCase): self.assert_no_active_block_jobs() - def test_set_speed(self): + def ntest_set_speed(self): self.assert_no_active_block_jobs() self.vm.pause_drive('drive0') @@ -951,7 +951,7 @@ class TestSetSpeed(iotests.QMPTestCase): self.cancel_and_wait(resume=True) - def test_set_speed_invalid(self): + def ntest_set_speed_invalid(self): self.assert_no_active_block_jobs() result = self.vm.qmp('block-stream', device='drive0', speed=-1) diff --git a/tests/qemu-iotests/030.out b/tests/qemu-iotests/030.out index 6d9bee1a4b..ae1213e6f8 100644 --- a/tests/qemu-iotests/030.out +++ b/tests/qemu-iotests/030.out @@ -1,5 +1,5 @@ -........................... +. ---------------------------------------------------------------------- -Ran 27 tests +Ran 1 tests OK From patchwork Fri Nov 20 16:16:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 1403871 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=virtuozzo.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=selector2 header.b=uEyH4T4K; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Cd1sq6lm7z9s1l for ; Sat, 21 Nov 2020 03:17:35 +1100 (AEDT) Received: from localhost ([::1]:56944 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kg96L-0004Dw-VG for incoming@patchwork.ozlabs.org; Fri, 20 Nov 2020 11:17:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60484) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kg95e-0003t8-PX; Fri, 20 Nov 2020 11:16:50 -0500 Received: from mail-am6eur05on2104.outbound.protection.outlook.com ([40.107.22.104]:54753 helo=EUR05-AM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kg95c-0004qy-JW; Fri, 20 Nov 2020 11:16:50 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Syg/Z43ZWoH5YK6JoRGVpO63KzzviPORkXRcCcWV0tv5iLoegyGV+x+YaYWlIFqGFF71HK6zgeueSNUXEU4x1DixzeXNbqrAbGVbRSa9bWRAgxrXWZQFaHDNldwqMO1jFfdoNFZYJsn/7XZ5vBdefdj+yosjsQVTkYXMV5K/MpmjbdXPofzeusZeQNhiVUF7BP67bWGohtcYPa2jKv7LDsNko4kxfQBqNLYU5awTicqcBqcywmaoX/y+c8yjj2YuLstivyjtc52aBn66+7gFs/DceN5cd/mgreFLdY0jU9U78AeUTbCu9wPIUo/AVDjZUxUCnHDvwtO8SBe9QjnAyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4jnslqjR8WWX4QVbdpUQLv+HF1J8wrQumaUy5kTl2vM=; b=MpaoJ9S/qNvBLdqXnFQ8yEK3y8PtRogXaIeEAII04P3pbcA0VPl6IiYVrBqxaC3lpxP4ycz1asPDyu7htEIW7C08KyFEr+knRYoc+jb9mkp62KpBaDQIz3s2hynPuaGWikjmHNKw31jo3BWcrvKdzIs+28P/pZ0HJKdSmwRRyTVS9nnGttwU5G9BTqYvkfczybikldI7eqX3FTPjjmrihlZzlgMHYgwpcAp8VOCFOlGu/1idSTp9ea99eH3FwlYspv3c1HyHp4gICqhKKjRu4QdJZ/i5+nKSx5VuW/bmOjY0S0CAQ3Jaja+qmRfoTBoDrOBQU4uKR2w79T+GxVbJUg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4jnslqjR8WWX4QVbdpUQLv+HF1J8wrQumaUy5kTl2vM=; b=uEyH4T4Kd+r3bBdxLLk7aBoUy/fvAKLdcFsez+mPDiWrVpaAIxXSbcCKJhNdFB4O0vS2cf+BoupDcaD42DeRi4YD5reLnIKBs1g/QJ5dapbmXCGlLCxlCRZGQYkN97qpe02e0AaVMh5cPXKRfp7EmRRF7kY1CtVxiX0LC4PfZPg= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM7PR08MB5333.eurprd08.prod.outlook.com (2603:10a6:20b:104::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3564.26; Fri, 20 Nov 2020 16:16:39 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::fd02:1330:f620:1243]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::fd02:1330:f620:1243%9]) with mapi id 15.20.3589.021; Fri, 20 Nov 2020 16:16:39 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, jsnow@redhat.com, mreitz@redhat.com, kwolf@redhat.com, philmd@redhat.com, peter.maydell@linaro.org, berto@igalia.com, stefanha@redhat.com, pbonzini@redhat.com, vsementsov@virtuozzo.com, den@openvz.org, eblake@redhat.com Subject: [PATCH 3/5] scripts/block-coroutine-wrapper.py: allow more function types Date: Fri, 20 Nov 2020 19:16:20 +0300 Message-Id: <20201120161622.1537-4-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20201120161622.1537-1-vsementsov@virtuozzo.com> References: <20201120161622.1537-1-vsementsov@virtuozzo.com> X-Originating-IP: [185.215.60.108] X-ClientProxiedBy: FR2P281CA0022.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:14::9) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from kvm.sw.ru (185.215.60.108) by FR2P281CA0022.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:14::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3611.13 via Frontend Transport; Fri, 20 Nov 2020 16:16:38 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ac9c1c6a-5a2f-4b0b-a2ed-08d88d6fa93a X-MS-TrafficTypeDiagnostic: AM7PR08MB5333: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:580; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1cIypKctBniTQLgOM8ba2vcE4gFcNWeDU8QrIK4QQNrntxNl9pURn2kllQg4WzLRekoPOTv2UFUUM9t5Ar/brDJs5JtAnNj3/ohlmcyizSalfKCpy68OHy8v5udree8T5A2w741qR4pJYX981yZYqsbnZFvXThhu5nvc53KreFn1FnxayvS6nRJrnrBrLm+hgiL39hZT4ipE3lzq7nKHyHn1AfePh0KzvdggVnSQ+WKEhYgIwr6zrjNohkXdWukaEeeolzlD3oHZPevS/i1EFuU0VhW1yf3CWzaY13Ew/KddfA88VMfOVg2379uyFSQVQgAFAdGduAUdVxNZfwvEWQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(366004)(136003)(376002)(39840400004)(396003)(6512007)(1076003)(2616005)(7416002)(6916009)(66556008)(2906002)(478600001)(83380400001)(52116002)(66476007)(66946007)(86362001)(26005)(5660300002)(316002)(6666004)(956004)(6506007)(36756003)(16526019)(6486002)(8936002)(186003)(8676002)(4326008); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: CWb6dCnUm+vKYQxU6wsVHOU3OdzXI0yhRq0zQma+IzsriyyjtHvIhy/YPC4WIsb1Z1oScOYdP6wT+gGKcgBn/t9++YRKnwj4CZ+SboCgAM3hxp/Yc3FZ2PRiZYSGckgNJ8LRdMAk1dY6CfrEyrtRoROdRFiW/u7PleEMnRNWxj1t7zkCstKSkgB20s1Hm/Gil+ad1CC802nap1xv4CYveMBePbDS+7XNcJJUel9Am0nLlAMlKs+TZOx9l2W6HCvpJ1l1X4h203pHSI26PkAu0lJ8tmByYW9sgNvWrSpR6N2QyaS1h22fr+eNsA4xIKsoG8KplDeEQacHC+0dfMGFVc9QLaM6apTJkkaW49UYBS2f88FOs1/h1hxQPq7/OBicmX+r7lW5r+id5RFwDBkKF+Ah+Im8jQ83MUrkIhotpL2gI2qrtWm5yhJH5wVOT142mVj0Avr1MfLncrYM7v6ZQeB9EfYngMRNRqqztQW8rVxPRnJ2lXtYf+qTdtcfdrFs5c7pPdgMpDvsfZ2YIoJt7eFWjEPbembnYQjl+hemOKhYdv+/43Kp8bNgvIUSsO/Wt9DG6GutGyMy3DcQHPchWv/r+4FLBJ2To5CK+jl7tGzwq+xyWImfY9k/Krev7c61mS06Bqb/DD5b5kOMuaZh+Q== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: ac9c1c6a-5a2f-4b0b-a2ed-08d88d6fa93a X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Nov 2020 16:16:39.4706 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: BLkuVR4NRqr8hVEY/1fyH0AfOzPxcIdqvSOZjPP9zFpHD4RP8ApFh0AsynjqVEZQieCJCVLlf/En3+xa5urZ56e4FpJW94lYLofO93HZvpU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5333 Received-SPF: pass client-ip=40.107.22.104; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-AM6-obe.outbound.protection.outlook.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Allow void functions, functions with first argument of type "Job *" and functions not starting with "bdrv_". Signed-off-by: Vladimir Sementsov-Ogievskiy --- scripts/block-coroutine-wrapper.py | 36 +++++++++++++++++++----------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/scripts/block-coroutine-wrapper.py b/scripts/block-coroutine-wrapper.py index 0461fd1c45..68fad41f19 100644 --- a/scripts/block-coroutine-wrapper.py +++ b/scripts/block-coroutine-wrapper.py @@ -64,6 +64,7 @@ class ParamDecl: class FuncDecl: def __init__(self, return_type: str, name: str, args: str) -> None: self.return_type = return_type.strip() + self.void = return_type == 'void' self.name = name.strip() self.args = [ParamDecl(arg.strip()) for arg in args.split(',')] @@ -73,16 +74,19 @@ class FuncDecl: def gen_block(self, format: str) -> str: return '\n'.join(format.format_map(arg.__dict__) for arg in self.args) + def if_ret(self, value: str) -> str: + return '' if self.void else value + # Match wrappers declared with a generated_co_wrapper mark -func_decl_re = re.compile(r'^int\s*generated_co_wrapper\s*' +func_decl_re = re.compile(r'^(?P(void|int))\s*generated_co_wrapper\s*' r'(?P[a-z][a-z0-9_]*)' r'\((?P[^)]*)\);$', re.MULTILINE) def func_decl_iter(text: str) -> Iterator: for m in func_decl_re.finditer(text): - yield FuncDecl(return_type='int', + yield FuncDecl(return_type=m.group('return_type'), name=m.group('wrapper_name'), args=m.group('args')) @@ -98,13 +102,19 @@ def snake_to_camel(func_name: str) -> str: def gen_wrapper(func: FuncDecl) -> str: - assert func.name.startswith('bdrv_') - assert not func.name.startswith('bdrv_co_') - assert func.return_type == 'int' - assert func.args[0].type in ['BlockDriverState *', 'BdrvChild *'] - - name = 'bdrv_co_' + func.name[5:] - bs = 'bs' if func.args[0].type == 'BlockDriverState *' else 'child->bs' + subsystem, rname = func.name.split('_', 1) + assert not rname.startswith('co_') + assert func.return_type in ('int', 'void') + assert func.args[0].type in ['BlockDriverState *', 'BdrvChild *', 'Job *'] + + name = f'{subsystem}_co_{rname}' + arg0_t = func.args[0].type + if arg0_t == 'BlockDriverState *': + bs = 'bs' + elif arg0_t == 'BdrvChild *': + bs = 'child->bs' + elif arg0_t == 'Job *': + bs = 'blk_bs(container_of(job, BlockJob, job)->blk)' struct_name = snake_to_camel(name) return f"""\ @@ -121,16 +131,16 @@ static void coroutine_fn {name}_entry(void *opaque) {{ {struct_name} *s = opaque; - s->poll_state.ret = {name}({ func.gen_list('s->{name}') }); + {func.if_ret('s->poll_state.ret = ')}{name}({ func.gen_list('s->{name}') }); s->poll_state.in_progress = false; aio_wait_kick(); }} -int {func.name}({ func.gen_list('{decl}') }) +{func.return_type} {func.name}({ func.gen_list('{decl}') }) {{ if (qemu_in_coroutine()) {{ - return {name}({ func.gen_list('{name}') }); + {func.if_ret('return ')}{name}({ func.gen_list('{name}') }); }} else {{ {struct_name} s = {{ .poll_state.bs = {bs}, @@ -141,7 +151,7 @@ int {func.name}({ func.gen_list('{decl}') }) s.poll_state.co = qemu_coroutine_create({name}_entry, &s); - return bdrv_poll_co(&s.poll_state); + {func.if_ret('return ')}bdrv_poll_co(&s.poll_state); }} }}""" From patchwork Fri Nov 20 16:16:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 1403882 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=virtuozzo.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=selector2 header.b=MtNrwD2H; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Cd1x83QmQz9sT6 for ; Sat, 21 Nov 2020 03:20:28 +1100 (AEDT) Received: from localhost ([::1]:37964 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kg998-00086V-BA for incoming@patchwork.ozlabs.org; Fri, 20 Nov 2020 11:20:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60500) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kg95h-0003zn-HQ; Fri, 20 Nov 2020 11:16:53 -0500 Received: from mail-am6eur05on2104.outbound.protection.outlook.com ([40.107.22.104]:54753 helo=EUR05-AM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kg95f-0004qy-DR; Fri, 20 Nov 2020 11:16:53 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Npqx6xJJYUlnRTtIqg8QfDrvtI31z5b6nb3xz1YfT2CS4+5JT/Lnnr7iqeOpyhfdojCzoMubCJWZILhchpe2MmjbvLKADBOgc+SQq5w4n2QFN+xE7esK/GjDA5OTEoT1ofUu4GiF71KuILcF4Dk920hxoQ2X/IBoGk+pABz9yIjq1a4LBajtY3vGsEDEbWNAM1dPZtf8Hr6PisQos7Td+GdAfnVMjfLXTSdLhVeMHEZYsGeFYnSY6g4592wnvGlSzpHHDtTFEpglfTnmEn+mvrq/IkdPPC3hmFXIZtGezHCXpuqFLILVQdO726ekTh/ifVJ0I4lehbFvUJQ0O1x2sQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=m+Hn7GM9GmyDmZOUGd+/VwlV/H7JIh6yI6QoehPwoxk=; b=KmCKLkweHeVF2NVJVp7FJN6wssMOrlsvPD8q6Ec7jKOjQNNX9quYhBsM20PJpZlnQr1WyVcQ9bK72h1WY1sdch1tJlOlyHyl04Nj76zVdsQmUtyUDWKTYUmReZKwUoQzFfZDqmzFB+F6G7s9oLt6JCGi1FTk+de9ImnDepnj/hhMI1Xp1Kho3Nn3kpmPJ4UwN+YBcJQAr9W14eNzhJ9Gf33HTEfltaFSh0dGk05sp/x0dtCQk1yScHG8d6v0xNcQt4ECzSAeVWOPlnBu9blNVql21ZddbY+c0BUevwLN3OYJ+T6fDoLix1oGQuequCfHkl1+uIft7oqFqkQqGuQEbg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=m+Hn7GM9GmyDmZOUGd+/VwlV/H7JIh6yI6QoehPwoxk=; b=MtNrwD2HICnHO1pQFjg1IHS9hPCCk8E9PhOf8f97ZvUyRFotudHaPxrXY78bg+k8KaSKD8rfgoWLWolvbrFTCUHE0MqWb7fQsPNzuVCgFPIJFMVpHY87GJ7iG95g4GfeLeaJ6ykxbBO7kNHCZra+lHLj/T1fgPAM9cVIaM4gixE= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM7PR08MB5333.eurprd08.prod.outlook.com (2603:10a6:20b:104::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3564.26; Fri, 20 Nov 2020 16:16:40 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::fd02:1330:f620:1243]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::fd02:1330:f620:1243%9]) with mapi id 15.20.3589.021; Fri, 20 Nov 2020 16:16:40 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, jsnow@redhat.com, mreitz@redhat.com, kwolf@redhat.com, philmd@redhat.com, peter.maydell@linaro.org, berto@igalia.com, stefanha@redhat.com, pbonzini@redhat.com, vsementsov@virtuozzo.com, den@openvz.org, eblake@redhat.com Subject: [PATCH 4/5] block: move some mirror and stream handlers to coroutine Date: Fri, 20 Nov 2020 19:16:21 +0300 Message-Id: <20201120161622.1537-5-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20201120161622.1537-1-vsementsov@virtuozzo.com> References: <20201120161622.1537-1-vsementsov@virtuozzo.com> X-Originating-IP: [185.215.60.108] X-ClientProxiedBy: FR2P281CA0022.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:14::9) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from kvm.sw.ru (185.215.60.108) by FR2P281CA0022.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:14::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3611.13 via Frontend Transport; Fri, 20 Nov 2020 16:16:39 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 682a94dc-a2b3-480c-d553-08d88d6fa9d4 X-MS-TrafficTypeDiagnostic: AM7PR08MB5333: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:159; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AoBY1Mpsu+A4H20BHKkZm8HKAuL7qpWHwEMJxdzbfw08r4bS4tmLetMs8d1t6vdVrOnZSP4DtR7h8sWT1E5GlyTbZvm2fJlEk35pKaKkXDhCB3BY03PUKApGCGtip8tEvlSdtRoHWPIqQDteNbMZDp0W51PJglj0R+vqG1nlnWCI0wiois5Mr7NeWjkj2I0BuNR5xtsZilimw7HF5kwLe+RevX7QztCTNVStVCLEjj7OOQYZafZo8vkqWpujWGmRsmBrqbG6ddS9AoWNI0HsYM1R78+R5ODeQ/Ds873aiytFv2jnvBHyHSSgtLMwqpij7hSAl8UFAtIIvY+nDoc9gw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(366004)(136003)(376002)(39840400004)(396003)(6512007)(1076003)(2616005)(7416002)(6916009)(66556008)(2906002)(478600001)(83380400001)(52116002)(66476007)(66946007)(86362001)(26005)(5660300002)(316002)(6666004)(956004)(6506007)(36756003)(16526019)(6486002)(8936002)(186003)(8676002)(4326008); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: INwFMzvsmfoXJ5IT9zqeHedVG0fxUucxmHCN9EdHrypS9jH62+HTZ9ftCsmiAhCqb6CfGZWRXyWOvIHpbj989cAnvQYMG3S0kNa49mBGX4eOpl0kuOf+JX/FJgKGvFxYrLS8de5TlHB7yXov9VjEyeTKQL324YTA0lSfD13VPdA2SYflJod+UgLQpE8SrWS1uvD9oASkX8PNmrxmSdJFfNaKlzWQHEmRPEfoYxQvfpCg0cvVG4DAhPLqHsfW1yNjGgxJAPKe57tzKJIJZNwKybyQDaUc+/QaBgABOq+N1uTzo9zDlpWnm6MVBeifmIrTntN6HA/gQbxnC2LfbuJ+h9FMLmK0WuVZdyrnSXMLT46K9LFt6paDOJizuh0H4rxVz/sfMuA6QdGa1OnEcZ2GU532KrHQHm1lt4v0f8Q7xitL9LkT07EsphQzImabr9LqrwEpcjWzMWo/v25QQC9wgeFg/WRB2Cn0MENx28vE1fKg4jsHMBcK3lpVXFuAMX1AQbrbEdHuowAUxuCnopByGK9kRr4PUVvioju1TqySEl/kuD0dK90Ia9GfUI5zyZujCK2Q5aV3NoKPp9G0bMGt/DZNY4Uo+03gS1ODXELYAHRFKgu6MdvP1HjXBR1R3j1cYhBXoC/B8KmN0WOmaRWjOA== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 682a94dc-a2b3-480c-d553-08d88d6fa9d4 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Nov 2020 16:16:40.4901 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: fV4DbRO6KUAkvY3n17tVLP0tiLa56js53TU+wLrV3rebVfZnx+ouiHV1aHfesCztq0ro5CPv0uJAf+k7fuXWIWrfdIAtYBGlBGtflOXP0MQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5333 Received-SPF: pass client-ip=40.107.22.104; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-AM6-obe.outbound.protection.outlook.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" We are going to use coroutine mutex to protect intersection of these graph modifying things. Move them to coroutine now. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/coroutines.h | 11 +++++++++++ block/mirror.c | 5 +++-- block/stream.c | 5 +++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/block/coroutines.h b/block/coroutines.h index 4cfb4946e6..aa60747b2f 100644 --- a/block/coroutines.h +++ b/block/coroutines.h @@ -26,6 +26,7 @@ #define BLOCK_COROUTINES_INT_H #include "block/block_int.h" +#include "sysemu/block-backend.h" int coroutine_fn bdrv_co_check(BlockDriverState *bs, BdrvCheckResult *res, BdrvCheckMode fix); @@ -66,4 +67,14 @@ int coroutine_fn bdrv_co_readv_vmstate(BlockDriverState *bs, int coroutine_fn bdrv_co_writev_vmstate(BlockDriverState *bs, QEMUIOVector *qiov, int64_t pos); +void generated_co_wrapper stream_clean(Job *job); +void coroutine_fn stream_co_clean(Job *job); +int generated_co_wrapper stream_prepare(Job *job); +int coroutine_fn stream_co_prepare(Job *job); + +void generated_co_wrapper mirror_complete(Job *job, Error **errp); +void coroutine_fn mirror_co_complete(Job *job, Error **errp); +int generated_co_wrapper mirror_exit_common(Job *job); +int coroutine_fn mirror_co_exit_common(Job *job); + #endif /* BLOCK_COROUTINES_INT_H */ diff --git a/block/mirror.c b/block/mirror.c index 8e1ad6eceb..91e98b2349 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -18,6 +18,7 @@ #include "trace.h" #include "block/blockjob_int.h" #include "block/block_int.h" +#include "block/coroutines.h" #include "sysemu/block-backend.h" #include "qapi/error.h" #include "qapi/qmp/qerror.h" @@ -625,7 +626,7 @@ static void coroutine_fn mirror_wait_for_all_io(MirrorBlockJob *s) * for .prepare, returns 0 on success and -errno on failure. * for .abort cases, denoted by abort = true, MUST return 0. */ -static int mirror_exit_common(Job *job) +int coroutine_fn mirror_co_exit_common(Job *job) { MirrorBlockJob *s = container_of(job, MirrorBlockJob, common.job); BlockJob *bjob = &s->common; @@ -1103,7 +1104,7 @@ immediate_exit: return ret; } -static void mirror_complete(Job *job, Error **errp) +void coroutine_fn mirror_co_complete(Job *job, Error **errp) { MirrorBlockJob *s = container_of(job, MirrorBlockJob, common.job); BlockDriverState *target; diff --git a/block/stream.c b/block/stream.c index 236384f2f7..8a4b88b223 100644 --- a/block/stream.c +++ b/block/stream.c @@ -15,6 +15,7 @@ #include "trace.h" #include "block/block_int.h" #include "block/blockjob_int.h" +#include "block/coroutines.h" #include "qapi/error.h" #include "qapi/qmp/qerror.h" #include "qemu/ratelimit.h" @@ -58,7 +59,7 @@ static void stream_abort(Job *job) } } -static int stream_prepare(Job *job) +int coroutine_fn stream_co_prepare(Job *job) { StreamBlockJob *s = container_of(job, StreamBlockJob, common.job); BlockJob *bjob = &s->common; @@ -90,7 +91,7 @@ static int stream_prepare(Job *job) return ret; } -static void stream_clean(Job *job) +void coroutine_fn stream_co_clean(Job *job) { StreamBlockJob *s = container_of(job, StreamBlockJob, common.job); BlockJob *bjob = &s->common; From patchwork Fri Nov 20 16:16:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 1403886 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=virtuozzo.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=selector2 header.b=Is5/QYVi; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Cd1yg6YMDz9s1l for ; Sat, 21 Nov 2020 03:21:47 +1100 (AEDT) Received: from localhost ([::1]:42948 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kg9AP-0001pN-ST for incoming@patchwork.ozlabs.org; Fri, 20 Nov 2020 11:21:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60520) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kg95k-000462-1c; Fri, 20 Nov 2020 11:16:56 -0500 Received: from mail-am6eur05on2104.outbound.protection.outlook.com ([40.107.22.104]:54753 helo=EUR05-AM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kg95i-0004qy-6P; Fri, 20 Nov 2020 11:16:55 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XF29OQ0X/NE3h3+AE6ZaMDR+nGYx2TPZYMLZEOkJQ0ErPE2ae1FnEIFX6XSq8ShprBcfmFsfdD6/+khdt/sX7zVLSzOY7UKwZ6I1q3/HTL5hQMt4WwZvjhYDIqghGluSFSCbxaW1jX3kSJasgejYgZzmpNTftf1440Km1aRIGuMjx94mBF6jnU4/sVSIKwplWJ3pr0FkTuuXy8ce6XDBEq6GQfZj2ofkyf4mfkPDuKwymDy7NRiglwINONeQ4LOj/Hu9bT8E1Js3DQAkLa8s2D5D2NC3L/h6Tg96SZidehXyy72YNOxlw5aWdbFtkDjmaorNUL2goUlXYmOQGDyILg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rHmKSjGAlqfoiovHYXgS1epKt6vfDUsEUSffQHyAwAM=; b=nqsKKg9dlMwIxIixfh25O6nPOcTy6P9iLm+LhyRCwWu7EoDFpbfAfI9PrP7paFHaflxWoHEX5DnUcfctWEUcmy5XmUTc+eumI79S9P5y2F8CE5vs9bahwd0yPfKKm/pJ/D/FMHD9ZeH3+5pWmMqbO5wlYi9oSmoyogiBOpinCddTIJCE03C4ZMm8JQg5zBl+5vPOgY4yNK8ynOM+cIdMLZDevP+8Wn2Boxy2vP2sMjziuDW4/SPQh7rbc9KAbc12M5BnGxsR9IlLvJ22ORyP2tEqCSKhfLM1ZJ/sq+FGYInflK7BEeq6H3O7IeT2xtyC3GMOq5WD+Y9kphy2a4gh5g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rHmKSjGAlqfoiovHYXgS1epKt6vfDUsEUSffQHyAwAM=; b=Is5/QYViYPZ5vhVcZpvK/dzFOJcFfA2SZJb59IkL71WWNaQOxPngrwXFI9wq5qezWB7SVLopV9+LEYH+MvxO2nxGCizpz6f6bmMwwhJVaFDimG+3pymA/NmgE7D4ihIH+Zy2M+v5RA+/1YBO933dFyGKgJpJhYoG3udccp5DzWU= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM7PR08MB5333.eurprd08.prod.outlook.com (2603:10a6:20b:104::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3564.26; Fri, 20 Nov 2020 16:16:41 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::fd02:1330:f620:1243]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::fd02:1330:f620:1243%9]) with mapi id 15.20.3589.021; Fri, 20 Nov 2020 16:16:41 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, jsnow@redhat.com, mreitz@redhat.com, kwolf@redhat.com, philmd@redhat.com, peter.maydell@linaro.org, berto@igalia.com, stefanha@redhat.com, pbonzini@redhat.com, vsementsov@virtuozzo.com, den@openvz.org, eblake@redhat.com Subject: [PATCH 5/5] block: protect some graph-modifyng things by mutex Date: Fri, 20 Nov 2020 19:16:22 +0300 Message-Id: <20201120161622.1537-6-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20201120161622.1537-1-vsementsov@virtuozzo.com> References: <20201120161622.1537-1-vsementsov@virtuozzo.com> X-Originating-IP: [185.215.60.108] X-ClientProxiedBy: FR2P281CA0022.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:14::9) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from kvm.sw.ru (185.215.60.108) by FR2P281CA0022.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:14::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3611.13 via Frontend Transport; Fri, 20 Nov 2020 16:16:40 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9691a7e6-6616-4794-65c0-08d88d6faa70 X-MS-TrafficTypeDiagnostic: AM7PR08MB5333: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:197; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: b10ZlUuJuem1/KSuv1T0SQ7CgtYrB0DHe/v4+kzgmaAkIsaZMou0hUCXz+Q2kIg35v1tOo4KjPOTh8rYNwTSem0soW9x5Cb37toeJj1yvVUjxHBtVsj00MY/MUguMgwtfG4Lsysns12RGIkS9t5VwwJij0GU9HyjOkEDhTXlRD0r7GRrbUaYxODC5asl3OSVpJ1ghnId12SaaJpSrFxLkPjqZQMiVIA/W4UUKPBQUP2bvImKpgw+1593I4QcHJ6fWDFzUALx3uBPoWbW1vUV2al6/Wpr1e1hA7esJeIQVfdz29hZ/lnmzwy/buoEyZ65 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(366004)(136003)(376002)(39840400004)(396003)(6512007)(1076003)(2616005)(7416002)(6916009)(66556008)(2906002)(478600001)(83380400001)(52116002)(66476007)(66946007)(86362001)(26005)(5660300002)(316002)(6666004)(956004)(6506007)(36756003)(16526019)(6486002)(8936002)(186003)(8676002)(4326008); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: ny9MJUac8+xmpC7QcI1LxSWCbEj/0XD0Blq8gAViUZBa8Yz58YDRRm2DAFRq4FkCm/6dy5ih/nOQep+tII8bawcN7PvPVZloOfR+55CIteRd0yy/PiUzg8/2dLqSHnU9I9XS1a/cI6M0U38dMmPR+LEgp9KW8YLuHXdMDrAgq9gGTHJPbMAzt5IejFcie1DqaI+i/Lu70RE5lFht2MT+OeIBO2b7bRAESKqKOlZzPt6If2C3+qGjbmiqHghuef5ZAuv8Scj0LDzg8VOMHAkPSRIwZu9pzGtTjPV3tdenU2BTelF4t0sPUC0uAjj2Qx9c+YrA8smlSTQCxiZizCyGzWHlhM8st0z4C7NU/AaDyJ0Wucw09ysaSOnYi86D/W2aUIivR4OZXv0ITZlWqbWy9MUGSCle9OKDOdVrsTdfaCu6M/Y4Wmt0I7ZyBgDjiiC/S01ccS8fl2YIiW9bJF4euSkCCNEYk9ptO/KFlFSGyRIohRMMCRbfOJnLn9iGGn7A/s2o/3rORbAPp3RHem/B6QSgKarQl7r0OO4jUNhUVzeXiHl51xsSYS86BS5Q43eEcaYurAjw/vDsoWESVMoUjMhzwuFBGOHF3EVeym7IbivUXI9/crw68W9dn1D7daoPAVDoc0VRpL6MwMcgoLu8Zw== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9691a7e6-6616-4794-65c0-08d88d6faa70 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Nov 2020 16:16:41.4518 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: lU4KCeQFQ2M6wpDJTQCZL7Zczq5O/UlPopcuKTAE0nm49Ex0Ck13tGBy/OVE9DODEF50SQcRYvtNS8I0TXV+kfH8eIRVnJf68YePlLsMNk8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5333 Received-SPF: pass client-ip=40.107.22.104; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-AM6-obe.outbound.protection.outlook.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Iotest 30 accidentally fails due to interleaving of mirror and stream graph-modifying procedures. Protect these things by global co-mutex. Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/block/block.h | 2 ++ block.c | 2 ++ block/mirror.c | 4 ++++ block/stream.c | 4 ++++ 4 files changed, 12 insertions(+) diff --git a/include/block/block.h b/include/block/block.h index c9d7c58765..a92756cbfc 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -20,6 +20,8 @@ */ #define generated_co_wrapper +extern CoMutex graph_modify_mutex; + /* block.c */ typedef struct BlockDriver BlockDriver; typedef struct BdrvChild BdrvChild; diff --git a/block.c b/block.c index 5e8dd98cec..eb82b1ca1e 100644 --- a/block.c +++ b/block.c @@ -86,6 +86,8 @@ static int use_bdrv_whitelist; bool abort_on_set_to_true = false; +CoMutex graph_modify_mutex; + #ifdef _WIN32 static int is_windows_drive_prefix(const char *filename) { diff --git a/block/mirror.c b/block/mirror.c index 91e98b2349..16c3e0b0cb 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -628,6 +628,8 @@ static void coroutine_fn mirror_wait_for_all_io(MirrorBlockJob *s) */ int coroutine_fn mirror_co_exit_common(Job *job) { + QEMU_LOCK_GUARD(&graph_modify_mutex); + MirrorBlockJob *s = container_of(job, MirrorBlockJob, common.job); BlockJob *bjob = &s->common; MirrorBDSOpaque *bs_opaque; @@ -1106,6 +1108,8 @@ immediate_exit: void coroutine_fn mirror_co_complete(Job *job, Error **errp) { + QEMU_LOCK_GUARD(&graph_modify_mutex); + MirrorBlockJob *s = container_of(job, MirrorBlockJob, common.job); BlockDriverState *target; diff --git a/block/stream.c b/block/stream.c index 8a4b88b223..13eba00ce8 100644 --- a/block/stream.c +++ b/block/stream.c @@ -61,6 +61,8 @@ static void stream_abort(Job *job) int coroutine_fn stream_co_prepare(Job *job) { + QEMU_LOCK_GUARD(&graph_modify_mutex); + StreamBlockJob *s = container_of(job, StreamBlockJob, common.job); BlockJob *bjob = &s->common; BlockDriverState *bs = blk_bs(bjob->blk); @@ -93,6 +95,8 @@ int coroutine_fn stream_co_prepare(Job *job) void coroutine_fn stream_co_clean(Job *job) { + QEMU_LOCK_GUARD(&graph_modify_mutex); + StreamBlockJob *s = container_of(job, StreamBlockJob, common.job); BlockJob *bjob = &s->common; BlockDriverState *bs = blk_bs(bjob->blk);