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 480DA80BB3 for ; Thu, 22 Oct 2026 12:18:47 +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 69MCHWga008128; Thu, 22 Oct 2026 15:17:33 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 69MCHWga008128 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="RPm0RxP4" Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 69MCHJVW008068 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Thu, 22 Oct 2026 15:17:19 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 69MCHJVW008068 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4a2063be13dso5984005e9.3 for ; Thu, 22 Oct 2026 05:17:19 -0700 (PDT) X-Forwarded-Encrypted: i=2; AKwUvBx4++s9YdE7/fE9+l8JA3/x7hm41r+NufRla5FClV5zzkE2TzxB8tbvoMc/ESw2JUaCfQZlyg==@openvz.org X-Gm-Message-State: AFq9FYKeB6S/EZLDubZfYy/Ernt4eknDp2NMqGDSje1KZW9a0wDnuYB2 gmQv0ul/hFueo6AAMVuIaC0Th057oCTW8pqYJo41IchYEKkIe+5mUM0otGn9ygMj6shOQJLxgn8 KO4U9zE5+BnGuvycFteRsqS0yZvKKa7JeDgbsJlua/UJer1Zaq6nrFA== X-Gm-Gg: AYBFou1bskVZjIgWqzcdoakJFSeKCCgMlCctJdyZuyGYX6Ra8HVc1KV7lAR3OSUAdDy fu+nkdtQxyLM10B42czuRIwbY/EA2uORPawD+M8FtNEiyBipPRR8qK2+a1UgfTMBcKkuxuQp3+R n9q9pV6PMnTytgep94jRt6Cxh1/r87nWZijHOioN0cGaf7QG5FEHdceOYk98/bQrI5NCpX5BG89 ymSllzZ5Rule3L+3DLGK8TAbAS1NNKMNuood94jcvWqWP0EO9ZSA02IK2o9uYg5pmlPAPZuvGe/ QvIoiGS6c0f76VD4sIfICX87GxCWtXI0ker04purjg8jMpREqFK9nphDNu+U9Jog4DBMUAxIYcu 9GKKd86qknNBAlWP46HQ5hp8DQUM= X-Received: by 2002:a05:600c:3488:b0:4a1:fa33:441a with SMTP id 5b1f17b1804b1-4a1fd8a0560mr111885705e9.2.1792671438775; Thu, 22 Oct 2026 05:17:18 -0700 (PDT) X-Received: by 2002:a05:600c:3488:b0:4a1:fa33:441a with SMTP id 5b1f17b1804b1-4a1fd8a0560mr111885215e9.2.1792671438218; Thu, 22 Oct 2026 05:17:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1792671438; cv=none; d=google.com; s=arc-20260327; b=n/W/asuGAkh1AwlvC5X+AimVtGl9fGJs+wfBdLUv1PCqx1OG4Ao8TI2hUU+ZKFpWYv iptw8nqMW2gauDbiS7bKzOJnFIrWqXxkMgnKw9CimjO0MwZR86U4gEF3H3dd5ifx3HEp LoSpy/iIqzyfcfaatDTS6Ct1dKCGicvQFqxbisImkHQDlysPMC6bKTYXhxorqBByzFf6 19PzAbJ8sHdBMb4wC77khI8qzmQqho4CD6w/i0RJwqxZRIhHry9nZAMq87Uk6oUxaX7J 07VA/O7TenMCWhRIzXb8K8wyV9y9N+04cbng6GHNGTip3+fsxWgCNrvBPOXIfp6wQyYO JB/Q== 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=FRqaTzNJWBqrf0SO66nK1wd1m+8kZLm8qSCChZw9rCcrxTCc6Y2GqoWRmvJyJiAe5J Z0wyvF32Goynzrzj1prVLPq5kBlljdVZTXbvCQ0FhxikwBHpz1LWJqQiDKjyNplT1Bgg 2l1jQw3mWMDWqNwA6KV6QkKL88NhWHTq0hwlkzyilJ9Zq6BPG2C/xQq2HgHQoAzFDCWF kfWaspI89lqC+x92BZW7ZlGDqg2ecg50tUgMpTQTSqy7Z4XpqLUD5lVlDJ2uG/M0EHVW qZD2uFqCuG/GkTj9nKWDj6tJeigXJwrrcV9pBWgK3qGtj23h/61/K6wlbYcXWVhPWIiO ZP+Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=RPm0RxP4; 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 5b1f17b1804b1-4a203b48d77si50387985e9.11.2026.10.22.05.17.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Oct 2026 05:17:18 -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=RPm0RxP4; 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=RPm0RxP4Cwaj clM/HkKusm9FBJ4RtUpI/sl5Bu8wi+EwSXraT335+aKenE0uiiljAsLqzL/DjpkBcb2iXuWXX4RU2 7NoYYkbV7v5+4li2p81WWlR0q+DhuKlDf56E7Hj3TQLOVNXt5GqzPbYT3TMf9XTe1RqJG/57+7emm ce1Y7SMBhy6Zi4yUj0VYN/66A8JLuGIrz+hQuCbkiCQoo6U5jDR8VxI835HbXJFZ4awfDIafXag6f UTeE9v7Zw8CRIXGmJ/fUNhYAxBC/qezAS23Qe/BtegIvc7santBxmHZU3ANWRqxEvSXY1X1a3AvaP k8gSCPVoW85iizu7srFRTA==; 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 1xJrfo-00Dc1n-0s; Thu, 22 Oct 2026 14:17:15 +0200 From: Alexander Ivanov To: andrey.zhadchenko@virtuozzo.com Date: Thu, 22 Oct 2026 14:17:03 +0200 Message-ID: <20261022121706.1890593-4-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261022121706.1890593-1-alexander.ivanov@virtuozzo.com> References: <20261022121706.1890593-1-alexander.ivanov@virtuozzo.com> MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.1 v6 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