From patchwork Mon Sep 20 11:55:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12505115 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EBF17C433F5 for ; Mon, 20 Sep 2021 11:57:53 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 603A660F93 for ; Mon, 20 Sep 2021 11:57:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 603A660F93 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:48688 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mSHvk-0001hd-3O for qemu-devel@archiver.kernel.org; Mon, 20 Sep 2021 07:57:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33218) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mSHu6-0007Q4-OV; Mon, 20 Sep 2021 07:56:10 -0400 Received: from mail-am6eur05on2122.outbound.protection.outlook.com ([40.107.22.122]:7297 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 1mSHu3-0005GK-DQ; Mon, 20 Sep 2021 07:56:10 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lEGLeVlh/ZhslWSfnQ2ZBFbazIQG126SRKjCjECkZVev4Dr5m7ta63N6kIfYtIHBcZnFKp6CCNbjwBa7xYAn9jgBKhh3rRoKtnuviYp9X+Nz4s6m7g3a0APCLnbbgCiG7qBdc0lVDz65JlB3TvxghzFaEy51T44B+EH/I6k0zOkTCbvlDwOvnZHw0CW1fFQuGxZSJlnRmcC2idRKbKPIhLGhmZUTi3CXHCNv8EcTiZGLQ25Nmri2zOf90QFvIUhtiSIKtvg2tXOpngKC+4+N3bLNlu3wdzZJeKIB0hT8xETEeh/bMMLLNVt0kIub0YrbmD0zz2IHQTDfYBAuSZBKaw== 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; bh=nSVBCX8rP22n7MtEMM24oo0w4p1lZtTU9Oz6Ox0Gpmw=; b=BN6LYsB2ezANPX1fJQmbauio//VFLJ0mjmwoH5oGRHx0M3JmI0NIrANg1/DqUAqL63qLhPisZAzhOsBhkAVaktQP7Sj+7oKT3/3V6zXk/Ec1qxyZ4IzHL2hjK5mOsykzS/EgWuuXevmANDT3TzNqmnccvSfQ1O0qSFMmD6HoSxD3YgebaYOWBzvZm1Mq8cqcH/LeIMHLgvet/kUlqu/126pPs2gSabzel5hITQzFgwQW9A4b5KOrahpC4ZpLmhKoCte6NQFvX0O+tvymezNg5/EWgB3IwNwbdFdbSSBNAKQ5UjqsQicUhCVhrHl3+SlvKLOoxijNMvYYGGZogE4FRA== 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=nSVBCX8rP22n7MtEMM24oo0w4p1lZtTU9Oz6Ox0Gpmw=; b=d1XB5L77igew/sCcc58yvl5R13CzJKQOZam1vbZVBZi2K6MWTvTDPNbaLM9rvK/KzjBttRIogFNYbQIPZ/ETJB7UoZ7og0i2MFi+wlC4Y1k/vZrWeKabQiPsyvIZfPkNv30Numb0GlaVTsr8jh42fbGYEmR8KRRsrb821w0rhZY= 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 AS8PR08MB6631.eurprd08.prod.outlook.com (2603:10a6:20b:339::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.16; Mon, 20 Sep 2021 11:55:56 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::2817:53b3:f8b4:fe22]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::2817:53b3:f8b4:fe22%9]) with mapi id 15.20.4523.018; Mon, 20 Sep 2021 11:55:56 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, hreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com Subject: [PATCH 1/5] block: implement bdrv_new_open_driver_opts() Date: Mon, 20 Sep 2021 14:55:34 +0300 Message-Id: <20210920115538.264372-2-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210920115538.264372-1-vsementsov@virtuozzo.com> References: <20210920115538.264372-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: HE1PR09CA0082.eurprd09.prod.outlook.com (2603:10a6:7:3d::26) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (185.215.60.205) by HE1PR09CA0082.eurprd09.prod.outlook.com (2603:10a6:7:3d::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14 via Frontend Transport; Mon, 20 Sep 2021 11:55:55 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 05883406-9cef-4168-b17a-08d97c2d9af2 X-MS-TrafficTypeDiagnostic: AS8PR08MB6631: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:525; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6M9Lqshw0hNSRPU1Ke9R6NZe7z5p2wNBWIsYo8jntHxpN2TM5LaSxKr0OqVU1trOrUkECC0alca/8IkSHAITyEN7rGRICl1vBiAjfUg6nj30znJVh66xAZ4q8jS8a6rCa67cEdcf8RDsiPJgmtqNQDvqFryG6tLxvoUykymO0nvIVTa7yl81ubxGEVhdBK+qkmHSDolaxVu1hQpYN1iiXCnBUhQ8sHHdYUqEdnbo1G7LS6d/Zn4mLch3WNCKTxB3BUiL24pZIDqq3feiyLDEVie0xBQ1toRZzC7kpnRSytrzG18OAnzdKWmm4e/FDSO8kq4qTEkn9nE94UzVRSyOhN1gzrohwopnyrlnc3O7O2NUEbNcuXKGy66GPnhhg1C9uDiQN3EDEkpWlq8bmBcgnmGKuXS8kJCztKwPkw2NGnI8mnbq6bswgvHEFxCOWbG+k42YCbF/fPshqsg74/6C4IRFoa/P5ItIMGD2pzxot8GtPGo5k/cOmU2udbnHuqQashZNL0LZwkcq8HbNbzwMZ//4Fw5mlwryou8MpCq+TdneVVAjsTCAQfgmJ+x/YClg2RABAynIIfrwe8066xDPwpOfSUXcYv68m2Db9zKu3svMJ4RMe36Q1Qe/vf9m7OtGsgNYd+PIPAAo9J2+X5+7m+4iUc6X0VNqBND4/u8la7zboM8aEo1Mu/HVTdytsCL9r2sle8seN8a50IO4O8zl/Q== 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)(39840400004)(376002)(396003)(136003)(346002)(366004)(2616005)(956004)(66476007)(478600001)(66946007)(4326008)(83380400001)(66556008)(36756003)(107886003)(8676002)(8936002)(6506007)(316002)(6666004)(5660300002)(2906002)(52116002)(1076003)(38100700002)(86362001)(186003)(38350700002)(6486002)(6916009)(6512007)(26005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: CuWMf3J+JA4Egg13Uyayglh/xzmQkGh+XarjavOdhlCS5MV6cdI+hLEoWLBR3jg5alJjHprDrpAiBwO5BN0EJOVs5TYrT23Xqu6b52bhqkCcRuZzhClXxOE9oaXK3IRm862kMvtLaxbEMtxIP2g9XxvsekSv3BcOwDmIvGDbi+AJcAa0QncPuotpvQe3VCO2P9JXjosPErT/poN7ElEjFHQx8qW37vGxN+pbsz09sLcRbiAg++QkohY7msg1Wwsgbybmg64Mi7zGvNUjR+N9i9lhDWD1f6iDy99/uWc2umLm5SZnd+Typf0ZDIT6xsjix63mN9a1iHVloU+hb7QrDiR9CSjBODjzaVQBw/PbUPH/4ra3N7kGUQE714eLAXqtd6BwMgujmYBQF1QLTVE2PSXVlpwlTFBi1Va70Xbe1xMtEuUSKPJ8lDACgNqn2TlLZNW56X5CaV7LZ3Hk5vJQ2g7aonFOKBLo4+p4lmnwiyZnH6MV4CS/UX9/HtWnH9zc6EwAL/2CTuvk7n6xr209vDU6+DBV2PAB5OrfgipCl8yyGFDUxvKVQ+Errkt2u8KYj0Gez/kZJem/ZD+qJDno/CwzXqRghtI8wt1FAJkEcIYrd+eUn7uS+91agbZSL7RRu+oTGgOGPXrP2Vg+oxEaYK+hycqfU+h2EWhm921jsuIgRnmUXJuJAoLYsAP4QOAO+2cIjUGTgy9Y5p1I9qm0DK8AWlYq6jtLa1+igBaxRY0DLgFhA6DnWgn85izvYcYhnJj6D2lilWfDt6440zSn7DSXy9ty13ndrLRb71HZcjckD881Hbuw0DWeZbALumJxakUGVcUx6Rf067d6SOB8pO5MwZLn/cO2TkiAXiJTWrQMXaKvKZygjgRc7k9n2vBjOQ5m8xsolMooCLS2TdGed8Jfw37wRR+7ktobGNtfhnRwEPru7ILMGsHCy9tipDGmBg9k5XpG8thQX9/QtkD5E/8JoxQxIu4FyNYV6y0n1LXCwOO1C/tM9dUYDQs3et2AYTViKGD8OyMBSoU/Xlc7Hx11yhD4+T71xPoLC1dmv1ucTHgUErQiVY8eHVEMLfw6ywaMFB/qwBy0L+A20/VodlRbFhD6shLGCA1ObBcwJ7vsKmqEJXDGDRLYUCsAQ7Iff4vqgfkkGqrErp91m1mNYGivbmDTCwQPx8vthTC3LTjtGjYAu2gnLwATySCSkSJEPlcC8atPhNIgjlBKDZxTZgPnLQDgj9MOMltxjmArfCm0Jk6Ydmbtabjlix+rempzu1+TS5mKGasDYXNNG78p29IMuQFWYOgS7ZZPZ5FHm8G59YDySHE3WFkw2/DZ+ye0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 05883406-9cef-4168-b17a-08d97c2d9af2 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Sep 2021 11:55:56.6820 (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: FQIJmAl8my0OvNxKA29gQRkPz0g41jR15zL3F2HBFGRH0t6sbV4eEHUp2CYkdXppA0RjVJMwJQ4MfehnWvWE2YCTjneeVlE/5ES2zqQMF9E= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6631 Received-SPF: pass client-ip=40.107.22.122; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-AM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Add version of bdrv_new_open_driver() that supports QDict options. We'll use it in further commit. Simply add one more argument to bdrv_new_open_driver() is worse, as there are too many invocations of bdrv_new_open_driver() to update then. Signed-off-by: Vladimir Sementsov-Ogievskiy Suggested-by: Kevin Wolf --- include/block/block.h | 4 ++++ block.c | 25 +++++++++++++++++++++---- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/include/block/block.h b/include/block/block.h index 740038a892..24b773e69c 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -383,6 +383,10 @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict *parent_options, const char *bdref_key, Error **errp); BlockDriverState *bdrv_open(const char *filename, const char *reference, QDict *options, int flags, Error **errp); +BlockDriverState *bdrv_new_open_driver_opts(BlockDriver *drv, + const char *node_name, + QDict *options, int flags, + Error **errp); BlockDriverState *bdrv_new_open_driver(BlockDriver *drv, const char *node_name, int flags, Error **errp); BlockReopenQueue *bdrv_reopen_queue(BlockReopenQueue *bs_queue, diff --git a/block.c b/block.c index 5ce08a79fd..917fb7faca 100644 --- a/block.c +++ b/block.c @@ -1604,16 +1604,26 @@ open_failed: return ret; } -BlockDriverState *bdrv_new_open_driver(BlockDriver *drv, const char *node_name, - int flags, Error **errp) +/* + * Create and open a block node. + * + * @options is a QDict of options to pass to the block drivers, or NULL for an + * empty set of options. The reference to the QDict belongs to the block layer + * after the call (even on failure), so if the caller intends to reuse the + * dictionary, it needs to use qobject_ref() before calling bdrv_open. + */ +BlockDriverState *bdrv_new_open_driver_opts(BlockDriver *drv, + const char *node_name, + QDict *options, int flags, + Error **errp) { BlockDriverState *bs; int ret; bs = bdrv_new(); bs->open_flags = flags; - bs->explicit_options = qdict_new(); - bs->options = qdict_new(); + bs->options = options ?: qdict_new(); + bs->explicit_options = qdict_clone_shallow(bs->options); bs->opaque = NULL; update_options_from_flags(bs->options, flags); @@ -1631,6 +1641,13 @@ BlockDriverState *bdrv_new_open_driver(BlockDriver *drv, const char *node_name, return bs; } +/* Create and open a block node. */ +BlockDriverState *bdrv_new_open_driver(BlockDriver *drv, const char *node_name, + int flags, Error **errp) +{ + return bdrv_new_open_driver_opts(drv, node_name, NULL, flags, errp); +} + QemuOptsList bdrv_runtime_opts = { .name = "bdrv_common", .head = QTAILQ_HEAD_INITIALIZER(bdrv_runtime_opts.head), From patchwork Mon Sep 20 11:55:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12505119 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1127AC433EF for ; Mon, 20 Sep 2021 11:58:23 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 838D060F93 for ; Mon, 20 Sep 2021 11:58:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 838D060F93 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:49976 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mSHwD-0002aX-Mv for qemu-devel@archiver.kernel.org; Mon, 20 Sep 2021 07:58:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33254) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mSHu8-0007RS-J9; Mon, 20 Sep 2021 07:56:12 -0400 Received: from mail-am6eur05on2122.outbound.protection.outlook.com ([40.107.22.122]:7297 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 1mSHu7-0005GK-0g; Mon, 20 Sep 2021 07:56:12 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aP34MzCX6ICAigns2LSDjO28hTGCSEgV7ql8AwAWWdcbfA7s/0byumMHolKlHsRwL/TsbYPmijnCaGLh3GURwVqULyix/MMNjegpp1bYsnN1w7mdKfYo6fIXRbwt2wgKyPdNPj7FCghUXgwkNXCw8IyM+0UxgpTEEUrqvRUeYzGzKe5pMjbqmCpFPWNvj1BuoKtfKxCNMYtL8w5DAMG1lf/QjlyxtqJzpM9sMlcbp6S2Z5dlR3A4KdyeSjRYl6CO4Q6R82qgiDSpC/PdXnsTTavT1nlq+Qhe7xI2fv6vvmFQSDR+M8GJwNdNPnn9CCOyShPydKxkQ/MKqoyfBqg/dw== 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; bh=9zAA1LaVO/PEC5GghPw4KcgTkjyxfm/nMzVS9qb9meI=; b=RD+/MYoDVlCWIpQYeykqq6kZarKT74yEH/tXOZxisTz3QG39zK5uqOIjVqc7HEN12eNVpK3N/pNRC/b6X93ICFKg9MUgPVNkfusNhX8Ezm7a5csdOndmkzYqfeiLShbSQfdNibIzphBhH7zbVoVQ8h+/DL80jtrE8BKhjy2K2saMg7yIPsbVyOhR6FyFpspcxHg/2eVTdLwMVg8MPFaPQK6Bbl9nfHjoCqrNJvXszSkF38kSA5vntDqcGHIMXU5ZFRNX+PnE7khiMEf3ecYNJXsDTkLEFmruH3/gjwH0xZ98Tuy4sk4R6moy2UcV/W9NYyx5z3JvuE+aUTYg8KNRCw== 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=9zAA1LaVO/PEC5GghPw4KcgTkjyxfm/nMzVS9qb9meI=; b=pMei9Ct/41uYBb6V9KkXW0GQQUVQtfRbjCa/+j29fSme7rIx6BYNgJ2nufBBEPX13Qa5eAcQmk2JvLQ7ToYVtKH3Z8TF2JAFGa9v46R1WiSQ8IokIAHrcNdvVBJXtAYXE6EqWHnFGV7RoKDg/EdhkaK6lzzly/Hv/qJOcEga+CM= 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 AS8PR08MB6631.eurprd08.prod.outlook.com (2603:10a6:20b:339::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.16; Mon, 20 Sep 2021 11:55:57 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::2817:53b3:f8b4:fe22]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::2817:53b3:f8b4:fe22%9]) with mapi id 15.20.4523.018; Mon, 20 Sep 2021 11:55:57 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, hreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com Subject: [PATCH 2/5] block: bdrv_insert_node(): fix and improve error handling Date: Mon, 20 Sep 2021 14:55:35 +0300 Message-Id: <20210920115538.264372-3-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210920115538.264372-1-vsementsov@virtuozzo.com> References: <20210920115538.264372-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: HE1PR09CA0082.eurprd09.prod.outlook.com (2603:10a6:7:3d::26) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (185.215.60.205) by HE1PR09CA0082.eurprd09.prod.outlook.com (2603:10a6:7:3d::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14 via Frontend Transport; Mon, 20 Sep 2021 11:55:56 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c295cf1e-530b-4fe9-5c8e-08d97c2d9b8c X-MS-TrafficTypeDiagnostic: AS8PR08MB6631: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4714; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +xjmOrBtwVzm8FOXCPPmOdynTXTi+dwMj/u58rujjGcESgX1dnL/SKk8mFCiSipBo4K/5GrgqFgn4YxPYYFrUSQZaPIDK7K57bQzFzctZ9AZsJ9JcPmP5uL1b0oIw2ATNw60K8F1YgoDtFUSgDHDVYfQxt367yVmj2xKKwW8qQI/R4GpxBnY5i1Agj3rMuP5ofW1VvYNy+8vLdC1dJI4bRbjE3yxlmt0FIjK93Y3thzH+uHcisOv01y5PtOLxtwsgtGBFqC3p4VChF9wUD3kG8QFEgw01wBVzfU1kIKuHSUqzm0u83TLIQ58gVFf+PWt+5sT0Q8YIyg9GZ+Th1wrjBCiKq4pn0NFWNm1Bipu1z9S2gKFMpzFbdYd0xtB7MhNHj+Z1Bv/TYsfktNn0B0ubeYsIMflKkGqkElpMEQijnG6JOU33ITIjtCG9ryTzstIww39L83EcjotvT58K+UK/7XLVmBt6kPO42HHG1AWqLudl+bWQof6AGLdB3pWzAaranTe11pVl2Uyu7magV1i31ILZDkIdoKBtbepkJEqL/7LExLQ4hsxl1wdYwrgkL91qREhVNrvATzCKqYvI2BTLaZEeciivHt7VwiQ3pJoErH5vz8N8KJem6em838gtcY2YW0NAeLESdtI+lfeBg7Aq7vjvsqRA6LF5m+epEBa4nqN28zqvcQ3FiaqYdhVR0aMpWnHvCVHx3YMircmpmKalQ== 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)(39840400004)(376002)(396003)(136003)(346002)(366004)(2616005)(956004)(66476007)(478600001)(66946007)(4326008)(83380400001)(66556008)(36756003)(107886003)(8676002)(8936002)(6506007)(316002)(6666004)(5660300002)(2906002)(52116002)(1076003)(38100700002)(86362001)(186003)(38350700002)(6486002)(6916009)(6512007)(26005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wr7B8q8a2FpP+OQWotmV710qoUDIIn6JD7Z02dWlRGhI2k0gjUftuH9IYgXwe8O/UdQcsRRvHmgtwnIpHfG/GU3vYK3hTLv18dYy4kYpAW9z1lEEdKsnXmysxvBvOJcWBGxoDiKokexZU19GR/58cHI+W32p0n8Ha+YeNof0qbp0Mo589ORYCY6cmWOaNIX4UvE3sdD99IgamVX1kpvToE/36Y3k9Zuz5bDVcaNj6GL8BVdWDWTB829HdNN5g9dm44ppC2Rp588UnWfIBEGiuRa8nB+fqww00oqD/L7Iq1iuUOzdqUnCnpH9BC1LnKDtFZwn7nUhQibabgrKkeYw/w020l2nGJwTkR+m1B+LeW4IyOwqzkjQtGG2D8IiszpyARDJvLsheWR+e6hbeg0v48MNapCQ+Rb3nQqxylNyei+HFZZ1muW309IK1Qgn3UpoJ3zfEGqomFD210iu5W3CO3qmgubq3NmoqlK0uq9o7AC8jwTLOENU1cQVDjTGE3hQfbxMCqyg7E24RxDXnK35b6DOTOEJmy7k44KM+9Qv5nc+b12/ritG/wVKEHRtg/6IaF9ZjXTS+CLRf3pDDUJHIxc3qbgPrasxAo6fQniUkcnzZR2Fhz2/emw3UTeNveBgS5Uv2lcS7idBefR5Hqml6SVvJNH+GzTSI/78kJR/nxGC5/9a+YH7dIX9q7Z5cnYvE4l9yde6teYQ0hdxkwt7/9zepjbL7KNpKpRFxRmTWH/vzki6im9wM5NEtD098pYJTPEFb/AnbwPAgLXbX0ATT4mo93DTabUj4nY1V0Wcd5tm8GCqKZbYA++xPeZE2XL1xNopMFTzWNhMhDz42MbNx0fMHdKknCu6X014yF9R24t2WsWp/5O5tKU36AQIi16aYSEXLJ5O9odJTXpCne6YGjsa/vLUhfcQnyCn0ZAKsK3/Mz/0yZVCudnhboWEBTC8rKc1kAua+1oDwr1AHNVrdqkWsqfxJQrRUpxhHzzXXeGeiWlSM1Uzt3+Uij6JShJ8r7nXPO23MN1+vKjWC+LlDvq7nhrHeGKI75CAKLZ9W8L1L0X1w++uaPJ7PfqrTFNP7JYi6VhSHltGVee99ecTMAZXf/6FWjwuAUpH4XqUfSWxoOG/0xtaKBg0/JNADWaPs85Mk83FkEJeNUxHvtTfcX8crn1vZVwG+uQ2lmu+xahSp0jR9wR5TXu6t3iU4uew/6h1z+JT3tVt7uYAttBLyzPlNcpZkSvNrsh2NmG/ajEUhWITIt/8eYAyMB136nL+7VTxPGEqjL6wzC5wr1oTC83GwddYE6qBFB68fjPAntNdAB4AbHDU46MMZdZxxcDR X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: c295cf1e-530b-4fe9-5c8e-08d97c2d9b8c X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Sep 2021 11:55:57.6034 (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: WCreAa5HC5iD+lnE/W3SRLs2aLFOgbZjeo9yHMykjVWhzCU4yY9ttIPNMxp8t3lUJO1xssckzPhaDI/PxYRKLc8RdZXXA35vF8G1VGQSJcc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6631 Received-SPF: pass client-ip=40.107.22.122; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-AM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" - use ERRP_GUARD(): function calls error_prepend(), so it must use ERRP_GUARD(), otherwise error_prepend() would not be called when passed errp is error_fatal - drop error propagation, handle return code instead - for symmetry, do error_prepend() for the second failure Signed-off-by: Vladimir Sementsov-Ogievskiy --- block.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/block.c b/block.c index 917fb7faca..5d49188073 100644 --- a/block.c +++ b/block.c @@ -5122,8 +5122,9 @@ static void bdrv_delete(BlockDriverState *bs) BlockDriverState *bdrv_insert_node(BlockDriverState *bs, QDict *node_options, int flags, Error **errp) { + ERRP_GUARD(); + int ret; BlockDriverState *new_node_bs; - Error *local_err = NULL; new_node_bs = bdrv_open(NULL, NULL, node_options, flags, errp); if (new_node_bs == NULL) { @@ -5132,12 +5133,12 @@ BlockDriverState *bdrv_insert_node(BlockDriverState *bs, QDict *node_options, } bdrv_drained_begin(bs); - bdrv_replace_node(bs, new_node_bs, &local_err); + ret = bdrv_replace_node(bs, new_node_bs, errp); bdrv_drained_end(bs); - if (local_err) { + if (ret < 0) { + error_prepend(errp, "Could not replace node: "); bdrv_unref(new_node_bs); - error_propagate(errp, local_err); return NULL; } From patchwork Mon Sep 20 11:55:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12505125 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6523C433F5 for ; Mon, 20 Sep 2021 12:01:03 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 51B9C60F13 for ; Mon, 20 Sep 2021 12:01:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 51B9C60F13 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:54580 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mSHyo-0005eN-39 for qemu-devel@archiver.kernel.org; Mon, 20 Sep 2021 08:01:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33296) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mSHu9-0007WN-Tf; Mon, 20 Sep 2021 07:56:14 -0400 Received: from mail-am6eur05on2112.outbound.protection.outlook.com ([40.107.22.112]:8080 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 1mSHu7-0005GQ-5o; Mon, 20 Sep 2021 07:56:13 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RRkZdLKftm0spJh8buLS4L5zwKu18n81YFdrNw6e5XIeiiIVPb2XSoRmPOorY+Q+XatXdOTj4k/j0LPZdywmsgDTGlXtsTefIAEeIWyMuKnaw/74RQd/SMm5453Vr0hWozioCJNEVTYG7zKToU8vNbmrsuYpkozd+mJ0Jy9sldJm6GtQS/vK6fb5oVED57wnc5mN/01TbC61K59emFZob7sh93Vw7Q9oMtznhxKrI/yr4zgXxBYLS23Lo6UXvOXNl81ZwqpMXilPwfbUZKgNsOkJwnyVQcW0iAxskPQMJZC7Qt9m15JSntpOH1tqh6dkk0v2VmraHzssZUBmhRNsYA== 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; bh=KtsD+OeC5pdqaRsDVU/GhxH5Rd8yIrBRwUOMpYgOIqo=; b=eFWotGrot2VrcjQ2yawSvLLpv0pnXiu+lnz9WRqyEyQmiuuGbMuHdCj687ywO+nG8YOtJSk/ZbyvdPhhbrEpKNmPyCCuoe2ooJ0sjXpyufXSMk9r6CUawIEn4QDO4mnAdTtdeHUBSKfzhli+wm8pu2I4dgw3/jZ5kCj8Bi9Es/pvpbJvzjACG8714iVdi1jFzFdTUKFuSoAFJKeCI9Q04ShcUlsuY0FGzXbCtuTblTk+NEcf0sUDHn0H89kzd82XrHX33hMzKNcqSdTeB4ZIcJVWHXsDKOPmoQPQz+qzWoYJYQXKItQbQ1F7tjXpAtQiVN7Kxh2Us6MeGy+gR9F04w== 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=KtsD+OeC5pdqaRsDVU/GhxH5Rd8yIrBRwUOMpYgOIqo=; b=fhy2vCbIuvYmIVYoxyOT4Fdu01jfosAYbJveJqxS+JuTPBcKWfX4bjs5E3+VdWR23mtHzhikiC8Wu9rZSI1TKN0BcAiUWHGXRF8xyssZvgOfrw7Uy+Lwyjo47Ny4UX58R9IUECDYxaPHIyN3UAQ82xkPDR1sBiqM8Np+RDEoT1Q= 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 AS8PR08MB6631.eurprd08.prod.outlook.com (2603:10a6:20b:339::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.16; Mon, 20 Sep 2021 11:55:58 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::2817:53b3:f8b4:fe22]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::2817:53b3:f8b4:fe22%9]) with mapi id 15.20.4523.018; Mon, 20 Sep 2021 11:55:58 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, hreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com Subject: [PATCH 3/5] block: bdrv_insert_node(): doc and style Date: Mon, 20 Sep 2021 14:55:36 +0300 Message-Id: <20210920115538.264372-4-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210920115538.264372-1-vsementsov@virtuozzo.com> References: <20210920115538.264372-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: HE1PR09CA0082.eurprd09.prod.outlook.com (2603:10a6:7:3d::26) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (185.215.60.205) by HE1PR09CA0082.eurprd09.prod.outlook.com (2603:10a6:7:3d::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14 via Frontend Transport; Mon, 20 Sep 2021 11:55:57 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7684017d-f296-41bc-5476-08d97c2d9c0e X-MS-TrafficTypeDiagnostic: AS8PR08MB6631: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4n/yo5xquhuHkFMopMdLM54vbm/+LuuXok0R+Sog+nVDKSSrG2tzVb1Dg8sAEK3ylxaRxWG9JqN6DvLYtQ8ZSiIoht/1F9hFWU+G2+6tc4qWTgUGJvWtWVlhQWBbH2yffoKV0dxXBkm4bwevimQP0HR9mVWGxhpoG57fxkqSzGvzdGCeDBZ5KLAauxSUlrTkc7076HDVZF76kLZEP7lY6sq0qnOVaGOGQcuLkJnxhIEoGn5mSq6Q8yy77rGkV9aqvXdZO57/nwzSnpTEsvEpA3XYZ+SJX3t/5svf7SGrKkRNVASQBrBAzJutA1+KrU101wz77QLkile2mFyu2tcYZ8nZ7Ryas6AWAQQuVMGM3CTpN0Ol27WFySxqWhkwHd46EjdjOQFxVOQfLfZvGZBn+AbZAO0KkF5sMf1atax2ZITIhqWQS1F+UxwdRqlVm/8SeJVc1Hqsj7hz28aTMHKHhMIdu2axdFsMVKYako/UazOqEdWEyAsRfL4ujpKp70mbtAz2T+tQkZ03sjlszMQji3hbjQaREb6b4PSco9CHKvzzy9pnL5jxy1Rf0bxQO0ApODVoadd0Rq+IWfRwTZ/NmR9WbTTqW1G808n4m+pHHW6RM/KGhsrzZPRIvw9I3YTJ+UT8qtaJvmNaM0rpBg/cwNwABFLe5hFQ34Io3oN0fshrk+hnTueh0I5JqQDNdaNopAZ1jWRhPI/EOghmyX1qkw== 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)(39840400004)(376002)(396003)(136003)(346002)(366004)(2616005)(956004)(66476007)(478600001)(66946007)(4326008)(83380400001)(66556008)(36756003)(107886003)(8676002)(8936002)(6506007)(316002)(6666004)(5660300002)(2906002)(52116002)(1076003)(38100700002)(86362001)(186003)(38350700002)(6486002)(6916009)(6512007)(26005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: JRcK+5rw+wuylsgn4upNNzezOsa51HsjXW+aPBUjSeu+ImkHM2uXE+rG/PUDMulf9VM4/1A+kX0ib/R+XVrRMv5dII43O716DoBYlE0X0VVttwRZuF6b8QoOfGAj043N6lTdSUf86gzfSyGZYGudc5WSg03u2nOvJX7Vn5C+mEoCS/uaXiHDxpbB8Vuj7AtWWyQm2WjbK2H4+M8PvERZzRbqzRcP9ikcvxszm8ePsShIreSh6hnVcFq0N+pOp0eAHNOBjnSfFtAC8GM4WmSDn1qn/zAZwOfqxkRjd9ttgF91C6FAHkWVg+FrRo4jXtLGfq41RBtCd4OB9XiPJyNJTajK3ewaDtm43RjnATZNWzBwSqIDw7XrHIrDqg2q+AZhwHMCerYqgWsN1QuyyyMdCyKs8ZL6QV/OOsHktpMsXYvTgSh+PrduKDKxMnmdnRYHxoyA0EO36Q8zPUsvLpib9Tt7MNOak+FvkZKB8+NTiaVXe7jUTMQxLob9rcGlY6a0pAOaQPj4VcfM1odScyN1vrjgkxjyAE/k84wAt6qveVcW/5SkGibszwShMjmi19Z5AVrwgMxgEuT7F+V3cOoNQT0C0IR5ybzTrXyo3aByQ9ReHh0p25Hl/1B20nf0BTq4XlW+/ZqhTVPk5uiDlhPG4A9lhDNHM25VFHXEC8MxCzEUSH9t7cruEkF5585bXaXif+DFR7RB41E6vrbGPXlD70BElg2y5hGVvAA9EpvAnjQaiNzhuUf/Euqu77SZBuEh7xM8NsD2capd4r6pl1HvQgMAjrhhb2+EGjEmnXMWEB/WKhbti47GVdsbAxBDa1LdPUZqlKhNiVRYtuxvpBFxjptqe06aeSF57YgJzK1nBNSpGKKVMN27e67zz6Z4Z6IdCgqY6xLkFpT0QtnSLnT4CNwv+URc2QLq4A3KxlR4Hq4tCoq1eF2QijUt7t7BQKksgBSsDWqKdPg/RTN7rTEK3AXiHonckNqJpa3mUZYqwyw94AwEEmyNxIOHhXq1MJ0itIWK4j4k7QeZSDmNx/tdDJwPpfvSV/PtFsIUseD2jmEsc1UdsVryGQemUosROf39oFYO6n3YQz3obuDn0AWi4o0py0WBR7E88JS33rR0XWx5ZmUC0QAH4NGFOPaf2vz24SuojI47gyCmR649I6AwKI0eEyk8aAdGm3UKdiRFvo35IdNryHg/FjTpqS89hPwRWM4uOeJUzzGSu+tULDPXE6xW7vDaL4jk6po0Txm4DXyaMdMyAAuJ4liyuZBw1SBtUfeCK4VdSHBRMexc89beWwy+NoTze1/uqaElsqruMXHRWNdRDRH/KYsUTehPS4+z X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7684017d-f296-41bc-5476-08d97c2d9c0e X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Sep 2021 11:55:58.5517 (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: eOQnNGCjMTSP+jMlU3L6VCbRk/K9a8YG0nqlLFwqECwwrFBrTW18CTsH86E0haM6ImqKE/v4HxXv30CZ9xJ+B/oJ8Tq6fmlo4sMRejf9nCY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6631 Received-SPF: pass client-ip=40.107.22.112; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-AM6-obe.outbound.protection.outlook.com X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 5.0 requ) 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_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" - options & flags is common pair for open-like functions, let's use it - add a comment that specifies use of @options Signed-off-by: Vladimir Sementsov-Ogievskiy --- block.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/block.c b/block.c index 5d49188073..3a90407b83 100644 --- a/block.c +++ b/block.c @@ -5119,14 +5119,23 @@ static void bdrv_delete(BlockDriverState *bs) g_free(bs); } -BlockDriverState *bdrv_insert_node(BlockDriverState *bs, QDict *node_options, + +/* + * Replace @bs by newly created block node. + * + * @options is a QDict of options to pass to the block drivers, or NULL for an + * empty set of options. The reference to the QDict belongs to the block layer + * after the call (even on failure), so if the caller intends to reuse the + * dictionary, it needs to use qobject_ref() before calling bdrv_open. + */ +BlockDriverState *bdrv_insert_node(BlockDriverState *bs, QDict *options, int flags, Error **errp) { ERRP_GUARD(); int ret; BlockDriverState *new_node_bs; - new_node_bs = bdrv_open(NULL, NULL, node_options, flags, errp); + new_node_bs = bdrv_open(NULL, NULL, options, flags, errp); if (new_node_bs == NULL) { error_prepend(errp, "Could not create node: "); return NULL; From patchwork Mon Sep 20 11:55:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12505131 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 966E6C433EF for ; Mon, 20 Sep 2021 12:06:32 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 149F061040 for ; Mon, 20 Sep 2021 12:06:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 149F061040 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:33022 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mSI47-00026A-6j for qemu-devel@archiver.kernel.org; Mon, 20 Sep 2021 08:06:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33338) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mSHuE-0007jP-LA; Mon, 20 Sep 2021 07:56:18 -0400 Received: from mail-am6eur05on2122.outbound.protection.outlook.com ([40.107.22.122]:7297 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 1mSHu9-0005GK-AL; Mon, 20 Sep 2021 07:56:18 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R/QhwBhmF+jR8y2SlHX7HLvTveMrAWRkfh3520czTn55UuzrGYHNevjpSJjMWhHamXBVaawg/IEuewaDStWUXStZWXAfOJP8w9HcCdo5Y6CALWyPcoXjL9lJOUgvUabJ0YPJ7RCdWUHOwau0uL1S8k1SEgQiXpx5xpf8FA+838r85Z2DW0te9o/vm9dCQvdF3X5IDr5LyP3fkH8OW5fbYEBUecNaCtyFEX5cdxO8gc7+SQL3zMP/HJEbO8TXRgRSCSHzz8YsCdBYpnzD79VE55wCUBAUojM03WhLnh/N11EtCafjq/TDnT220kPNnmwjJMxkpoMO+4MH4eFYwMbmZg== 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; bh=Opi7CqaIDbgxGWTirAD7huBVH9yT68sPOI7/5/1eeDQ=; b=QohnS20MeivtwgzMKt727jVHvFOTXoOwO2yjtsdWXSOpE+rziuyNnS9cID6V0V60P63OUlOZcdlMN6nV/3Mh0Ef+Tk63IE+mT9iqNHiTLGTwtTCWOdun0pZB+q9epuDTykRIFbWBMnLHLMV01dK2bdmuBKXTWAv4qLKcIlS7dngFIiQHqZ/JD1VBeeB3VVfGQNvJc9MOpNrsbU6x4afpTwRoLQvSLeiYMT0Fk0ljN3H60/TF0Z4HiE1wrZpfszntTzGNSDsaQXumzc4RnxiljcuYFPa9ITh5umTzEltEkwu5wCaswLItCEBCGH+IO7ZelRVQ8wXTIaX62vol+UynTA== 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=Opi7CqaIDbgxGWTirAD7huBVH9yT68sPOI7/5/1eeDQ=; b=IFzIU9+APi9vkyEO7lJ99attucc90WLT0lpsXqFucYmDeqKCIJ5+GMyCQSISY4HO4yYcwTSoJ9caac1D7k03T5Zkg2hMOiXnoVyfxssFLpXiQcRzqpwYF7WrV9DPYG+9ZOpK/1OKXMgBIpvujOEezZoeM+Xpu/bOvMZ9m7tEtoc= 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 AS8PR08MB6631.eurprd08.prod.outlook.com (2603:10a6:20b:339::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.16; Mon, 20 Sep 2021 11:55:59 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::2817:53b3:f8b4:fe22]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::2817:53b3:f8b4:fe22%9]) with mapi id 15.20.4523.018; Mon, 20 Sep 2021 11:55:59 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, hreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com Subject: [PATCH 4/5] block: bdrv_insert_node(): don't use bdrv_open() Date: Mon, 20 Sep 2021 14:55:37 +0300 Message-Id: <20210920115538.264372-5-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210920115538.264372-1-vsementsov@virtuozzo.com> References: <20210920115538.264372-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: HE1PR09CA0082.eurprd09.prod.outlook.com (2603:10a6:7:3d::26) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (185.215.60.205) by HE1PR09CA0082.eurprd09.prod.outlook.com (2603:10a6:7:3d::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14 via Frontend Transport; Mon, 20 Sep 2021 11:55:58 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 374c63a2-5a49-4b06-f572-08d97c2d9c9e X-MS-TrafficTypeDiagnostic: AS8PR08MB6631: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4502; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KUSG8/30UtMAzkvbCwCHh6jpNekz2gH7Dj05iMQUVLS5hTfBgkOGqn2o4oGU/JM9Gjve9xCKUqSxZfZvFTbMTiub3/V98Eetuh9bcIK7E8MW5zzHaE9CdeR75OCWRMKqS2/CbTs1SwEMMCCgvDWtUGiYf9BzUTD+PQdD4ccpcqVdMERGea+q1htk8jXy9GVplhwos7vCjL0rojC6v54fkBBf7iNE0OXHmEqxih/yXIM3M3O9k5gFwB9uGrNmY97rxBUVic6E4OHUCvCR5uneer+Qrxft8lXUPnmRSZNZ9B1TV1gw/FeKpnKqihAzdqWk/iQ2y3/IvcdeohPfwkiHDa3+hAjf71qsKR95Zt0V9Xh5VkfNxN5iyvMvQaWJ4TnzGginUh+jQ0qiuYKskelm7DVtYwHHi4VQK//jeHlluPhlinoEhBir1yPKrsgIV9w5aOG1h2/fMI43xzpA7uOSBnaOR8PDIfaE28bJ4BAFNE9LEkUYRCJWT5A/qrEh1FHtTwe+CZRJ6/e+5+mSvigd1kArY4VXh/O/jlExldsFyUp4FHOQFFmqI5olXDSL7AWPcrg22ZzDychkA+QnCCev6Na7+PpdUR0SxUgqkpoHX047eyKDSD6nkY59Q0lMDLlrvogWLQYafmUDKtnEcJT0W4pD3yOD9ZQr2Iv+kOJ2PUpdGoak0Q7qFwu3FNu978+5gK4whNq2aFqO8DpZkM/zg5Vvvy/kwOxuHuyPWu+bIG3fAg9uvXoxTOPKhunKu1caCJzFJLwNU43UK8V2bDtUysmZ8npa8yYN+LKHOpzr0jg= 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)(39840400004)(376002)(396003)(136003)(346002)(366004)(2616005)(956004)(66476007)(478600001)(66946007)(4326008)(83380400001)(66556008)(36756003)(107886003)(8676002)(8936002)(6506007)(316002)(6666004)(5660300002)(2906002)(52116002)(1076003)(38100700002)(86362001)(186003)(966005)(38350700002)(6486002)(6916009)(6512007)(26005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 7VWL+xgyx9OdNBylr0ovnD3//vLdPcfaHQvVp+pSlTKxw+WLUp2QdVA3GfQUe5KX2/FLAa6/TIfABnwQC5KMK5pvFiH6QT5P0Wd3m0BkKNcEtH0DTEAHaKpsghrnyOU8ylj1jwo0bkR5F6nPDFlhVgbCG8w/QhVCJcx1LxjE0acxRFq7X/LHwGs7mklVZhPmxve3sRbhiozqQQpDQ9bhFH8y0tPybWR1cvXoGjf7X0Et36Xbq+7N0Qiou6cjYFgpeUSx8EcX6mzbTSrO8UrLC7kbQsgAhNA+QSt/NbPso1WxWDsYJbY8AvpeAty5whQ2EQr/DxLYekP205fUZHMc1yVy+dZhz5g2aVT9mrCFN16ic99AAPleG5bctDd6JvvxSteR6Mk5wkQbCase5uTCrcptNjTXMnS/1aSKINiCS8axJSfgzYDKt9nipN/rfgbPwY5Va+3tK830t8dW28tOCFEOGMdM5OUwsZAAkd5Qj6VVxy9SDgc3gumispnMli7UuiqVQhJehvs6o8Hfbz6d2OkU6s9azIXIYD4dWQd8lKsZBHl7us3MlIqI27i4vVxBpEYMMIpm6tTgL4lM19u/ttDO2X0YMNSlw8ZZmDFFh98X3UTmwfdhAbB5VlvWXZnstIiarhzBKag0yggKpdegL0ubsicNlN7byM9GS3dZ2EkMFeeqZYGlxJARpMCMPs7C6XKwaxNLINET6nX8erf6ceQDq6VUA3BcRxwlvjAcy2m1Z93zMb+gh4zzfw+MIg9a50fV7uTRUOqhd2JjhebwvwCY2zJpqxq0Ho7EcqzKqyGjpJuJ3No7tIHaFNRTt/4RUmUXY+rbpRi41QTmZJiDera0tevRzPrI7fiEhWAD2Y0IoXZ3MymZRh3q7Zs725tCgeNCXHxQYKBEkKD40Q2ZzxoDBeieDKK9l2YmrpCqDVCAXdTFSsVamZ6yahqLXp8Vt52c1EIIm3bygFG7ahdt/DycZWgHBeyatFGwD/oFmX+Q3uqWE+9nFznSlxbqgM69/75XItCzk3P+uBgzRaAQ20J96jKU50+oxG8o+S3iTgwnakeKGsj5FRvp6BJzNv4ATJ47tbVj5bXxy0Sua+pw1ELXB0hVm9W0Zb18KTA2ggdvdWvNOS1XNajNRQTX3FYsOUt4YyI+5Sv/n1k1eP++EePWda+xv/D3BYOCeqkalmt4GfBYYHXgcX99ivMzPlxUkgaoaOz8ZySerzK2VJVFnpHttqoc8aR4b3enbjY2diJJY+Gn7AKLlS0qkZ8gTbT3SNo3bLo0ATKPrD9yO8ijgbFB2Jh6l8SKCpJ3u7VopNVPdlwMBPoWg64K1G1YRFIp X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 374c63a2-5a49-4b06-f572-08d97c2d9c9e X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Sep 2021 11:55:59.4254 (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: +cpffOfKT+8/Zm76+B1YrUCRRsAtT97YJo9oUhPKeUA0pJG13Zw6tr0XGsNSHg3oYJl4WfGBpYrRT/lbpV3Br7RyaW6GLXrRKxWfeAZgDD0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6631 Received-SPF: pass client-ip=40.107.22.122; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-AM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Use bdrv_new_open_driver_opts() instead of complicated bdrv_open(). Among other extra things bdrv_open() also check for white-listed formats, which we don't want for internal node creation: currently backup doesn't work when copy-before-write filter is not white-listed. As well block-stream doesn't work when copy-on-read is not white-listed. Fixes: 751cec7a261adaf1145dc7adf6de7c9c084e5a0b Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2004812 Reported-by: Yanan Fu Signed-off-by: Vladimir Sementsov-Ogievskiy --- block.c | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/block.c b/block.c index 3a90407b83..a174801785 100644 --- a/block.c +++ b/block.c @@ -5134,11 +5134,29 @@ BlockDriverState *bdrv_insert_node(BlockDriverState *bs, QDict *options, ERRP_GUARD(); int ret; BlockDriverState *new_node_bs; + const char *drvname, *node_name; + BlockDriver *drv; + + drvname = qdict_get_try_str(options, "driver"); + if (!drvname) { + error_setg(errp, "driver is not specified"); + goto fail; + } + + drv = bdrv_find_format(drvname); + if (!drv) { + error_setg(errp, "Unknown driver: '%s'", drvname); + goto fail; + } - new_node_bs = bdrv_open(NULL, NULL, options, flags, errp); - if (new_node_bs == NULL) { + node_name = qdict_get_try_str(options, "node-name"); + + new_node_bs = bdrv_new_open_driver_opts(drv, node_name, options, flags, + errp); + options = NULL; /* bdrv_new_open_driver() eats options */ + if (!new_node_bs) { error_prepend(errp, "Could not create node: "); - return NULL; + goto fail; } bdrv_drained_begin(bs); @@ -5147,11 +5165,15 @@ BlockDriverState *bdrv_insert_node(BlockDriverState *bs, QDict *options, if (ret < 0) { error_prepend(errp, "Could not replace node: "); - bdrv_unref(new_node_bs); - return NULL; + goto fail; } return new_node_bs; + +fail: + qobject_unref(options); + bdrv_unref(new_node_bs); + return NULL; } /* From patchwork Mon Sep 20 11:55:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12505127 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95F48C433EF for ; Mon, 20 Sep 2021 12:01:58 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 1C3F860EE2 for ; Mon, 20 Sep 2021 12:01:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1C3F860EE2 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:55250 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mSHzh-00067l-94 for qemu-devel@archiver.kernel.org; Mon, 20 Sep 2021 08:01:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33328) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mSHuB-0007b9-VD; Mon, 20 Sep 2021 07:56:16 -0400 Received: from mail-am6eur05on2112.outbound.protection.outlook.com ([40.107.22.112]:8080 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 1mSHuA-0005GQ-HW; Mon, 20 Sep 2021 07:56:15 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eERQhb5TNCEte4anwFENYX6A86dfFgzgMiE8/JRif9sGJyjquSeGmpyJIpQDf8iKl07uVlWff5uznS1AUgn8kVbDFdYLPUFihDCSMa6yRYecWnNDv2WkJ1YVm69sv67T7ZBi4wcEh0j9fhL+cmeiV6T/ilUuKxeL0AN8ieRzx/+/aADenb2o2UWWwb42XXgiJzf+UzFn2JAixypaSOYeO58T59xyPE0d6zxJ0FDdbiJgB1aNF70ZyNvM68vaEwyJ/dRLAqXnUSleeDBc+b9wUJhSdVl0ciludKtV96uSqHgOhtnU0EOUTbq1Dj8DVz4EXRQZ5VHXmv1AwRsPMv34gA== 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; bh=y1ozaHCrCZ+cjgQvz4VlSswTeW64tm4tAo+Ws1z1x1A=; b=bxpnNUR22FGXtk29BzTd8UL4i4P5a7U3Lg3HdldmYpkpm8bpRxSEFzGXJgCr4t9sadnscWsSKBet8qWBvBm1LdfoQ5XhUkQ/e6xwddI6DVeDT3ckx7CpdxsOBe24LHDk6rN7IFhdrIq6869rOqplOFVmwjCobNYY2wMb3sI6j3IsK9Zw9JJN170xisztqjGcrspNmlWOz2MdMhghn6Ii4r1tDXtpV86U5EuzaZHi1CsGE3uynWEZ6klLeShYGfeuRoqieHPyv8XEH8qNes/30QfFbunKjgPKNWo0wBMUUdQl2uwfUfhCNZlrBF4bdWQ4o6GexTPXYjAyTii+/y2Dpg== 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=y1ozaHCrCZ+cjgQvz4VlSswTeW64tm4tAo+Ws1z1x1A=; b=ir9Bro06fgBzgXgM967dMyAvgssBNJGJ7Bh9ierOzycyBxL4KEtpGFexT5fuS8gZkCXJshwaXHTzT4NVFRTktkuCH7igOa8eYRt28jaqSNBEW6RnYxigCBQYU0W9UAdH6vpxENcURgq0Nz90zI+kuU4Zy8bhHSqX4xTnQpP9QQ8= 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 AS8PR08MB6631.eurprd08.prod.outlook.com (2603:10a6:20b:339::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.16; Mon, 20 Sep 2021 11:56:00 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::2817:53b3:f8b4:fe22]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::2817:53b3:f8b4:fe22%9]) with mapi id 15.20.4523.018; Mon, 20 Sep 2021 11:56:00 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, hreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com Subject: [PATCH 5/5] iotests/image-fleecing: declare requirement of copy-before-write Date: Mon, 20 Sep 2021 14:55:38 +0300 Message-Id: <20210920115538.264372-6-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210920115538.264372-1-vsementsov@virtuozzo.com> References: <20210920115538.264372-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: HE1PR09CA0082.eurprd09.prod.outlook.com (2603:10a6:7:3d::26) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (185.215.60.205) by HE1PR09CA0082.eurprd09.prod.outlook.com (2603:10a6:7:3d::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14 via Frontend Transport; Mon, 20 Sep 2021 11:55:59 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b26f17a0-cb12-40d2-d04d-08d97c2d9d23 X-MS-TrafficTypeDiagnostic: AS8PR08MB6631: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:820; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9Jwm8gW9Nmpwoace4sNAvhFgLQvacNlBaOKmw+c8HFO/h9kehn9KZW24wWtontutaK6xBsSM8WsnFVAcVs+QMOpAu+44+1LoOwr8mplDTarp8O37Rxzlg7EsVSniMmy1A1F5JsWLMgVZuph3+B6c22Khw0zZnqN2OgDlQFaWOPNH6FJNyTBlRWZC84d+l1hlKTpSEi3bNfajM/EKPOmrNIFm7duKv2Qq8w5mSaE7ssfftxW+mIeIewv7KtU8kaBvG+4iBZ01OHsJpCa0Ebk5BAmx3noHTHGg42pzWMZKkYadrneyZnBHuDQvVjwe1WdTpaWUCJqusbnBY4/9oti9RHnigfQwTHWCF+/3nXhu0iYvgjUIYn3hyWQu5JHCSdvSLay2T0KvmATfl1ga77YRN54AJBpMD954UuJQqF6K00DOhizfIsY5JUgK8wef2r3+0zIv4SoDY8q4JXyKGT4Z/RLfJiZrNlxsxptPAP2/d9o8HVt2JxSWzy60TzSWmRpPHgIJa7xF4dqQK+P5+Xy5Qu2a9FvMRyvZ5OXkw0lG4EXrjwJYOJw4zLEozBA5+v0uT3QnYgudFy6BDRc+S8IZS8HM221rqF7Ml6v8WX8kxF9XeF4/VBm+AZNXzjNEXWBjixHglgheU/FjEbtVbi4LhVUv8ejO68eq9sipd6Oegd0sOJeyCdVxQxRs3GFMAzOOS/D2foppiwVDSOMrlwJbnw== 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)(39840400004)(376002)(396003)(136003)(346002)(366004)(2616005)(956004)(66476007)(4744005)(478600001)(66946007)(4326008)(66556008)(36756003)(107886003)(8676002)(8936002)(6506007)(316002)(6666004)(5660300002)(2906002)(52116002)(1076003)(38100700002)(86362001)(186003)(38350700002)(6486002)(6916009)(6512007)(26005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: eR3g4Ah6Bd+d3Ekg/wIm+jrlezB51kjHNpv2Dmo7kvCFf8StUA7KqbcjIFK1PaTilRDISFrtJbvS3Ur9Bn2zckPNWhUKzVvAq3BJA+OWsU9HOkdh/l7Y+PLoa5e/GxxHDp53kPvVWCfFg7czE0aDaeYgrTW+94DhgyxG0jcmzcUvSt6iTtRpKlc5F7/NNr46yzc3CJ1gpPvaSVA19aVTx17ZUDU+pibnShjXyzG8E/bw3e438KhWGyS9MuYPof798vaD0gqhDhCZgH5sEPXiEeHc5aHKAdfn8pgfBOJMWYceK9Q/ZT+wOC8S+ZgK3myYqMpKU3tCSXMDJj8kSJT8VYd7DiMyiE1j+G68B1QswRYXzNRqITzdMYxU62UqWEFZDoWpFZIk8nhZSDe/bgvZZsDmFS/Q8Nx6u0ssuaP2Xid1IreehqNerhBRjF2XVVsylye8hVQOEd/LrGrMyssm3Sj9zyE1fPlCvA3cKCB3vtQskIHM9PeQ3W5qixUMK2SJ17Rgl9FB/PTT7mGG/prTVLmkpXNMna50LM2tvQLseGsHB5JFTmma3t45w7smNLxn6znxjV7MIE+jMuonMgZXVZlDqG4Mt6FFEUlK9A0Q5UhTOQv6V9UYek4yxrpNGGx+bzRc8C22XeUsI5NY+NctNfO69Of7OAq9f2sqZBVzbP+7k5GmOyfGRqCldUaEUXdaUepUVaNb3RaUVr6Mv2rHOZ4oF2kQhKQb+NhFVNv6XVDHtXB2y5rwilz5JsU0uyESLIhHDw9IwMcmDEcqnOqtlMau8P2NbMKmUdyAzyh0oa6wbLjagG1nJh6gynqh+mcK6zBeFn3ZUuLS+uhb4eZ7MPQWr3fFX55K4YT3AkEqbbzAkCc7WzBR0DrIplVB8cpcOoi5DRnPliXp9hWFkfg5oODHHBKu5pZ9nXbKopTzSd7UcbL/+1bgyqbk2so5S6E18eJpVMrhfM5ZKXVHiUhhHx2ErdvMevw4OQrTir6XNgbhaRIuJccKnjLYAtIrWW0FTmAGeIrEI4cE5TtkBNHJ+BWMVc0fUkRBnCHwfKc8ZVcIl/lMtbMycd8EMtWdYPf2x04GbOjo8ntjWeAyTDyPMvs2TvlU1NP8c5Y0l2Ur0z4zSWilGMp2uyCX7b11o+URyuGh80YHYBNapq2tQJVoEyla+Gtv6HKZb94nySumsJ7pN2mIsC09mQSEO2zyCVfEIGJkcGLws3yRRT58qd91YD+nn1SDr3qIRMfF2hjuTPJ3e7hfkBGejstuWWbqrVmOZYPWbHCG9461BSKXVViXum60p/rT/LjOVX6UcUOn1UWgPMjJrSftkuvHjfPAxUBM X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: b26f17a0-cb12-40d2-d04d-08d97c2d9d23 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Sep 2021 11:56:00.3429 (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: FUsNjLCGcNgfOhOKPEHDicebWbxGlQMF8nxCdBS5nq6C2+JxjWFYq+Io6XeBrMZ3hCDla+DF/kO5TCWeb9NCUYG9AE9PmzZRpQaRt6eo2AU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6631 Received-SPF: pass client-ip=40.107.22.112; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-AM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Now test fails if copy-before-write is not white-listed. Let's skip test instead. Fixes: c0605985696a19ef034fa25d04f53f3b3b383896 Signed-off-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/tests/image-fleecing | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/qemu-iotests/tests/image-fleecing b/tests/qemu-iotests/tests/image-fleecing index f6318492c6..35164e9036 100755 --- a/tests/qemu-iotests/tests/image-fleecing +++ b/tests/qemu-iotests/tests/image-fleecing @@ -28,6 +28,7 @@ from iotests import log, qemu_img, qemu_io, qemu_io_silent iotests.script_initialize( supported_fmts=['qcow2', 'qcow', 'qed', 'vmdk', 'vhdx', 'raw'], supported_platforms=['linux'], + required_fmts=['copy-before-write'], ) patterns = [('0x5d', '0', '64k'),