From nobody Fri Apr 26 00:38:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1605889259; cv=pass; d=zohomail.com; s=zohoarc; b=GXZDO09ejBEeBiang/vP/HkRxHhqugoZghr9QrlcMDx3ODYF0+i9d3UrMjUBeNwaDRH2CwIf2v+C/vgOM6tyPocVmoy836EzMW0CVfQnspA3cXAN5+qCR5W5AdHxwiuLMLwP2r9xRVJ3Ta6s1CZSllmFt1TPSN0KV7FeawuWDu0= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605889259; h=Content-Type: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; bh=vMSncCLGZq4UmQ1TMkXjMLfz5K9FOnmYOIqXtxACM54=; b=MPQ88+BP2gkVWnOdn50tr/AA/2GywakgDOWurOwhM1Dq66VxKUAv5U9BC3TV39Y1EGOLluzTgR/LrxzB9jOjEB8WVYFCGSdZUUlrpjJ/Q0uPgGoVYjGrnIPx60ZicQHjMmnyPRd2qwj2Ma/iUnIvWGNFIwPqTrpoxOPDkM7jF64= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine 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 1605889259567314.79471944603847; Fri, 20 Nov 2020 08:20:59 -0800 (PST) Received: from localhost ([::1]:40986 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kg99e-0000yU-E4 for importer@patchew.org; Fri, 20 Nov 2020 11:20:58 -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 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 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 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; 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> Content-Transfer-Encoding: quoted-printable 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 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 (zohomail.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; 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) Content-Type: text/plain; charset="utf-8" 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 *fi= lename, /* If non-zero, use only whitelisted block drivers */ static int use_bdrv_whitelist; =20 +bool abort_on_set_to_true =3D false; + #ifdef _WIN32 static int is_windows_drive_prefix(const char *filename) { @@ -2002,6 +2004,9 @@ static int bdrv_check_perm(BlockDriverState *bs, Bloc= kReopenQueue *q, added_perms =3D cumulative_perms & ~current_perms; removed_shared_perms =3D current_shared & ~cumulative_shared_perms; =20 + if ((added_perms || removed_shared_perms) && tighten_restrictions = =3D=3D &abort_on_set_to_true) { + abort(); + } *tighten_restrictions =3D added_perms || removed_shared_perms; } =20 @@ -2066,12 +2071,17 @@ static int bdrv_check_perm(BlockDriverState *bs, Bl= ockReopenQueue *q, bdrv_child_perm(bs, c->bs, c, c->role, q, cumulative_perms, cumulative_shared_perms, &cur_perm, &cur_shared); - ret =3D bdrv_child_check_perm(c, q, cur_perm, cur_shared, ignore_c= hildren, - tighten_restrictions ? &child_tighten_= restr - : NULL, - errp); - if (tighten_restrictions) { - *tighten_restrictions |=3D child_tighten_restr; + if (tighten_restrictions =3D=3D &abort_on_set_to_true) { + ret =3D bdrv_child_check_perm(c, q, cur_perm, cur_shared, igno= re_children, + &abort_on_set_to_true, errp); + } else { + ret =3D bdrv_child_check_perm(c, q, cur_perm, cur_shared, igno= re_children, + tighten_restrictions ? &child_tigh= ten_restr + : NULL, + errp); + if (tighten_restrictions) { + *tighten_restrictions |=3D child_tighten_restr; + } } if (ret < 0) { return ret; @@ -2227,6 +2237,9 @@ static int bdrv_check_update_perm(BlockDriverState *b= s, BlockReopenQueue *q, char *perm_names =3D bdrv_perm_names(new_used_perm & ~c->share= d_perm); =20 if (tighten_restrictions) { + if (tighten_restrictions =3D=3D &abort_on_set_to_true) { + abort(); + } *tighten_restrictions =3D true; } =20 @@ -2243,6 +2256,9 @@ static int bdrv_check_update_perm(BlockDriverState *b= s, BlockReopenQueue *q, char *perm_names =3D bdrv_perm_names(c->perm & ~new_shared_per= m); =20 if (tighten_restrictions) { + if (tighten_restrictions =3D=3D &abort_on_set_to_true) { + abort(); + } *tighten_restrictions =3D true; } =20 @@ -2639,13 +2655,13 @@ static void bdrv_replace_child(BdrvChild *child, Bl= ockDriverState *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; =20 + assert(abort_on_set_to_true =3D=3D false); bdrv_get_cumulative_perm(old_bs, &perm, &shared_perm); ret =3D bdrv_check_perm(old_bs, NULL, perm, shared_perm, NULL, - &tighten_restrictions, NULL); - assert(tighten_restrictions =3D=3D false); + &abort_on_set_to_true, NULL); + assert(abort_on_set_to_true =3D=3D false); if (ret < 0) { /* We only tried to loosen restrictions, so errors are not fat= al */ bdrv_abort_perm_update(old_bs); --=20 2.21.3 From nobody Fri Apr 26 00:38:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1605889394; cv=pass; d=zohomail.com; s=zohoarc; b=BgjBdDUe/5lyUpgntQmwcP2OGG9I5biRB1AxRAs6xVaQ9UmGm8Z0Iv6DkpvIuvbEzZdEXi0K82HdDsOrIRklHwRTvwXoxrRhIJKycIEGdlBHYo325PwqLroIXD9MOYS/fkeHuv1sbjyEuRapQ32sPffaNiMDPczfUZUrANA1dmU= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605889394; h=Content-Type: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; bh=wzklPuQgaY8GtbZwGNAlnHUKMDmqe45TItkylDwk4Ls=; b=WSFJmyTqCN/GwTvontm4GGD5TqrZ43Xwgzry1pzJm+HMF/8dYmr9eEjBPqb280vwAq6/vEGv0VszeCv65PsSge0AfkK/ewS0M5WphXPWJvJ6OotgBvDfDs3UgUoH0sCeC9KcCvldMTF9oDhZPXD7Oj8Tet6aUhWYIw1+Jw52+Mo= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine 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 1605889394108744.1260051244104; Fri, 20 Nov 2020 08:23:14 -0800 (PST) Received: from localhost ([::1]:47396 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kg9Bo-0003iY-VN for importer@patchew.org; Fri, 20 Nov 2020 11:23:12 -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 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 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 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; 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> Content-Transfer-Encoding: quoted-printable 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 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 (zohomail.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; 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) Content-Type: text/plain; charset="utf-8" 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) =20 - def test_stream(self): + def ntest_stream(self): self.assert_no_active_block_jobs() =20 result =3D self.vm.qmp('block-stream', device=3D'drive0') @@ -67,7 +67,7 @@ class TestSingleDrive(iotests.QMPTestCase): qemu_io('-f', iotests.imgfmt, '-c', 'map', test_i= mg), 'image file map does not match backing file after= streaming') =20 - def test_stream_intermediate(self): + def ntest_stream_intermediate(self): self.assert_no_active_block_jobs() =20 self.assertNotEqual(qemu_io('-f', 'raw', '-rU', '-c', 'map', backi= ng_img), @@ -86,7 +86,7 @@ class TestSingleDrive(iotests.QMPTestCase): qemu_io('-f', iotests.imgfmt, '-c', 'map', mid_im= g), 'image file map does not match backing file after= streaming') =20 - def test_stream_pause(self): + def ntest_stream_pause(self): self.assert_no_active_block_jobs() =20 self.vm.pause_drive('drive0') @@ -116,7 +116,7 @@ class TestSingleDrive(iotests.QMPTestCase): qemu_io('-f', iotests.imgfmt, '-c', 'map', test_i= mg), 'image file map does not match backing file after= streaming') =20 - def test_stream_no_op(self): + def ntest_stream_no_op(self): self.assert_no_active_block_jobs() =20 # 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_i= mg), empty_map, 'image file map changed after a no-op') =20 - def test_stream_partial(self): + def ntest_stream_partial(self): self.assert_no_active_block_jobs() =20 result =3D self.vm.qmp('block-stream', device=3D'drive0', base=3Db= acking_img) @@ -149,16 +149,16 @@ class TestSingleDrive(iotests.QMPTestCase): qemu_io('-f', iotests.imgfmt, '-c', 'map', test_i= mg), 'image file map does not match backing file after= streaming') =20 - def test_device_not_found(self): + def ntest_device_not_found(self): result =3D self.vm.qmp('block-stream', device=3D'nonexistent') self.assert_qmp(result, 'error/desc', 'Cannot find device=3Dnonexistent nor node_name=3Dnonexistent') =20 - def test_job_id_missing(self): + def ntest_job_id_missing(self): result =3D self.vm.qmp('block-stream', device=3D'mid') self.assert_qmp(result, 'error/desc', "Invalid job ID ''") =20 - 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() =20 # Check that the maps don't match before the streaming operations @@ -272,7 +272,7 @@ class TestParallelOps(iotests.QMPTestCase): =20 # 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() =20 # Set a speed limit to make sure that this job blocks the rest @@ -313,7 +313,7 @@ class TestParallelOps(iotests.QMPTestCase): =20 # 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() =20 @@ -349,7 +349,7 @@ class TestParallelOps(iotests.QMPTestCase): =20 # 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 cas= e. - def test_overlapping_3(self): + def ntest_overlapping_3(self): self.assertLessEqual(8, self.num_imgs) self.assert_no_active_block_jobs() =20 @@ -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() =20 # 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() =20 # Commit from node2 into node0 @@ -457,7 +457,7 @@ class TestParallelOps(iotests.QMPTestCase): =20 # 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() =20 @@ -492,7 +492,7 @@ class TestParallelOps(iotests.QMPTestCase): self.assert_no_active_block_jobs() =20 # 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() =20 self.assertNotEqual(qemu_io('-f', iotests.imgfmt, '-rU', '-c', 'ma= p', self.imgs[4]), @@ -568,7 +568,7 @@ class TestQuorum(iotests.QMPTestCase): for img in self.backing: os.remove(img) =20 - def test_stream_quorum(self): + def ntest_stream_quorum(self): self.assertNotEqual(qemu_io('-f', iotests.imgfmt, '-rU', '-c', 'ma= p', self.children[0]), qemu_io('-f', iotests.imgfmt, '-rU', '-c', 'ma= p', self.backing[0]), 'image file map matches backing file before st= reaming') @@ -601,7 +601,7 @@ class TestSmallerBackingFile(iotests.QMPTestCase): =20 # 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() =20 result =3D self.vm.qmp('block-stream', device=3D'drive0') @@ -659,7 +659,7 @@ class TestEIO(TestErrors): os.remove(backing_img) os.remove(self.blkdebug_file) =20 - def test_report(self): + def ntest_report(self): self.assert_no_active_block_jobs() =20 result =3D self.vm.qmp('block-stream', device=3D'drive0') @@ -687,7 +687,7 @@ class TestEIO(TestErrors): self.assert_no_active_block_jobs() self.vm.shutdown() =20 - def test_ignore(self): + def ntest_ignore(self): self.assert_no_active_block_jobs() =20 result =3D self.vm.qmp('block-stream', device=3D'drive0', on_error= =3D'ignore') @@ -720,7 +720,7 @@ class TestEIO(TestErrors): self.assert_no_active_block_jobs() self.vm.shutdown() =20 - def test_stop(self): + def ntest_stop(self): self.assert_no_active_block_jobs() =20 result =3D self.vm.qmp('block-stream', device=3D'drive0', on_error= =3D'stop') @@ -763,7 +763,7 @@ class TestEIO(TestErrors): self.assert_no_active_block_jobs() self.vm.shutdown() =20 - def test_enospc(self): + def ntest_enospc(self): self.assert_no_active_block_jobs() =20 result =3D self.vm.qmp('block-stream', device=3D'drive0', on_error= =3D'enospc') @@ -809,7 +809,7 @@ class TestENOSPC(TestErrors): os.remove(backing_img) os.remove(self.blkdebug_file) =20 - def test_enospc(self): + def ntest_enospc(self): self.assert_no_active_block_jobs() =20 result =3D self.vm.qmp('block-stream', device=3D'drive0', on_error= =3D'enospc') @@ -870,7 +870,7 @@ class TestStreamStop(iotests.QMPTestCase): os.remove(test_img) os.remove(backing_img) =20 - def test_stream_stop(self): + def ntest_stream_stop(self): self.assert_no_active_block_jobs() =20 self.vm.pause_drive('drive0') @@ -918,7 +918,7 @@ class TestSetSpeed(iotests.QMPTestCase): =20 self.assert_no_active_block_jobs() =20 - def test_set_speed(self): + def ntest_set_speed(self): self.assert_no_active_block_jobs() =20 self.vm.pause_drive('drive0') @@ -951,7 +951,7 @@ class TestSetSpeed(iotests.QMPTestCase): =20 self.cancel_and_wait(resume=3DTrue) =20 - def test_set_speed_invalid(self): + def ntest_set_speed_invalid(self): self.assert_no_active_block_jobs() =20 result =3D self.vm.qmp('block-stream', device=3D'drive0', speed=3D= -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 =20 OK --=20 2.21.3 From nobody Fri Apr 26 00:38:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1605889109; cv=pass; d=zohomail.com; s=zohoarc; b=J3Vdl4Hj1OB7n48PULEXusabVmuShi5gfx3F2fxoJB4OW6iBAVL/Z8XBcmLJAJdv9HPwOUL4REHMc+D9zg2AAKM5jbJZr4sjtHU6ZikT5jaZfy5i+j4xL+i95fDF/L+inZH8XoQtlgyQFJW4NZ4wWrWFP4vTVaus6KR7TFEkFKY= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605889109; h=Content-Type: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; bh=4jnslqjR8WWX4QVbdpUQLv+HF1J8wrQumaUy5kTl2vM=; b=PKePzMt0mRjsH90JxQ0SBR60eGX9jvRKuXe4Gs6d0DyDBgIMP8ek0n/N2NZTXpin+ed0w9rmwRzc1G1xoRQyrloYE75eB9N0HWIBtL3DTgtRF25yiMBXYTNpZ+wn9bRNLHHGk9yCXowI/0LUvrLpGaMgty2H2SKa163NQSV0Gh8= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine 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 1605889109189578.7732048872671; Fri, 20 Nov 2020 08:18:29 -0800 (PST) Received: from localhost ([::1]:32812 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kg97D-0005v1-1n for importer@patchew.org; Fri, 20 Nov 2020 11:18:27 -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 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 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 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; 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> Content-Transfer-Encoding: quoted-printable 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 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 (zohomail.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; 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) Content-Type: text/plain; charset="utf-8" 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-w= rapper.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 =3D return_type.strip() + self.void =3D return_type =3D=3D 'void' self.name =3D name.strip() self.args =3D [ParamDecl(arg.strip()) for arg in args.split(',')] =20 @@ -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.a= rgs) =20 + def if_ret(self, value: str) -> str: + return '' if self.void else value + =20 # Match wrappers declared with a generated_co_wrapper mark -func_decl_re =3D re.compile(r'^int\s*generated_co_wrapper\s*' +func_decl_re =3D re.compile(r'^(?P(void|int))\s*generated_co_= wrapper\s*' r'(?P[a-z][a-z0-9_]*)' r'\((?P[^)]*)\);$', re.MULTILINE) =20 =20 def func_decl_iter(text: str) -> Iterator: for m in func_decl_re.finditer(text): - yield FuncDecl(return_type=3D'int', + yield FuncDecl(return_type=3Dm.group('return_type'), name=3Dm.group('wrapper_name'), args=3Dm.group('args')) =20 @@ -98,13 +102,19 @@ def snake_to_camel(func_name: str) -> str: =20 =20 def gen_wrapper(func: FuncDecl) -> str: - assert func.name.startswith('bdrv_') - assert not func.name.startswith('bdrv_co_') - assert func.return_type =3D=3D 'int' - assert func.args[0].type in ['BlockDriverState *', 'BdrvChild *'] - - name =3D 'bdrv_co_' + func.name[5:] - bs =3D 'bs' if func.args[0].type =3D=3D 'BlockDriverState *' else 'chi= ld->bs' + subsystem, rname =3D 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 =3D f'{subsystem}_co_{rname}' + arg0_t =3D func.args[0].type + if arg0_t =3D=3D 'BlockDriverState *': + bs =3D 'bs' + elif arg0_t =3D=3D 'BdrvChild *': + bs =3D 'child->bs' + elif arg0_t =3D=3D 'Job *': + bs =3D 'blk_bs(container_of(job, BlockJob, job)->blk)' struct_name =3D snake_to_camel(name) =20 return f"""\ @@ -121,16 +131,16 @@ static void coroutine_fn {name}_entry(void *opaque) {{ {struct_name} *s =3D opaque; =20 - s->poll_state.ret =3D {name}({ func.gen_list('s->{name}') }); + {func.if_ret('s->poll_state.ret =3D ')}{name}({ func.gen_list('s->{nam= e}') }); s->poll_state.in_progress =3D false; =20 aio_wait_kick(); }} =20 -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 =3D {{ .poll_state.bs =3D {bs}, @@ -141,7 +151,7 @@ int {func.name}({ func.gen_list('{decl}') }) =20 s.poll_state.co =3D qemu_coroutine_create({name}_entry, &s); =20 - return bdrv_poll_co(&s.poll_state); + {func.if_ret('return ')}bdrv_poll_co(&s.poll_state); }} }}""" =20 --=20 2.21.3 From nobody Fri Apr 26 00:38:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1605889269; cv=pass; d=zohomail.com; s=zohoarc; b=FsB+jV7KF3fxWPW/YVI5Gqwwi8T3fGrsK/fUAXJUc+8KkitCokIAT2PeJpC1z1ROw5tesUIhv/taW+M4/AKQbJacPgaqYDJ2KjBYtJI8B/s6y6zdzCakFssNl41KWvKHG5xszbAl1RgZ512KCxP/t4fsMaDlQsjzt/uuOjDrf24= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605889269; h=Content-Type: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; bh=m+Hn7GM9GmyDmZOUGd+/VwlV/H7JIh6yI6QoehPwoxk=; b=bAaprydvuSql6d4H1ktcW/wBWJHfTzodSCeKpGWlgdD/cukRA7Hiqh5+AQV4RIsdSAs+F7sd9og2VJN/puLq+jDY0NiZv2Z/AwfGfQzCUiO5Su35JvaHKIeuqLUpMzu6lImKTeTlpkbrgGkaZIZS/CtUxNI9LFBSqT3fSZ7GHoU= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine 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 1605889269689479.32289548946744; Fri, 20 Nov 2020 08:21:09 -0800 (PST) Received: from localhost ([::1]:41816 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kg99o-0001Lg-Iv for importer@patchew.org; Fri, 20 Nov 2020 11:21:08 -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 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 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 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; 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> Content-Transfer-Encoding: quoted-printable 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 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 (zohomail.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; 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) Content-Type: text/plain; charset="utf-8" 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 =20 #include "block/block_int.h" +#include "sysemu/block-backend.h" =20 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); =20 +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(MirrorB= lockJob *s) * for .prepare, returns 0 on success and -errno on failure. * for .abort cases, denoted by abort =3D true, MUST return 0. */ -static int mirror_exit_common(Job *job) +int coroutine_fn mirror_co_exit_common(Job *job) { MirrorBlockJob *s =3D container_of(job, MirrorBlockJob, common.job); BlockJob *bjob =3D &s->common; @@ -1103,7 +1104,7 @@ immediate_exit: return ret; } =20 -static void mirror_complete(Job *job, Error **errp) +void coroutine_fn mirror_co_complete(Job *job, Error **errp) { MirrorBlockJob *s =3D 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) } } =20 -static int stream_prepare(Job *job) +int coroutine_fn stream_co_prepare(Job *job) { StreamBlockJob *s =3D container_of(job, StreamBlockJob, common.job); BlockJob *bjob =3D &s->common; @@ -90,7 +91,7 @@ static int stream_prepare(Job *job) return ret; } =20 -static void stream_clean(Job *job) +void coroutine_fn stream_co_clean(Job *job) { StreamBlockJob *s =3D container_of(job, StreamBlockJob, common.job); BlockJob *bjob =3D &s->common; --=20 2.21.3 From nobody Fri Apr 26 00:38:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1605889368; cv=pass; d=zohomail.com; s=zohoarc; b=HitY6XEyZL/3iMt/uolnm6bWwA25z/KpL9rGarZxGEWyrS4xW0EjrurO1Joxc9OJLlg/w9tZi1Pt39iK9YPxTqfZYsuMgcgAlx30gtOsDc0sUaJXAfYSIpw3CjT8md2CPL1HpiQmTey+72RUzPmktUuuJHtt3F+2senUK8i8fq0= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605889368; h=Content-Type: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; bh=rHmKSjGAlqfoiovHYXgS1epKt6vfDUsEUSffQHyAwAM=; b=IUbW5xra6nODPYQQwRvNcZiAXwAQVXOI3wy39nkX6MPkIIZKWuaVuMTVGzM9yPYQIsitqXcWcZOvx/aMyzoQdqfNpH1hiNX+vz1uPa/MP+YIl1WZUssNjgB28h9uBrLhfs8MZRR25xfw1Lvf/DrerisBcvvS+67YHpVB/KDjYmc= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine 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 1605889368504936.179557245948; Fri, 20 Nov 2020 08:22:48 -0800 (PST) Received: from localhost ([::1]:45956 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kg9BO-00034n-M2 for importer@patchew.org; Fri, 20 Nov 2020 11:22:46 -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 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 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 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; 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> Content-Transfer-Encoding: quoted-printable 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 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 (zohomail.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; 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) Content-Type: text/plain; charset="utf-8" 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 =20 +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; =20 bool abort_on_set_to_true =3D false; =20 +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(MirrorB= lockJob *s) */ int coroutine_fn mirror_co_exit_common(Job *job) { + QEMU_LOCK_GUARD(&graph_modify_mutex); + MirrorBlockJob *s =3D container_of(job, MirrorBlockJob, common.job); BlockJob *bjob =3D &s->common; MirrorBDSOpaque *bs_opaque; @@ -1106,6 +1108,8 @@ immediate_exit: =20 void coroutine_fn mirror_co_complete(Job *job, Error **errp) { + QEMU_LOCK_GUARD(&graph_modify_mutex); + MirrorBlockJob *s =3D container_of(job, MirrorBlockJob, common.job); BlockDriverState *target; =20 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) =20 int coroutine_fn stream_co_prepare(Job *job) { + QEMU_LOCK_GUARD(&graph_modify_mutex); + StreamBlockJob *s =3D container_of(job, StreamBlockJob, common.job); BlockJob *bjob =3D &s->common; BlockDriverState *bs =3D blk_bs(bjob->blk); @@ -93,6 +95,8 @@ int coroutine_fn stream_co_prepare(Job *job) =20 void coroutine_fn stream_co_clean(Job *job) { + QEMU_LOCK_GUARD(&graph_modify_mutex); + StreamBlockJob *s =3D container_of(job, StreamBlockJob, common.job); BlockJob *bjob =3D &s->common; BlockDriverState *bs =3D blk_bs(bjob->blk); --=20 2.21.3