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 D27D480474 for ; Wed, 28 Oct 2026 14:48:46 +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 69SElOQa020792; Wed, 28 Oct 2026 17:47:26 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 69SElOQa020792 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=default; t=1793198848; bh=z4gpQmRBPAg8NaCWhnXhjd2n1LwbiE1Axexylj8XCAs=; h=From:To:Date:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe; b=PgHKctKAOJLPR3LBOobHFv40KuQmqwxxg9cDYBrCDu9wrmHAe+tDXYbKLqn+CNLK6 J99I6e0qStdOHvzfWcSmpZNYxJ1cy4icYfom8Upg0IctfEiHkNBX+usCUX4Ggjq+PM t3wGhrJDUUafphfMKvC5hAGalSDOCbdrO2SlpSqmmTru8Nz0KW0pXiJd00vQBQUW1T fWicBT0dB7oTKoOElMD5NrbR/Dst4TC4Fx6/A5K6KoKryw9x48uQm5bbuVxEC8jlMQ s8llHeJNFpkPoxXulBUDu2JYDNyNQoqCab6X+T6ERsMjxDKpAexWCwOGfdJHcNdXi5 F3yOy1ZKoSx2Q== Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 69SElNVi020788 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Wed, 28 Oct 2026 17:47:24 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 69SElNVi020788 Authentication-Results: mail.openvz.org; dkim=pass (2048-bit key) header.d=openvz.org header.i=@openvz.org header.b="R07TD7Da" Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-48e0461e040so834630f8f.0 for ; Wed, 28 Oct 2026 07:47:24 -0700 (PDT) X-Forwarded-Encrypted: i=2; AKwUvBx9rF4eLsi8PvUqBG7wUZJqUbe+ymIenggXWc1QFWPoXIs1iq/uCqNIKvNTtpTvtWsE/vJPlQ==@openvz.org X-Gm-Message-State: AFq9FYJPpdB00O5o24OJx7KMrYbB7rdAi9szlDI8ZS5H1N9kGuOMRdhu 5zNv5sF4/JKsSf7a/UAUJDK42l4yoyxmwChYn4ZC8ELe4FbQU9hqD4KY+YskW5hRHhdbMcnojc/ WDXjCuLY6+AkiNEzRVEwzyxhfR5tFpDfzc6klSBdRSOI80SExGPZZug== X-Gm-Gg: AYBFou24qzSTDb642UEqbVRS/PhEi/6/u1qDmp/UD+TFZVUrM/hnU4ZTL+0t/lZcY2x ljil0Oe13s9UVaA/agbR2Yk/pN33BHfutwgTn4UxOOQb9RvK0geNkm/TFobhebZ1zSTS5WyMnmJ QjDd9tCPhQq1HsIMmPElRsp/yucix0aW61XLlI4to6voRrMTHCLyyGACFgAH1LcZKU0Z9JOn3wB BdCmkZj8I4mHWd8kjRVyFPjR1TAkFyRT0RDpt4Rb5YRNYbxBW2N2H/Qy5gbS6/qKDl4yE9aOV6l +0BfGXNCHw== X-Received: by 2002:a05:6000:29cf:b0:487:1ac0:32af with SMTP id ffacd0b85a97d-48e5d564f50mr3981342f8f.51.1793198211647; Wed, 28 Oct 2026 07:36:51 -0700 (PDT) X-Received: by 2002:a05:6000:29cf:b0:487:1ac0:32af with SMTP id ffacd0b85a97d-48e5d564f50mr3981300f8f.51.1793198210979; Wed, 28 Oct 2026 07:36:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1793198210; cv=none; d=google.com; s=arc-20260327; b=c6NayUvtFFQ15IF9LBfJPPNsJwHdsHZnx3kuazsccMSAnZuWgNt9KiQRhv0rwxEIaE sS/6f4jw6wquqK6YSPEvmUqUTbtth1k5dqDaxFj54ldwYYNRPKpJpSFkL+Qg3OxWAKHX kMgla6l/sRHL/QYuoTrK6jow463q7NOBvZtoGQakAO3PEcDJTYzHuj2w+8hbp3DPjTHN 5dm1hM2gjNKI+XDAf37Z40WSI78mQ433XFOfDAtELye4H0orYwFkX7cCHBx3N6YX5K1x U80vEC/W/67RqKwhboRYr2FUr8WnZghUZXJleWppRXChzpn6HAXhoTVlfq+/5bj3ypAC RhTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=wIMkF1tu1QkRYk6Cv7KpuETEp5tZ/rVjCtxiNT1ZiIc=; fh=+my15zzIDIH9t1m6E/wgf2WD/VEvbQVXtjurfWBZafg=; b=ZYxEO7XhhrsNoLYv1hHjVKs8gTBkatyqMu1J1Q0AZXnguykKAACPU3xtpRErhs0hri JxFy//NTWnnjVobenqJjfv/QjG6qYVzrIl9zoU1WrnX+Hw0Z3iiJbBd/qSrvGiJ0lisT AMOnCnhJSxtdVm4ftUVBVmSnIsr1/o25tcfvatlQc6jTiwsNlG5CyaptBNaLA3gD1RRk a1KcnX8ZgrOK1Dq8jaV5qQzObi9EaB5pz5WV3btwheal0aMRrIBRVHaTNfTC74lxB6K2 CSFMmSXcNhMJLF1+A1AkBh0GEtTcXKSNWzvNTp+1VWfX4nsN0ZpTTKKMFkXn+SMsPIH2 dnxw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz.org header.s=google header.b=R07TD7Da; spf=softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:2c3:d099:6fb:56cf as permitted sender) smtp.mailfrom=den@openvz.org; dara=neutral header.i=@openvz.org Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id ffacd0b85a97d-48e3ebcc81dsor2476845f8f.7.2026.10.28.07.36.50 for (Google Transport Security); Wed, 28 Oct 2026 07:36:50 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:2c3:d099:6fb:56cf as permitted sender) client-ip=2a06:5b06:b600:300:2c3:d099:6fb:56cf; Authentication-Results: mx.google.com; dkim=pass header.i=@openvz.org header.s=google header.b=R07TD7Da; spf=softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:2c3:d099:6fb:56cf as permitted sender) smtp.mailfrom=den@openvz.org; dara=neutral header.i=@openvz.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=google; t=1793198210; x=1793803010; darn=openvz.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=wIMkF1tu1QkRYk6Cv7KpuETEp5tZ/rVjCtxiNT1ZiIc=; b=R07TD7DahjQJv+K7bg8J8MWdoNxcjuLxkjKsnQ6RdFsDIbU1nWpW14Rpm87imQ1C1+ XXqaKXu0GIGgekiPVeEerDjt/UTD151W1FKZsLXDZPWX8IFfQGMDKipLuQElGVgDghmN PQqDgKr32YUoX9zavqVj8aJrE7Egk8T0bF5WCnivZjgXiXY9jVhFWHDRtHryqrqBuKAP NCbTr/faDwsvUJCNNYHX68ctUlbIrcFWTU7lA3jK3RLwweAh8JWdcSLjBp2ztjoip+sW R0orxmu4dOorYZvsBQlanHQA2CbdzPdQbfF4LDoW9Wka45cjNcYHjIhwFq6Rcl3E5TEX 47TQ== X-Forwarded-Encrypted: i=1; AKwUvBxvRHOKDqtYIspL8f4kUEdJpAYtwZn3Me/k+k6pQt3T6bonSfCCGONZyIc4U1AV3saFclpgYg==@openvz.org X-Received: by 2002:a05:6000:4555:b0:48e:84b:e83e with SMTP id ffacd0b85a97d-48e5d319d12mr4565967f8f.1.1793198210443; Wed, 28 Oct 2026 07:36:50 -0700 (PDT) Received: from athena.sw.ru ([2a06:5b06:b600:300:2c3:d099:6fb:56cf]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48e3ebd4d8dsm30321335f8f.36.2026.10.28.07.36.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2026 07:36:49 -0700 (PDT) From: "Denis V. Lunev" To: andrey.zhadchenko@virtuozzo.com Date: Wed, 28 Oct 2026 15:36:43 +0100 Message-ID: <20261028143647.2972030-1-den@openvz.org> X-Mailer: git-send-email 2.53.0 MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.1 v2 0/4] dm-ploop: fix acknowledged writes lost when discard and allocation share a BAT writeback 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 The hci-ploop fstrim test caught dm-ploop losing an acknowledged write (VSTOR-151979). Since "dm-ploop: fix and rework md updates", an allocation and a discard on the same BAT page can share one pending index writeback, and its completion applies the written page by the writeback's type only. A first write that rides in a DISCARD writeback is on disk but never reaches the local BAT: it reads back as zeroes, the next write allocates the cluster again and the data is gone. A discard that rides in an ALLOC writeback leaves the local BAT mapped while disk has zero, so writes after it are lost on the next open. fstrim or guest TRIM racing ordinary writes is enough. Patch 4 is the fix: the completion applies the changes of the pios attached to the writeback, and of the relocation done on grow, instead of filtering the page by type. Patches 1 and 2 fix older bugs on the same path that the old completion partly hid: a failed BAT writeback freed the wrong clusters, and the online merge of the latest snapshot left BAT levels above the top one. Patch 3 drops the dead PLOOP_DELAYWB code. Tested on dev-cl04, 6.12.0-211.52.1.22.9.vz10 with the module built out of tree: - a reproducer racing cluster discards with first writes on one BAT page, 512 clusters a round: without the series 3 of 15360 first writes read back as zeroes right after the write returned and stayed lost after remount; with a 200 us sleep before bat_lock in the allocation path 1801 of 2560; the reverse order, a sleep in the discard path, left data written after a discard unmapped on disk. With the series nothing is lost in either order; - the ploop pytest suite, ploop and qcow2 formats, passes; - nothing exercises a failing BAT writeback, that path is checked by reading only. Changes in v2, after Andrey's review: - 2/4: also clear the deltas[] slot the top delta moved out of, as notify_delta_merged() does. The md_lock in the renumbering stays: it is per page, and notify_delta_merged() takes it the same way; - 3/4: new, drops every PLOOP_DELAYWB block instead of only the one in the completion; - 4/4: the PLOOP_DELAYWB removal moved to 3/4, otherwise unchanged; - Reviewed-by added to 1/4, 2/4 and 4/4. The ploop pytest suite and the reproducer were rerun on v2. v1: http://lore.virtuozzo.com/kernel/20261027163300.2166639-1-den@openvz.org/ Denis V. Lunev (4): dm-ploop: fix freeing the wrong clusters when a BAT writeback fails dm-ploop: renumber BAT levels when the latest snapshot is merged dm-ploop: drop the dead PLOOP_DELAYWB code dm-ploop: fix lost BAT updates when alloc and discard share a writeback drivers/md/dm-ploop-cmd.c | 25 +++++- drivers/md/dm-ploop-map.c | 161 +++++++++++++++++--------------------- drivers/md/dm-ploop.h | 1 + 3 files changed, 95 insertions(+), 92 deletions(-) base-commit: b499efa17aa9fb8f20512d1831d1cb61b22e60d3 -- 2.53.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel