From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.openvz.org (unknown [69.168.225.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id E24FC8045D for ; Wed, 21 Oct 2026 15:43:28 +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 69LFg8Um021510; Wed, 21 Oct 2026 18:42:09 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 69LFg8Um021510 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="OHI2wsCV" Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 69LFg7X3021496 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Wed, 21 Oct 2026 18:42:07 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 69LFg7X3021496 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-48e0461e040so687311f8f.0 for ; Wed, 21 Oct 2026 08:42:07 -0700 (PDT) X-Forwarded-Encrypted: i=2; AKwUvByR4m3WyovXkjHYqpQC1X9hrvU+3ajT0nSfnHVJhDj8N+PkLwgq59/5MOi1sc/M2VdnXbluzA==@openvz.org X-Gm-Message-State: AFq9FYKm37CBYqbhgNUVOR67RgD/GebiRDni/C8R5yHR2/8nkNfSJCc1 Fd88EyEvQD6AXyZkUNu3OHn813XPl5BAm7F3hQY3a7vCyExTsLGmsh5+TWUA9Czz3lkP+8nvwR3 kgreHXi8+RHOU3suxuIcfvGlIySjxDQCRlYsrxhSfGY3ZrTSkNJREwg== X-Gm-Gg: AYBFou2dTqiYb2vE0bfMATjNJD6hlDBIwg9+GCGjDWF8MpwikJ2mB1ji9Eks7JOaDyK NoE5H5mtOKAU63VWdXVkVvuJghb8bfyAdNnm7fzWUZrETTnhkYlbibH8L17gIank+mKKziaVHiM YVkrIoGfgjb+BvU1UF7kkzBIMNvktciGfJcuCuK0g4a1vYweWt0/DiOUC5PeI5Y0jBGbqPgbT/g 7TCn20Hv/+PPJFjIg4LNO1IzkTXDuOFj60dpwaevdTC+C/YXK2oPEiW6bGSt/zr8/2w97alUjWo y80USzHF6eI13Fhnn1vlJIiPTGJxLjvzAOxdv6R6vyqmQqywiM0BO9mrsJ+FqdjDrMzmEPyI8WO RwYQcARCmZlIFhaikgw== X-Received: by 2002:a05:6000:288e:b0:485:8cc8:1f5f with SMTP id ffacd0b85a97d-48e264a1f81mr5654039f8f.42.1792597327343; Wed, 21 Oct 2026 08:42:07 -0700 (PDT) X-Received: by 2002:a05:6000:288e:b0:485:8cc8:1f5f with SMTP id ffacd0b85a97d-48e264a1f81mr5653973f8f.42.1792597326726; Wed, 21 Oct 2026 08:42:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1792597326; cv=none; d=google.com; s=arc-20260327; b=cnVb2KDHRBigGRSHgWjp39tZkb8L1xAMDfFxGPhdYgMb87mrdk2jw7NA3xcEKnkWB2 kn+9xQEHa1JC2tcW8U0mHIufWSsK+BkuyNu3S64bGcP9oWsqs23/rIJwc4vx7ZMBgtUV ZktbhccgI7LvTyPeEp6LYq5T2Hzg16x/ZslvKWl5DkJNCuJ7pLlNEKC3o4vGWHwYdBXt t05K9dfjFFNCWOj24HjMM+4Xl4iH3cKLN7KDaZPO6WmJJhYe7/Yt+XJ6NSktKTElA6KK 1znLK1exbfwgPQbmjUmUiOcXP4mXnFO/YJGLUcAyBRoDvR7zhLopM35fFoYNsVQtA8r8 nVtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=message-id:date:references:in-reply-to:cc:to:from:subject :content-transfer-encoding:mime-version:dkim-signature; bh=zLXFgUDtjJffnJQ0s25AAmxJ93bjXZuOipoZlKCRrQE=; fh=dEALvyefJBnY6nyJGHYBKeYIaK3H1xJ1Smb/xz+zJI0=; b=HvCR4FMP6CI16ivU0PqIOvioHyq8FeNBPLfleh1sms4JzenU/rVge6Ll0ES5CMHcIj ieuvFSclGDetUBAK7cAhcj35QOg8TP3ZOWcJGThT6UsIp2Mc9r2rQqdx4Hlw3mcWjSpE 5Pqf+Nh4AFFAPVfyntFlVLeJVnt1QLuv/wKJEsO35RfPpx/yFyBnFFQgt5eVc4sEnivs Rtt5lHIM+PZYRVcNcSDwZqcIhCDOp+VmVeQh+5+J7oREM9y0VA+CIuleJGE74jN7o6na bTng/odD1xymS3UvkL3TMVHcOwPInyXO/sBZKPMGJGFfXNZvTlICo2+GjV5zuvNlM8gI TxoA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=OHI2wsCV; spf=pass (google.com: domain of khorenko@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=khorenko@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-48e25884fb6si5998417f8f.387.2026.10.21.08.42.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Oct 2026 08:42:06 -0700 (PDT) Received-SPF: pass (google.com: domain of khorenko@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=OHI2wsCV; spf=pass (google.com: domain of khorenko@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=khorenko@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=Message-Id:Date:From:Subject:Content-Type: MIME-Version; bh=zLXFgUDtjJffnJQ0s25AAmxJ93bjXZuOipoZlKCRrQE=; b=OHI2wsCVtm34 JluE8AcmcZNK5lZ/h2Q06DfgwUsO5YFfXXCx4Q0hj0pivw/f3WnyFJoKqDmoTQqnAVv2U4E+FM+De FDOK5g0LxBnidp7SYO9ZfhyI3KG3f9pHNmS4IwYOfZXoQT10sHrxZ13mwrcmmyrBHPW6Qqw8r3np8 pQY4mCu/P7zmNzjCwSpmBOUjpY6P7NLXdrGApnDxLU8LHFsC5ex8oKn+tRFpQZMmikytA1k+lmCnn maIA8h9CfWDWJ9Uc19aK6vLIMke5wFg41/zf7UuJ9twv0Zc0Tffte0kv19Nl0FMP/pFkQ7kri3gcU SKK/vws+x7iUDCrBHgfFVg==; Received: from ch-demo-asa.virtuozzo.com ([130.117.225.8] helo=f0.sw.ru) by relay.virtuozzo.com with esmtp (Exim 4.96) (envelope-from ) id 1xJYOU-007X7J-0t; Wed, 21 Oct 2026 17:42:05 +0200 MIME-Version: 1.0 From: Konstantin Khorenko To: Alexander Ivanov In-Reply-To: <20261010124642.927044-1-alexander.ivanov@virtuozzo.com> References: <20261010124642.927044-1-alexander.ivanov@virtuozzo.com> Date: Wed, 21 Oct 2026 17:42:02 +0200 Message-Id: <179259732233.3864599.5464617554762761963.b4-review@b4> X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2665; i=khorenko@virtuozzo.com; h=from:subject:message-id; bh=xAGwZq2obbKzcSbmbj5OcesuVUJhbgLSBAPElNviBIg=; b=owEBbQKS/ZANAwAKAVGWCkf5YVwqAcsmYgBq2N1MMKmICn7v++rwqQ890ELhnZ5lEdStOhRN6 r4gRvUqoM+JAjMEAAEKAB0WIQRWD23IPcXT0GO9CCxRlgpH+WFcKgUCatjdTAAKCRBRlgpH+WFc KpG4D/9vRpbya1w1Ie1clVZcUJekoy7pdTFor9QubLP8zoq41oJ1SLjNCtQaEGCalYs/3cBBtK5 nZ6ytfsG4dJEq4uyrhb1A6poC2rBINxv6fjKBom5SGpdPMOtILKlBupWqmMDvHEAQZ9tiuDScQJ Vizvg8fziOPE6hTjOB02+JOdH89hDV3sHlSEXuzQUz++oEnbFffnqizF8hP+Q1ODSjkfN4nc5EF xC1naTc0Hb/uVR5QBMz2oPu2VFRm5KdjdSfLWRUlCjA6/N1Ves50MrPqL8k9KiE9DmLviLP+UBc x32NV7WPYYYoIgn53pLRryKQpL7DtWB6MqDpiyVVb4Tf1oKbixcv7linxIdd7nvYXM1ru5k6abE iUUhIquZENTWZZbHJo9G9jOLsbEc+GepBfXHP+wPXCb4yyrLBe7WbOJ61qgXs/sOfbvUDztuHlx DijwdNpoWMZBK0y6uweLhioAeosHeTsKcZeWYQNyOaSvK9qeuY7uyYYhYXiWfe8Mdcwezq5jaTC qyWjwkkFsCjAokgR67tns5vQOzO+fAZ+f/qhmMgZmmlTKBnMGSBbtMogaZjkMVbMX2naIf7W3o5 6/a/nWrMg6Wf0afjdvwf4FsWSxP89S9PfJSfSuMHHz0+EUZaSVzZb+UPZtewqIqalcoKDvMy84V cNp99JySe2gLY1A== X-Developer-Key: i=khorenko@virtuozzo.com; a=openpgp; fpr=560F6DC83DC5D3D063BD082C51960A47F9615C2A X-OZ-Fwd: true Cc: devel@openvz.org Subject: Re: [Devel] [PATCH hci-8.1 v5 0/3] dm-qcow2: truncate unused tail of image on suspend 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 Whatever we decide about patch 3, the review turned up problems in dm-qcow2 itself. They need fixing either way. 1. A failed L1/L2 write frees a cluster that L2 on disk still uses. If the L2 page is written but vfs_fsync() in complete_metadata_writeback() fails, complete_wbd() reverts the update: revert_l_entries_update() drops the refcount of the new cluster to zero. The page may already be on disk with the new entry. The allocator then hands the cluster out again, and two L2 entries point to the same cluster. md_writeback_error is not set in this case (clear_writeback_status() flags R1/R2 pages only), so nothing asks for a check either. Fix: on a failed L1/L2 writeback, do not free the clusters. Leak them and set md_writeback_error, so preresume refuses to resume until "qemu-img check -r all" has run. A leak is safe, and the check repairs it. This is the "FIXME: We should reread md page on error" case. 2. Metadata writes give up on ENOSPC. Data writes that fail with ENOSPC are delayed and retried (qcow2_try_delay_enospc()). Metadata writeback is not: - R1/R2: md_writeback_error is set, and the device can't be resumed until it is reloaded; - L1/L2: the update is reverted (see 1), and the guest write fails. Fix: on ENOSPC, redirty the md page and retry it after ENOSPC_TIMEOUT_JI, the way data writes are retried. This is the "FIXME: call md_make_dirty() and try once again?" case. 3. place_r2() leaves a refblock above file_preallocated_area_start. place_r2() links a new refblock into R1, but moves neither the watermark nor file_size. Only allocate_cluster() raises the watermark, to the end of the cluster it returns after place_r2(). The refblock stays above it if the file extend in allocate_cluster() fails, or if a parallel mark_cluster_unused() lowers free_cluster_search_pos. Today the postsuspend truncation cuts such a refblock only when file_size is above the watermark. With patch 3 it is cut whenever the clusters below it were discarded. Fix: place_r2() extends the file and raises the watermark to r2_pos + clu_size before it links the refblock into R1, and fails before R1 is dirtied. If patch 3 is dropped, ploop needs one change too. test_release_should_give_back_the_discarded_tail from ploop PR 486 expects an empty stderr on umount. Without the kernel truncation, qemu-img check cuts the tail itself and prints "Repairing space leaked at the end of the image", so the test has to expect that instead. -- Konstantin Khorenko _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel