From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.openvz.org (mail.openvz.org [69.168.225.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id 99D8580C27 for ; Thu, 22 Oct 2026 14:52:04 +0000 (UTC) Received: from mail.openvz.org (localhost [127.0.0.1]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 69MEoqAB009796; Thu, 22 Oct 2026 17:50:52 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 69MEoqAB009796 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="sRm9I79k" Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 69MEodRh009750 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Thu, 22 Oct 2026 17:50:39 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 69MEodRh009750 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-48df02b91f9so611677f8f.1 for ; Thu, 22 Oct 2026 07:50:39 -0700 (PDT) X-Forwarded-Encrypted: i=2; AKwUvBy21s8dXwPXjrATQlVcZDwXmEaFNcFLnwqivyhcQ2cgKHVoBiktweEfwiIsZFKaVtztOxtYoQ==@openvz.org X-Gm-Message-State: AFq9FYKEhvtMBpptMDqeZ7OTyRgvYl4mErtacOZcpmFPlLlAIXhCsHnQ uJOEa59MssXDWy/pvJzsxq5EpUEMhagVG1Wfc79x2/ORt/SPZQZ0mRjAIJJ9kVRzzheMCxWMbov LebqSuCK5K2UUswzV9psniCse3DUrNDHOQjatvAIkRyTCMYRF+Htstg== X-Gm-Gg: AYBFou1LvsGqUsils2S+H1ltaXWvM+5S47J6j6GzAf9Ws0qcNPT7qYFDXe3NRiFNdlx 5L6KhgYHinAjJawoUdG0OeIcUGcWZymLdcPg40w0eAw4DUfwDRVhJ+YrasoiUnleOV0yV2KpT2h aNw7rHPyip2LWcTRq+XzRsQDtcuAkwlcv9X5vlxt8Ib0UEBbnhXNwJmlFENHLrfYU0zr/+AoYO1 BBEVn7BrxiJrHUakcnqgHVIx//U8LTxXTUK//nVxk9n247NegmIM7dKGxxKVXzb+iOmyTxA8C/Y 5InaPr5XxFSUiE8JSO3isc1YzRpDy+g02ND9AH7bLyXA2I8m8TCPEEhX9iC8YlOgm53ylhvLbes nA8TqVivovRZIKCUZRKJ4zORgZyQ+ X-Received: by 2002:adf:e009:0:10b0:48a:f4d4:e1f3 with SMTP id ffacd0b85a97d-48e2d110a44mr4089753f8f.13.1792680639518; Thu, 22 Oct 2026 07:50:39 -0700 (PDT) X-Received: by 2002:adf:e009:0:10b0:48a:f4d4:e1f3 with SMTP id ffacd0b85a97d-48e2d110a44mr4089716f8f.13.1792680638929; Thu, 22 Oct 2026 07:50:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1792680638; cv=none; d=google.com; s=arc-20260327; b=cww9pXZCT5dk7FqY9HOQr/itd9Q/XFLKlwdvQAcZVS4w26fF4ll4FAIiNF6b5gIeVE Jil3dHtdn0vcOmNwkVpTkHSaHIQiPJVyvdWyKlaDsRotUkdvM4IpQTy7AWBAP93xt4EI 36ntwiJjP/uDyCnUqasRTwtE56aVCl/11E/r6obR4lDKKQM/y9PaUKgn9PwwStSibJwV 7G91PXoxq7auVnvdKORJA1/5k1ICdIGS/HkoCyDJfrNdO0ju71QKv5n0dxdsoafudSJs HxgL448RCkd+oUa7Oj4IJFXMUxMPJXKtUCvMQwFrgDjcgdwuAHvJMvyH+S1AnbC/62kA DOzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=RZmaTSh7u6yOBXl3VtHxG/PBqF5IN/O9n9zHTxk/Voc=; fh=1MEQxOGYABaQPNQS1Ckioh0rrUOwgCYjd8t5csgx5as=; b=C021bf5YN7XZs1dgyEZTBTDefZkoBadozQmjIMj2q+ttFZMX6WNO9AzPALoXXBJ2bh ssfjw3iDPWTYiBqmTsNMXs+x5oNmWxUhNGQrJ7NdpvcWVJNxgasJU7ohg7x7u1PgHaN0 L5l/2Ht9KYNR8SfwOQ613EpN0ucSe4zJFHEC8lyCd7mYaTZFH6FV55lVi6W8umWPH+xO NhAiHMR7LyarTPgF4HyLE881tHPztUmR/TFDNc/G7mzQvpUuPZvyV1HOZGmSnicWF4D6 crgwY9mK9WymUtrmP4W4rFyIBnQhdira2gbgyZsiAN/tfFhDNrJex0aAOq2dfUnbQdcn Z63Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=sRm9I79k; spf=pass (google.com: domain of alexander.ivanov@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=alexander.ivanov@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Received: from relay.virtuozzo.com (relay.virtuozzo.com. [130.117.225.111]) by mx.google.com with ESMTPS id ffacd0b85a97d-48e2588cbcfsi11043542f8f.431.2026.10.22.07.50.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Oct 2026 07:50:38 -0700 (PDT) Received-SPF: pass (google.com: domain of alexander.ivanov@virtuozzo.com designates 130.117.225.111 as permitted sender) client-ip=130.117.225.111; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=sRm9I79k; spf=pass (google.com: domain of alexander.ivanov@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=alexander.ivanov@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=MIME-Version:Message-ID:Date:Subject:From: Content-Type; bh=RZmaTSh7u6yOBXl3VtHxG/PBqF5IN/O9n9zHTxk/Voc=; b=sRm9I79kfaI8 e90Vo2P/6+VKMdnj5xIRRhOFRHAqlBXc1dLNuhWav2wkY2HtWJDQ8+pF5mVriNv6xgRBFAJq3I03f lgL5Pi5Io1jklDSbrLA72QWahgIY347kvBZhLrpoU9sHtXaGrHIvijFE7NYKQ0PlNRtC4B/89dR+h FOfVKvNozDmpK/CKODzPSqbnn2T6kG6oZD6zsJaiUYoSiD9VPFHe4CS/CS57W9cL6i7ZwYPlCirKJ c+28KxagMWJMK5qCTSJnbDjOwss/HuUx1N/nxWrP47H83RQOHigORlxNVE11D42Lsi3vK+jZL0hgU hJVUN6MI3ca4oEIBoRbXlg==; Received: from ch-vpn.virtuozzo.com ([130.117.225.6] helo=sky) by relay.virtuozzo.com with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1xJu4D-00GYCQ-0k; Thu, 22 Oct 2026 16:50:36 +0200 From: Alexander Ivanov To: andrey.zhadchenko@virtuozzo.com Date: Thu, 22 Oct 2026 16:50:29 +0200 Message-ID: <20261022145032.2128679-4-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261022145032.2128679-1-alexander.ivanov@virtuozzo.com> References: <20261022145032.2128679-1-alexander.ivanov@virtuozzo.com> MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.1 v7 3/6] dm-qcow2: extend the file in place_r2() before linking the refblock X-BeenThere: devel@openvz.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: OpenVZ development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: devel-bounces@openvz.org Errors-To: devel-bounces@openvz.org place_r2() links a new refblock into R1, but moves neither file_size nor file_preallocated_area_start. The refblock stays at or above the watermark if truncate_prealloc_safe() in allocate_cluster() fails after place_r2(), or if a parallel mark_cluster_unused() lowers free_cluster_search_pos before the second pass of find_unused_cluster(). Truncation of preallocations on suspend then cuts the file under the refblock: R1 on disk points past EOF, and the next session gets -EIO on allocations in the range it covers. Extend the file and raise the watermark to the end of the refblock before linking it into R1, as allocate_cluster() does for data clusters. https://virtuozzo.atlassian.net/browse/VSTOR-148171 Feature: dm-qcow2: block device over QCOW2 files driver Signed-off-by: Alexander Ivanov --- drivers/md/dm-qcow2-map.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/md/dm-qcow2-map.c b/drivers/md/dm-qcow2-map.c index 78ee7cf5e881..810dd22425ae 100644 --- a/drivers/md/dm-qcow2-map.c +++ b/drivers/md/dm-qcow2-map.c @@ -82,6 +82,7 @@ struct qcow2_bvec { static int qcow2_handle_r1r2_maps(struct qcow2 *qcow2, loff_t pos, struct qio **qio, struct qcow2_map_item *r1, struct qcow2_map_item *r2, bool compressed); static int qcow2_punch_hole(struct file *file, loff_t pos, loff_t len); +static int truncate_prealloc_safe(struct qcow2 *qcow2, loff_t len, const char *func); static void handle_cleanup_mask(struct qio *qio); static void process_read_qio(struct qcow2 *qcow2, struct qio *qio, struct qcow2_map *map); @@ -2088,6 +2089,7 @@ static int place_r2(struct qcow2 *qcow2, struct qcow2_map_item *r1, struct qcow2_map_item *r2, loff_t r2_pos, struct qio **qio) { struct dm_target *ti = qcow2->tgt->ti; + loff_t end = r2_pos + qcow2->clu_size; u64 page_id = r2_pos >> PAGE_SHIFT; int ret; @@ -2100,6 +2102,12 @@ static int place_r2(struct qcow2 *qcow2, struct qcow2_map_item *r1, return ret; } + ret = truncate_prealloc_safe(qcow2, end, __func__); + if (ret) + return ret; + if (end > qcow2->file_preallocated_area_start) + qcow2->file_preallocated_area_start = end; + ret = qcow2_alloc_and_insert_md_page(qcow2, page_id, &r2->md); if (ret < 0) { QC_ERR(ti, "Can't alloc: ret=%d, page_id=%llu", ret, page_id); -- 2.53.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel