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 6F2768045D for ; Tue, 27 Oct 2026 16:48:31 +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 69RGlE2c030858; Tue, 27 Oct 2026 19:47:15 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 69RGlE2c030858 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=default; t=1793119639; bh=abEDbwSEvcYAnFPyddxzFH7foZC/l788oUsuU7vEkZs=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe; b=aoqapsIRN8T/rBfHjY5yFApYvWjw0mYg0nP4XZNU4eFWohJyx7ilZO8DRKW2uTiIj 4JmqPmmb/5f/wJBq3tyGe5TfzIGso6IXygS0xDu02JKXUGkKWsUjRVx9R9shgktAmd nOom83RzJR5gvYAyldDvh4iseL2UpxK2NoeSAGYeg2xc2mOJNOpHRcQDZAv4Fk42RS oquSzyX2jKXlYnCSQS+V7dOJtj9aClemkq0iZc2mlls9h4zVR/bMs239631V8/57x6 1KTQMcpNaqtfw8zwrpzJTKMLjkm8UMYkySEIn3oOOnoh6jmLIMHMzSegBYZBmG3iWu MCX+ARQAWB0tA== Received: from mail-lf1-f72.google.com (mail-lf1-f72.google.com [209.85.167.72]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 69RGlDOX030854 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Tue, 27 Oct 2026 19:47:13 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 69RGlDOX030854 Authentication-Results: mail.openvz.org; dkim=pass (2048-bit key) header.d=openvz.org header.i=@openvz.org header.b="KZCkDjTg" Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-5bcf2d3d83dso106983e87.1 for ; Tue, 27 Oct 2026 09:47:13 -0700 (PDT) X-Gm-Message-State: AFq9FYKz4ckf7gv0Feio7rboYwDwKcu935ooz2kqLWRX98ynCewbGGYT ECxWnmC8yZkdDQR501B7zDfRcWUaWJOSD+Aq+hmVCEDdKX55re7x/lZrujLvmAVZClNVdEJKv5v v/WsDhV5A9pZRJMtNfKWcRCnxUrVf/7tzHh6whgm6XjeSZlyuB2tPtg== X-Gm-Gg: AYBFou1FU3I5KcSIJtVZ8NiOVyN9cIjujvBVEz0o4pLXeuwPf7Gqc+tSQbR6fo4s9rW Ga8yJmyKEW+s8sMh3zbKvg8AvzhRTuN6l3X/+L5iTkGFRIqJI36spdST1POzrbVdAwcASq0gSHG TYe1A2fjcgklw5WHdxM3+JR4aNgOmO+1Q6rNQ3rI26ESap5yK8z8ena7VBmz03KxOLepEGPY6ae WkROFN6HZhj2kuacX4co3J1+1bc1qeGadXnd85GGNiaGls6pnlCvP2s2588jmU9jfMpsCtv619f 5kNnUdIVMw== X-Received: by 2002:a05:600c:4f56:b0:4a5:a5ca:de1d with SMTP id 5b1f17b1804b1-4a5a5cae166mr178717035e9.30.1793118784848; Tue, 27 Oct 2026 09:33:04 -0700 (PDT) X-Received: by 2002:a05:600c:4f56:b0:4a5:a5ca:de1d with SMTP id 5b1f17b1804b1-4a5a5cae166mr178716485e9.30.1793118784437; Tue, 27 Oct 2026 09:33:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1793118784; cv=none; d=google.com; s=arc-20260327; b=cz3m3vJIAiVNaI+AYCOA4ZzRCb0SuRsUaHCGKwNLCZfjON9NQvgr1lGvn+fBNSkdNf lXcRREc3VcsAfEmaRhcQgqbNKfxfivmFQ8TcMw6ceZpdhWlWrLytg+Mf9oQ5OJlvR3RD ijdxVo1e3qIHVGJ37kqxlU3wLIWmix55eVxRNDMzWLn/bXZ96x/rvoBUNBs44SNEYAwE FQ/ccuRadeiitB00FODZ7zKwbgK5DuvaX/sTLdmpvMo2ViWMKLnZtDLY+hN8TV6H4ugP 5LUCA7nv9lQ/YxH2X4nT7BQ4D/xZa6IUuXS5qm7nX24/khTfjiSDDUq0PylPo4Ga2T4N ymSw== 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=yZwQu4MiO65qrp5VvyS3VyPm0saS3PgHTy+3R4/nU8Y=; fh=Kr/R+ZQiC/tid3qUs5C3px+AHPSuipOrrdrDcZfSlMY=; b=eswgFA1Uf0Eo251fPHdx8CtzIGv/8ylfrw4z7fnZuwRLMoAfmo6JcIfJHcaLQb0r7I RdNNZfauSPCku46FyRnIZcti+4aWiC4MGAm112QxBQzHgc772CpIVSp3Eg85p6k4ef5I iCk1eXq+ltSV/jrRPOGCMQhSgk5MqXEBghK8zE2oAgJuLdg4H6wATBG6T7Fr6szGAy+9 k7V6C0TyANDhoQ43qnkJ3xriJJv+31KMURgsR+FUaHRQ5DRpWVjaMuIwMQLPTm8GQ00n pleJ0wuqhX+LqDhyYsdNRSnODp6dKEve0qYGpIcRelE0qgVYXXpvnDP0ddHYLV2WbgUp e5wA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz.org header.s=google header.b=KZCkDjTg; spf=softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:a5e9:5d2:969c:16de 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 5b1f17b1804b1-4a35a30c33bsor18090275e9.6.2026.10.27.09.33.04 for (Google Transport Security); Tue, 27 Oct 2026 09:33:04 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:a5e9:5d2:969c:16de as permitted sender) client-ip=2a06:5b06:b600:300:a5e9:5d2:969c:16de; Authentication-Results: mx.google.com; dkim=pass header.i=@openvz.org header.s=google header.b=KZCkDjTg; spf=softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:a5e9:5d2:969c:16de 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=1793118784; x=1793723584; darn=openvz.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=yZwQu4MiO65qrp5VvyS3VyPm0saS3PgHTy+3R4/nU8Y=; b=KZCkDjTgFyFIc5rIx+qA2/uj0doxgJgvkjL8g0eg6pusFi/LIt62Z0u3sxQ/y7Zf9w cNuu94spfSnpC0quSuezUOhHuhsIh+TX1xlrJAY0UELw1I2wGkn6fkdLRFE6Vv84RjxP Pk3bc+SzaKh2eMHzGIPTigzl/ODGTuyGYdnYD0/QtKrcpKYGBuZGJzsDQSJe6vTQgfVi vXraKHaX9a9P0QM4DpTPAP5L3Y5LtEB5gZHW738MuE+Iro6JbCzqppXCuadV1muq4YKS B7ELGj5TPwkhsx1wVQ1ikIMr/9nXu153rT/Wz0yuMCIlkZ6y2NpWiaNhbzbtCdmMpBGh u+7w== X-Received: by 2002:a05:600d:82c3:b0:4a5:1cf1:b7bd with SMTP id 5b1f17b1804b1-4a51cf1b880mr185717685e9.16.1793118783946; Tue, 27 Oct 2026 09:33:03 -0700 (PDT) Received: from athena.sw.ru ([2a06:5b06:b600:300:a5e9:5d2:969c:16de]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a9301b689asm870315e9.7.2026.10.27.09.33.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2026 09:33:03 -0700 (PDT) From: "Denis V. Lunev" To: andrey.zhadchenko@virtuozzo.com Date: Tue, 27 Oct 2026 17:32:57 +0100 Message-ID: <20261027163300.2166639-2-den@openvz.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261027163300.2166639-1-den@openvz.org> References: <20261027163300.2166639-1-den@openvz.org> MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.1 1/3] dm-ploop: fix freeing the wrong clusters when a BAT writeback fails 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 From: Denis V. Lunev When an index writeback fails, ploop_advance_local_after_bat_wb() gives the clusters it allocated back to holes_bitmap. It passes i + off, the virtual cluster number, to ploop_hole_set_bit(). Since "dm-ploop: make new allocations immediately visible in BAT" it does so for every mapped entry of the page, including the ones copied from the local BAT that this writeback did not change. This marks as free image clusters that are still in use: data clusters of other virtual clusters, and also the clusters holding the header and the BAT, since small virtual cluster numbers fall there. Later allocations hand them out again, so a guest write can land on live data or on the BAT, while the clusters really allocated for the failed writeback stay leaked. Free the image cluster the entry points to, and only for entries this writeback changed: those differing from the local BAT, and those the local BAT maps from a lower delta, which a COW replaced. Fixes: 6ddad5a4d226 ("dm-ploop: Add ploop target driver") https://virtuozzo.atlassian.net/browse/VSTOR-151979 Signed-off-by: Denis V. Lunev Feature: dm-ploop: ploop target driver --- drivers/md/dm-ploop-map.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c index 48466435dd19..34bf6487107f 100644 --- a/drivers/md/dm-ploop-map.c +++ b/drivers/md/dm-ploop-map.c @@ -868,8 +868,9 @@ static void ploop_advance_local_after_bat_wb(struct ploop *ploop, if (success) { WRITE_ONCE(bat_entries[i], READ_ONCE(dst_clu[i])); WRITE_ONCE(md->bat_levels[i], ploop_top_level(ploop)); - } else { - ploop_hole_set_bit(i + off, ploop); + } else if (dst_clu[i] != bat_entries[i] || + md->bat_levels[i] < ploop_top_level(ploop)) { + ploop_hole_set_bit(dst_clu[i], ploop); } } #ifdef PLOOP_DELAYWB -- 2.53.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel