From patchwork Thu Dec 28 09:41:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505750 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 732EFC47073 for ; Thu, 28 Dec 2023 09:44:25 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rImuJ-0008I5-RU; Thu, 28 Dec 2023 04:42:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rImu9-0008CG-D6; Thu, 28 Dec 2023 04:42:17 -0500 Received: from mail-am6eur05on20700.outbound.protection.outlook.com ([2a01:111:f403:2612::700] 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 1rImu6-0008Jv-Ql; Thu, 28 Dec 2023 04:42:16 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J2IfrwM996OhOpIsc1uWj1D12+oEU9J4gpil5/kVUrSeyoNrMIAPpK/uUAgZ8yZ0UY9sRmPfWGqUt+npqOYTnt4yrKvle18ZmEfJjlafsJNiFYr6vNacwiQkXN9ldjh8MRMm0UD+o/WeHo0gtEIayyae2n3yW5tBpwpIQKEeYANtg+kzAHr0G3NpEXL+dexO1j00cy/MmUw8m6SxzVH2S+/jtVYk/wLK5Bx0Xe4NBw9rxdtJgPNI6GaAepTgQOZUEd7XxmtEIXxLO9lxdGMK//oXFaYgbfDd7Eb5IfHAPLOnbdPCO9Y7e4Asg6v41QcrLDTM4U7f0FVWk/ooyQsW6w== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=q3dDAqfScSQKpORpASGRpyoVYYLjILjPhIDAhREH9GE=; b=l8QBWtqtVqmNjrEv+3zLHy1eci8slMrz6t1e2oigpODtA8BDTEHonIDjOtw46rKG2Aoz0WOinJSuZju5XqBpXqFl+/I85mGfhf3zxW1bBpEP/UinyczcjBgb1LKoBNlCUmO4kH3PrYp8H/zrmiDxBxRYjstAr6Pb/NukyRX3T9Wbp1ERuVPweGECE1+dCiTlj6oScCcA4CLhbYtRLpgDQRNup2EKAOVP3+UF9dgOJWaPtRjPqOT2xOFxHEBZFMqLo5ZsF5HAc4Mqu4fRGAjD+TczMOVrb4JKc5+XWBN0/aPBZyDHo7AAgcWAHnaJPZU20zSidYYKyLgTr4NjWLv88w== 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=q3dDAqfScSQKpORpASGRpyoVYYLjILjPhIDAhREH9GE=; b=i9B4H3Y9aYT6E5KrnMdZqgKn8T3RlaTWLJw88PVCblSkCNL79F7BwtPVUYTGlUesLqrROe+swU7kFMETdDJ8tIAEOW8K0isdJHDn0o64MfQywM/4SMntvyt/coY0c/8HvM2Pg8yBXSI4X0bxjgF+H8mEgsxCWFcW+RB/WAiSFwil38kKFCTZWpnq/1fdYSqeHJeMljk0qc5V804v/IXdxIO+6Pt7vWcjyv2Lv19qbCXrNfQw9KTk9M6Tw4SkpzgfbkM3yKi5r339Eyz4ZtxGFt8OiF91oRDFmTgRMi+7yBVwsZ1hAVdR0YBBMSqnqD/7yLD5tdXVeeaxf98JNcdHLg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by PA4PR08MB6064.eurprd08.prod.outlook.com (2603:10a6:102:e2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.20; Thu, 28 Dec 2023 09:42:03 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0%5]) with mapi id 15.20.7135.019; Thu, 28 Dec 2023 09:42:03 +0000 From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH 08/21] parallels: Recreate used bitmap in parallels_check_leak() Date: Thu, 28 Dec 2023 10:41:40 +0100 Message-Id: <20231228094153.370291-8-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> References: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VE1PR08CA0003.eurprd08.prod.outlook.com (2603:10a6:803:104::16) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|PA4PR08MB6064:EE_ X-MS-Office365-Filtering-Correlation-Id: 9aede8ba-c28a-403b-412f-08dc07893ee4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /ommW8YQSY8huPSWwqyP3UW3Rb9afeuoPQdcRg3X16WRr/zMBfHGLjqvfJNs6K+3HOHQIdUl0lOcjtpvUYtOQWLydoJdCJ3IgXjCbnCo19hNSV5JUSStWPdUBlVFUk7kfiQRbu3qKUCeZVwDxrcZ0rH2PAhNnGL3wQoxtaPtkHS8ev7M3UWM5tIcf+/eph/bgPELCYoAwV3aYCFcKQqWnRQWogPee+PQUiB2aGfLzpom+NppypnDEByMJlYjXKYcemCmXzsTRTWoSN+JF0pDycu8ZebkW+IG3ATxFQ63w41LHM6NYeKvTk8Y0YbkFvNvtIYZC+b5XSAqDfV/B5D/3eXLH9mbb/g2/MYWWQVzux83xqOpF72mgvHmWViCt+KD912ZQZp5pqepCORYt5VSXIvn2h924m2l547LYpgXv/oF6Oa8psvWUpWjko9Z/T49AWxvq1s5b9S0w4k4NvmBJsyf/S21kt6CZzVAszCAkFe9goo/PkKlvuWymZVlofeASGac2CBI9sRLvFF3Sj4hKi+1Ba8A2APhxsdutwf59XHeucFna3DGp97foEmbbw9PcWSwhUTfv3AUJHjGrbvJyZdtFvN26tnTp/Ep9QROEfQQ/P0ObuP95LRH81RgLl15 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(39840400004)(396003)(346002)(136003)(366004)(230922051799003)(186009)(451199024)(64100799003)(1800799012)(66556008)(66476007)(66946007)(6916009)(6486002)(4326008)(44832011)(316002)(36756003)(8936002)(2616005)(26005)(1076003)(83380400001)(478600001)(6512007)(6506007)(6666004)(52116002)(8676002)(4744005)(5660300002)(2906002)(41300700001)(38350700005)(38100700002)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25YXEcOPX51W/SUvvO+f9DMzefIgnjuitqgVL3JocZrhVz/7G2jwc4kWua+l8ubCe1s+khnsDXK1awmgSS2+TpuXG/vlf4u+oJpqpnDTt9Qb7ya5i4/rkcj+abU8T4lNNWLfJJHx7aOOnwkuDgiw8GOeqZWxyZExY8T551DN+pMJF9zsLYn6OS3WTYPt8aWnZHdX2Quhu4wnKPV7nFWONFak4qOE3orIK+xUsavpuRh1uv3DJjdn807QK7JFhY6oyLaYNPU023ia0LkA0twAAPhDTHE2YNoO25UZhaz7trM7MJvo4pZp+wcN+vac0qAzHA9QJGSq4OfhRcFJnGjLlWr1b8eC/USUay9ngbLp50Egrm6mq3dENCRgM0P4y0Ie7KkpIXq8tJTUtRCrZWIwJ2XSVqvagT+MBTjGXPtT3EHb9BVik4HJN39N8dTPhw2R6wRhLqhhaqqbnhr3otVsu8mZza6PnfLYkTPSDyv6vhTJPnsydnvcvuqevR7+QmsVl4AyHB5OaT4u4NCvCY7S3pA4eIjN0vHiOqFdHcu4TcAU812r6ruxJc4AxRMU2wKEMJeeJ4gJWPtGmpntrEN1zoYwJfnnkpBoNLu+c0IK/6vn10LSzrCPvKFtbPfAun0n6g2Nb3dI= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9aede8ba-c28a-403b-412f-08dc07893ee4 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 09:42:02.8003 (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: gpWg7gcb+w3HwRTRKDNIBFPtG40KPksfKEPBia1JB2XR1tzUO3lBBaetrHHwoQOYBxnRcDISzTcdoqDDMwpBg6rtw5JZCGVshCYbn4/TRKw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6064 Received-SPF: pass client-ip=2a01:111:f403:2612::700; envelope-from=alexander.ivanov@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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+qemu-devel=archiver.kernel.org@nongnu.org In parallels_check_leak() file can be truncated. In this case the used bitmap would not comply to the file. Recreate the bitmap after file truncation. Signed-off-by: Alexander Ivanov --- block/parallels.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/block/parallels.c b/block/parallels.c index 8a6e2ba7ee..04c114f696 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -807,6 +807,14 @@ parallels_check_leak(BlockDriverState *bs, BdrvCheckResult *res, return ret; } s->data_end = res->image_end_offset >> BDRV_SECTOR_BITS; + + parallels_free_used_bitmap(bs); + ret = parallels_fill_used_bitmap(bs); + if (ret == -ENOMEM) { + res->check_errors++; + return ret; + } + if (explicit) { res->leaks_fixed += count; }