From patchwork Thu Jun 10 11:25:56 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: 12312911 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,URIBL_BLOCKED,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 8BADEC47094 for ; Thu, 10 Jun 2021 11:47:45 +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 1E5DA613CA for ; Thu, 10 Jun 2021 11:47:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1E5DA613CA Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:55574 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lrJ9z-000351-10 for qemu-devel@archiver.kernel.org; Thu, 10 Jun 2021 07:47:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59020) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrIpw-0003no-1I; Thu, 10 Jun 2021 07:27:01 -0400 Received: from mail-eopbgr40090.outbound.protection.outlook.com ([40.107.4.90]:54851 helo=EUR03-DB5-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 1lrIpt-0004Ve-A8; Thu, 10 Jun 2021 07:26:59 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ixKKl/2UyYr7J+e9MqP3wnSeUmht3mVAIMh1ZkhcqvD5KfFg9HuIzddMJIMtLw0IMn8Ycc3OQMEItinMCnOoC3Z/Glv7GiNEzlVYUwLf6fvY0zJJ/x0Cj/IPEHYRa40rO/kLEtyXrhTseEgCFDKLZ1yGKSi3s30Lma0PlrFsTbzoeED11kUH20bGW1h+ZjEcmI70BXZc+eRkWga457lGp+3O+pvFI3a8FwvMXOZP03TXZ5ueRdhia+EoJc65O9eQ5okzNHjwwNe8woEZaEaxudUUOY90tlt4i9P4mu/KhDx6YUcduOMkWC53nzhWmgKA/4PuAAE+Q7vK2gw7uJiTsw== 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=1N2uiVLFU5ZMtznDXUsWnweG+NBu3A9QkTphI8xiDcg=; b=E3lbPhr7n8GZJLJELtrU8tBw2h0ybbHstmfEWCfp178zFuBB850jc8MDYxcEBJ1rZLfEKx1e2Bqg6oLWfz6xfl5rD9pFymMzNzxOhLKRLPLHNLZnJw0bbJJAnlcGeuJ8qSRgRoSMwjxPE5moboxI9e0C7l0eV2zQUDA8kL+p+QDQHWL27simlRSM9Ckl24eXypHZ4XCDSvK1REh56Qc0k2TDdFdzaAJcL8Kfw24EnCgO9t9dElagzV9N9RU5HYRBJ9px4Wu1stIhBv3V8O57/p2jpyDGJPfO7ZhXoJ71Ht7EvtW1KT49YDMZbir8vOzY0ShtkMteE/W8vX4SJHjWCw== 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=1N2uiVLFU5ZMtznDXUsWnweG+NBu3A9QkTphI8xiDcg=; b=Kx7GYkTA5276CIBK9nInrwXSVqeRMM9qNnt1RviCWzYQ5q43cBZYbg+tlpAYC5CepsJo+MIQ35SbOh2qRFpVTn1HMKbJ5rvf5Q3kPWLnFD0lJrnL8QlgxuPnmgskK0Gc9JDE0Lu85KZT1eVNz81dDCeAWY3WSzcFMsCEgz+GJ6w= 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 AM6PR08MB3381.eurprd08.prod.outlook.com (2603:10a6:20b:43::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.25; Thu, 10 Jun 2021 11:26:47 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::f928:f4f2:77c0:74b4]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::f928:f4f2:77c0:74b4%9]) with mapi id 15.20.4195.030; Thu, 10 Jun 2021 11:26:47 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, vsementsov@virtuozzo.com, jsnow@redhat.com, mreitz@redhat.com, kwolf@redhat.com Subject: [PATCH v5 13/35] block/copy-before-write: drop extra bdrv_unref on failure path Date: Thu, 10 Jun 2021 14:25:56 +0300 Message-Id: <20210610112618.127378-14-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210610112618.127378-1-vsementsov@virtuozzo.com> References: <20210610112618.127378-1-vsementsov@virtuozzo.com> X-Originating-IP: [185.215.60.215] X-ClientProxiedBy: HE1PR0902CA0037.eurprd09.prod.outlook.com (2603:10a6:7:15::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.215) by HE1PR0902CA0037.eurprd09.prod.outlook.com (2603:10a6:7:15::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.21 via Frontend Transport; Thu, 10 Jun 2021 11:26:47 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8fcca708-f61c-489f-9a1d-08d92c02a273 X-MS-TrafficTypeDiagnostic: AM6PR08MB3381: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:243; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JoJcMWjVADA72izL95n8eRP+vkHh1jOnMNY2Hf1TFIasOijROLH3exsoUZcFCcqhVbvBpGADlRqcFPmr8yWDywTskGp0oZdacOfEXny08RiwphE1AfRIZUtsU/vLhBtiFBuJ1pq1PpytqJVZc4BBhMNYrv03Qz5ohTPfWD0/kDtBKsEWt0D9lGl7Ou0+PW/LHiOMKERkcnlQyGO1RLSv3qXhaxDyCO5RlX5J5vNIL5pW1snI7moVvcQLDWW03LNZg1vIy4m5LScOCPdHIHZxMwr6Xul3OxdtSdAm7d+yCvtPeczIzbzIjDlMuFVAlsJLxAnyIhzkpk6VZWLyz4dTMtazqN/lH5GQpiOoS7U4Gwn35zjxFaA7Yj4nqE0aDyQJBdLtpM43nnZV9gcubtEURhcHcd5a4yrcIBykeGeOwpc/gyEA6o10dGB1qkwgJCqBztg+iTRh/7gTMKC0QXLJoSPn3izbZ/geMQ12AHYveHSeVr/cfCGdOFMiW3ysMOqJfAEtMIGKE2AqIXTaXInCRPgDE2bXMtoD73DDEIVX4pUs93ejURRF4psHDb80pIl8WLFhHgZkCXjLV3orDzjI/sFDFGk6BMqWBKjkvAqoX/rrkR2YEeA+8eq4kw4AN//HOQr7xI4ZfiS8k010w04x3mi66G7zxok9U/c8D9U6VjWTek03TILDaA5uoPh0Ebv2 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)(396003)(366004)(39840400004)(136003)(376002)(346002)(2616005)(66476007)(83380400001)(956004)(8676002)(8936002)(38100700002)(6666004)(66946007)(1076003)(5660300002)(66556008)(316002)(26005)(4744005)(4326008)(6512007)(478600001)(6486002)(186003)(2906002)(52116002)(38350700002)(6916009)(6506007)(36756003)(16526019)(86362001)(69590400013); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: LpG6Lk/QRzkW2EJhwF4YF4u9PMw2OfCY3wpcRm1mrFt3Brr8gBtRlL8GwXKxdF3ogshTVaZt9xv2smVAR+S6lqVOCa/QbrEC2iGBME5VvxSaVGI3MYNIDeS3k6BOO/plxX/U/XVPL6jJ3nje2WC7MvuW4KOmNKs2iOKdqW0EeLkCDlwUoTQ8IC2B08/zvooDHcYikIvpxN1sk9C9qQxXAi5ml5lwinHGPM/Fw8+cOb9CMpVgRZNAnVurozQ1dAyFR1HFLQe/aQExYlJok3MXiNhdDngV1CVRdLhtPCfSZcqQvJrbRtYUvMrnX+Cv1Orts5ICP4j3Ij2A7kqQTfN39JD87/OMbzaufzgfaGKDWO4584x+48PDQJwk+qsU/2KSQshdixf49J06WX1jA0zoADboCiNa3pI93w9qC/KVO1zSxJbdcck1wrQntOAV4B1W6v51jN82hRbcH9k6fOgIrV4uENEd1vX/FWJuRz5seDvoxB07TF9AvIvTxlYiuBrJtlikZUwkkvlh3zKdDGXo89XvIP7UyImXXhpnOPfhGxrv6jONXhbjeszubtkF99O4Dq9yEsf28rQkXV3PD9/6rM1gQpXwdv5PgH8FVEf2GJc2QmkSnI/tLJXlVKPaJubN5GY2IuDGds1kFF1v3PUKq5rD76FjTp24g7O8IRpxKCu+am3yqIF7wGs/XmdjJJnRBnWg3xJ+oV+uFxdPdxmak4yJyb635HshYhSLIJ6xqRnSIYy6Cdzmi087NkkO3499T/J+nJB95CIEStHN05yj606o6+BCiz/BaMMfCUYKQRn5t7y8ZxO5iZ42CF2WPH+qOUeDykcU8qBNSwKoW821M77Bc2VfLa4896o39tObAG+awvWxLk9sDd4zgWXLVohp7uwJpX/0HDx/yCLVx1NhZd+W434eDI/t83qasdOlIjw5XrXrwH7nBB+GpFr3U4NQSrCJg6sO3Vtkq30dR/M2t+buCjj4gR8iNbAncCT6p9sxSzC1B5rXg2RYCCb1yFSIWTHlwDtrgt+vYxWGFfsQxfN7oi1Sjz91Xcg6Vz89Ggwtn1OowUUTyRYxQq45rzc2aT951o/XoMVvc6iuIZE7zCuiox03Dny6fvoHEN1MGiBEB30OpR3zbMrIUHeC+g6T8LIa2sbVh/ZItVNM5SMyM1p5GSZbTm9iFOqcEX/T4HshGCL7pN/wjO0PimflvbtVKsrOh21lmZiD5h5qg+hw+L8TkmQwwlch6aPK3Aa2Wq9xaLUmbhOcr5bIonNnSMr6xfm5cqMFg7BgNPKd+LTCBHUtKY6hHPXsRtf2yw+Gshyqwb66xH1lvQYoDTVLspwg X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8fcca708-f61c-489f-9a1d-08d92c02a273 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jun 2021 11:26:47.8509 (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: +GnHLsNmG/R6eb3CTOCJArcQawUmLvclGWEl2D+m4fYy4DZSiMTv5gGDyhYbsM25Eg06BZMBv/L439+UWTqLo/b/e9w7cayOpb6rdOkwuJ8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3381 Received-SPF: pass client-ip=40.107.4.90; envelope-from=vsementsov@virtuozzo.com; helo=EUR03-DB5-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" bdrv_attach_child() do bdrv_unref() on failure, so we shouldn't do it by hand here. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz --- block/copy-before-write.c | 1 - 1 file changed, 1 deletion(-) diff --git a/block/copy-before-write.c b/block/copy-before-write.c index 2a51cc64e4..945d9340f4 100644 --- a/block/copy-before-write.c +++ b/block/copy-before-write.c @@ -201,7 +201,6 @@ BlockDriverState *bdrv_cbw_append(BlockDriverState *source, state->target = bdrv_attach_child(top, target, "target", &child_of_bds, BDRV_CHILD_DATA, errp); if (!state->target) { - bdrv_unref(target); bdrv_unref(top); return NULL; }