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 0E4AB8002A for ; Wed, 25 Nov 2026 11:31:17 +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 6APBU3lR013674; Wed, 25 Nov 2026 14:30:04 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6APBU3lR013674 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="ohwTqZ1a" Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6APBTwMc013638 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Wed, 25 Nov 2026 14:29:58 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6APBTwMc013638 Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-c505ee61160so558494066b.0 for ; Wed, 25 Nov 2026 03:29:58 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErF7KhfIDyVre6XrSiPc1JcVc70wpvcoe6e2EwOd3sIi/gKb1i95GkGmXVlUyHe4+I35SfoFEA==@openvz.org X-Gm-Message-State: APuU4Z99x+Dh3hySeDJbd2fYPRi9v3FPejDASonS3kp2wVerKSiymE8A HdpL9/SQyeBe1GQm0F9xHl2zD1bYRkhtmIkgOTCwJrk5nYkwcehYkQnLdJBENp1B75FACFlA1ud C2D6C2chwfqUqM37YCi7HuYCF7nQSrIKVmgh99oKCT85+7mvHNGNTkQ== X-Gm-Gg: AZFdTZcs6zO89csNQMENUbb/GhAmBq3a13h1bQrQevfRN5eE5Y1GE2X1Z/URxcDEeqp SBDrEAgI4pEDMxBiF1I901u3ndiafLL4N2UtmJq8K0kvejWs23TNrcXon4bw8X8pJw8BYDhH3HP Re9+LqPav1mtSqDdklHtLjX00kkcSdekauRRzvB/XPLZ21WxU9gp310Fjs/berYtsXctXpHvUaF fRmmsPhNOt3IDJJNvPwZvB0k56Ri7QD9isg1Rm+yFNg+VzF0XnWpn1dzYLADDr3cQgF9GCGnY8e EGIRQqxM3jmSVxdnAhy57ji3huy/Gx7VJ6S/DnuPzughmi3UE9MFXEzIkSf/mK4D6oyrlMdcTs1 heGeOWP2Lif/0Tei+llY8cXqmSGI24v0= X-Received: by 2002:a17:907:ea94:b0:c29:f5d8:9c73 with SMTP id a640c23a62f3a-c513a9aa815mr1509137466b.34.1795606198463; Wed, 25 Nov 2026 03:29:58 -0800 (PST) X-Received: by 2002:a17:907:ea94:b0:c29:f5d8:9c73 with SMTP id a640c23a62f3a-c513a9aa815mr1509134466b.34.1795606197990; Wed, 25 Nov 2026 03:29:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1795606197; cv=none; d=google.com; s=arc-20260327; b=eieXL3Ejlg+XfNHyKTMy0raxPINENLa5L3CI86O1lCUrvweoWCnfsFUFJszxcqhiqw pmJEqcyugE4QIhA/QxZNogs2UfNMS1HnP7vtkQdOIhJ1Qcn7LbhvkEB92Mvuia9MaVkp nzyEyw+ic6UvyhY8f+/c59iaChQtco1Fenje57E2CxJ6QNlhNe2yXbS4gfkMmmkJON6T VWpBHRp3IIuDvtmQUAS9AEIf5BpnpoQb0Y4K6EMq/Lw3WRkM7n5fIuJw7CmPM55p5yI6 ZzAVCQFMCspVS9tNGCBzopcBY0TdXa/2Vs5XyxUzX5yhIhTTX6PlNvV1vl3o1ZQFD5qj xJMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:dkim-signature; bh=Brr3T6H2F66FF0UOdgwdFvtD8dBHsQ3F7p7hQF8Y40c=; fh=CU2Syl5kzvz16e8OWZ5AMYH4FAJgNgT+GQn9DymK8lI=; b=pdRNoVdBBdEyectpPGaleRpnmp0zIzEkm3Jqn0tUjb0CmQj6i5w79qaLlbrGS35Ujf 7iJXqbvToZIaZ7sCiba+rZB1dImyburKRgTFKIRhK9g9ebchVFNmclPiI//XRHbW36KS IXsTVSC1RfZXtCw4jbAp0i7vD71OusfPG9/bfi8z8ZjJlfjvS3vjhsv8ee0y0u79ADDb wiFdmgZ0KcWwBDFFwhja7OWuRP0UjVjRUqUMwC314u+1L/2K2sSZ8jIF78Myz5wCll5F tmy9Eq4QMxOpgs6v5MGBR4fHwg0CfwEJNdontHYJgXVtVWZp44E979ADYL4pyGoXQZgy Eb8w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=ohwTqZ1a; spf=pass (google.com: domain of vasileios.almpanis@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=vasileios.almpanis@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 a640c23a62f3a-c513b0da7f6si1084823266b.371.2026.11.25.03.29.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Nov 2026 03:29:57 -0800 (PST) Received-SPF: pass (google.com: domain of vasileios.almpanis@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=ohwTqZ1a; spf=pass (google.com: domain of vasileios.almpanis@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=vasileios.almpanis@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:Content-Type:MIME-Version:Subject:Date :From; bh=Brr3T6H2F66FF0UOdgwdFvtD8dBHsQ3F7p7hQF8Y40c=; b=ohwTqZ1a9o7l+6Buneq u7RWlymK1i1kJ88+K0+PRXcD8+hJYgAwhgAP1U69b7f5tZh9/poD0/VsTD4AlSVz6P9nkD5lQ7GD/ B7LVwATlMaj+i9ic7sQuNfxcurm6hj/7PS0RXvGW7FeQq44PLgvZEUaAT7Dzx51zyPoPF2v3csykt 0SH1TdNv0N2wkBdShuBn9j5Z+3NzfCn4IdY/YcDuC5vR3c69OBg6gr0y8YplyGhKNmsWKOLY5PKjC x+1YtOyEiZb/734zgB75P1/g8i39dkcVhQQvz7aUPeSTkqBiDFanHObhNzs6tJRNYZJq6MwXkuzM7 dYzN8zYxJEniy+Q==; Received: from [130.117.225.5] (helo=dev010.ch-qa.vzint.dev) by relay.virtuozzo.com with esmtp (Exim 4.96) (envelope-from ) id 1xWBC6-008Mwz-14; Wed, 25 Nov 2026 12:29:56 +0100 From: Vasileios Almpanis Date: Wed, 25 Nov 2026 11:29:52 +0000 MIME-Version: 1.0 Message-Id: <20261125-push-backup-fixes-v1-2-8d5cc55c30a1@virtuozzo.com> References: <20261125-push-backup-fixes-v1-0-8d5cc55c30a1@virtuozzo.com> In-Reply-To: <20261125-push-backup-fixes-v1-0-8d5cc55c30a1@virtuozzo.com> To: Konstantin Khorenko X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1795606197; l=2157; i=vasileios.almpanis@virtuozzo.com; s=20260812; h=from:subject:message-id; bh=Qqr8a0bweMR2N1aNe1h7JKNDn3tKWqq+ikAACw2bktA=; b=JiZxQz1oQS3Oyvx7QxD06/uXOUQWvPqtYicid9sbSbzBQa0dS8D6txlttXqwRlZr9sH9+Lmij NCKYmoTt6HnCs9XlVH6BgXfqobGP2z+od5vbNKgBPX31y3ragUPSz8r X-Developer-Key: i=vasileios.almpanis@virtuozzo.com; a=ed25519; pk=HhuHDXAcPva9A8zccWEMRsb36reu+y4IVbBjXKxNUjw= X-OZ-Fwd: true Cc: Den Lunev , devel@openvz.org Subject: [Devel] [PATCH hci-8.2 2/3] dm/push_backup: free the bitmaps of an expired session on restart 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 When a backup session expires, cleanup_backup() clears pb->alive but keeps pb->map and pb->pending_map, so that the target status can still report the session as expired. push_backup_start() refuses to start only while pb->alive is set, so a start after an expiry goes on to setup_pb(), which overwrites both pointers with new bitmaps. The old bitmaps are lost until the target is destroyed, because only push_backup_stop() and pb_destroy() free them, and they see only the current pointers. Each bitmap takes one bit per cluster. For example, on a 32 GiB device with a cluster size of 1 sector each bitmap is 8 MiB, so every restart loses 16 MiB. With fail_on_process_exit the session expires as soon as the sender exits, so this is easy to hit in a loop: for i in $(seq 1000); do dmsetup message 0 push_backup_start 60 0 fail_on_process_exit done Swap the new bitmaps in under pb->lock and free the old ones in setup_pb(). Nothing dereferences the bitmaps of an expired session without holding pb->lock, so they can be freed once the lock is dropped. If setting up the new session fails, the expired session keeps its bitmaps and its expired state. https://virtuozzo.atlassian.net/browse/VSTOR-155790 Feature: dm-backup: push backup target driver Fixes: 162123bc62c7 ("dm: Add push backup driver") Signed-off-by: Vasileios Almpanis --- drivers/md/dm-push-backup.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/md/dm-push-backup.c b/drivers/md/dm-push-backup.c index 504713a9430e..433c61b63802 100644 --- a/drivers/md/dm-push-backup.c +++ b/drivers/md/dm-push-backup.c @@ -434,11 +434,13 @@ static int setup_pb(struct push_backup *pb, void __user *mask, int timeout) map_bits = bitmap_weight(map, clus); spin_lock_irq(&pb->lock); - pb->map = map; + swap(pb->map, map); pb->map_bits = map_bits; - pb->pending_map = pending_map; + swap(pb->pending_map, pending_map); pb->alive = true; spin_unlock_irq(&pb->lock); + kvfree(map); + kvfree(pending_map); return 0; err: kvfree(map); -- 2.43.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel