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 242E281B37 for ; Wed, 18 Nov 2026 13:59:01 +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 6AIDvkhj025982; Wed, 18 Nov 2026 16:57:47 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AIDvkhj025982 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="UFI3qZpE" 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 6AIDvYd5025949 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Wed, 18 Nov 2026 16:57:34 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AIDvYd5025949 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-48e0461e040so843643f8f.0 for ; Wed, 18 Nov 2026 05:57:34 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErE+vnfjRIhKLs35f2DV2RX3X/gO38qtok5RN0d1TwNDb4ZCSx2HWoOu9TODEKMu21//h2kJJQ==@openvz.org X-Gm-Message-State: APuU4Z/NYXs626opzm/H759GKNnp94/00xFGpk70n9Pl1LR9cUfWRMcU 17b6Ao2sDwVdVSzfHwXcvs4WnsN0TAIgnixdkmTWuTG70WgEfMBVwF/pkbj3mzdR4YfTqWboftk Vszu5lt4CPSlW3l47ErfB2QdQoS0SjlFXyR0M6EKPSauDIAQJM11K5A== X-Gm-Gg: AZFdTZfnxxnSh49PmeFI/ssY8+D2hmvYdGb9NdCOKxh8nHsd3cfFSWDqdaVYjXtSBUS qJQrPWfV6roCdBNpEdyN1sTA7z3hiywzlrMCucIalYkHf0RjfQ77A4FNlNK44NnK7U0fW8BKv5b i20rPpOG0R0JBHEFtLsG/IyxXmrdFIFR4Vqj2BPRvvUFFksUbfCtIJtDCejzRFX8TxXM0yiOF/R D1UcIYaK4vofatzo67XVAIw4bftG/YkxeRnOPHz+paQYm+hf7B88/elFdB8UTBpAhm80h6O7rV4 c9U5zc8Nj4uIUNSwnkFUzfODDdfy0qhzFtUyPbzpfcZBFLOE/zW/eSduNKpMIvMTP4QJFvGPoHW c6l174zJDnEpQYQMaPNhUYw3195goKg== X-Received: by 2002:a05:6000:2dc5:b0:4a7:35af:c83c with SMTP id ffacd0b85a97d-4a735bf0dd9mr3528293f8f.43.1795010254090; Wed, 18 Nov 2026 05:57:34 -0800 (PST) X-Received: by 2002:a05:6000:2dc5:b0:4a7:35af:c83c with SMTP id ffacd0b85a97d-4a735bf0dd9mr3528240f8f.43.1795010253576; Wed, 18 Nov 2026 05:57:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1795010253; cv=none; d=google.com; s=arc-20260327; b=T9u3PgHk93P5TjDl2WNA+BKZ1eOhnSM6wDlRSSWMwhXIkj0kTU5Srst8j7U6rzWTys mBhnHZIQTYFsTO6JYNWSmYEir8TyJFJOfvlfTyjVyWtWdZ+/nDmkqR0Xxu1jO7HLhwZf libh9Gn982buAKv4LlOdZDApRPBqiGbkixsbhBT9exLUzo6LEW+92K/euF8xu0iFKtcA O78alAIcESeTSu7KJPt8yETYc/TIk6tceK9rJsBPnl+6XXFR5UZCz/7Fx1CacDOCtWvZ T1qV6eT1oRMleYcv/Jk0zzS+IOvfoQ3Zns29Vn6cOch/hvRPWvnlZEd2DxiEJUBKMHMN lcig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:dkim-signature; bh=3MpuZZq8fVFAmZhlSefWwONQXR0TeDGHTYGEE4l68sQ=; fh=ZnVB5BqLQwOrjngKsM/BdGGkHQvWunVG82yeReB8YoQ=; b=lY9Z3BXdmbNtJMk8Z0vYBZKXKaQ82X0g1M2fPK+6Dy0KNmmb/5gg8KmQCwy29aYGNA cl/hjbfNCwBU7utg2jyE35tK7oVpdO2fLrmaZnff71vVVRVzs+JG3m9nRvlfgItU5gT+ R8WIQRVczA6YBn1u6bnJlKzrZhGRKao6GDRjk4YPhvNWH8FLdw+GeC2FJhmE/us69dtG QJpye+ic4Ar6IGw9y7EbujderN85lMyeuaJ4hUVunCOosW2bBfWruI1bhn+Oy8Yj9jmR L7QibMBtKtWP7MLYKaPVVLZ0QEkgig2ZnaIvZyw2hVYQKfeLa94zLU90notD0Yebs93s V3Fw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=UFI3qZpE; 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 ffacd0b85a97d-4a65a0c524bsi5321368f8f.350.2026.11.18.05.57.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Nov 2026 05:57:33 -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=UFI3qZpE; 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=Content-Type:MIME-Version:Message-Id:Date:Subject :From; bh=3MpuZZq8fVFAmZhlSefWwONQXR0TeDGHTYGEE4l68sQ=; b=UFI3qZpE38LzIqF08Yg 3Oo324Jh9EF2PYLmzclJeoAWuc5Y9pQw49cY4Dr3MuJEjaTuQ1jCpV93qbukvzeGUFqS+8DqDoSU1 6nj610tlw8sJmfWojsFDMZ3fY+/U+AQf0vIhPpP+1qqoQUlSN10QXXSRp3TqWHoDL/vhW63//B2x4 60IrXVgFcNuyyUFnB32p3BfceugNlPYD5QN5ik/DN+blL3MhmM1VVlhCO6ntflwyRQokTmdPBbjdD JLhEPpIESScgiwyXQDGoPFYm4yxKOXPyoih24ccTskXrmdfw1iDw8xpXZ+bFOe5cZUHsYLfwWJU2f 0L4kLEnA5bKo0Kg==; Received: from [130.117.225.5] (helo=dev010.ch-qa.vzint.dev) by relay.virtuozzo.com with esmtp (Exim 4.96) (envelope-from ) id 1xTg5y-005hYm-2z; Wed, 18 Nov 2026 14:57:32 +0100 From: Vasileios Almpanis Date: Wed, 18 Nov 2026 13:57:26 +0000 Message-Id: <20261118-vstor-153891-v2-0-e91753150b91@virtuozzo.com> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAMau/WoC/22NwQ6CMBBEf4Xs2SVuCbV48j8Mh1IWWROtaaFRC P8u4NXjZOa9mSFyEI5wzmYInCSKf65BHTJwvX3eGKVdM6ij0kRkMMXBB6SyMBWharRtbaVPylh YkVfgTt677gq9EzS5gvpXxLG5sxs22TbtZRN99uNEO/D/IxESdgW1lq3WRVlekoRh9NPkc+cfU C/L8gXKNywyxwAAAA== X-Change-ID: 20261118-vstor-153891-2b6ada96728a To: Konstantin Khorenko X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1795010252; l=4147; i=vasileios.almpanis@virtuozzo.com; s=20260812; h=from:subject:message-id; bh=XBF+1F01lAwKrqO+lcuMwLteGufqV5+9VpIHRBsimO0=; b=uNaw/5FJGF5S0aMgkHqmaZoC/QfD3aBCEhvK2FTimBdTUftG1Hdo4OrjyD1pOCUnYCL4TjsSN P9hXPOV9x0pCCByg2avHJZhmrh/7htkt7udZZm8912iw8XtYi1X2FdQ 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 v2 0/3] dm/push_backup: stop the backup when the process that started it exits 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 ploop-backup dies, the writes to the device and every sync() on the host stay blocked until the push_backup deadline timer fires. The last patch adds the fail_on_process_exit argument to push_backup_start, so that the session expires as soon as the process that started it exits. As discussed with Andrey, we hook to pid->wait_pidfd instead of counting the open event fds as proposed in the ticket, because the fd is bound to the target and not to a backup session. ploop-backup needs a separate change to pass the new argument when the target version is 1.2.0 or later. The first patch is the fix for VSTOR-155761. Without it a malformed push_backup_start returns success without starting anything, and the last patch would add one more way to get there, a misspelled fail_on_process_exit. The second patch makes push_backup_statistics report expires_in as 0 for every expired session. Before it the value was computed from the deadline, which is negative after a timer expiry and positive or huge after a process exit. I tested it on a VHI 8.1 node, both with the module built for the stock 6.12.0-211.75.1.24.1.vz10 kernel and with a debug kernel with KASAN and lockdep. A small helper starts the backup, takes the event fd and forks a child that keeps a copy of it. After a SIGKILL of the helper the postponed write completed in less than 0.1 s instead of waiting for the timeout, the child got ESTALE on the fd and expires_in was 0. Without the argument the write still waited for the whole timeout. I also checked that the exit of the main thread alone does not expire the session, and that a clean stop followed by a new session, a restart of an expired session and dmsetup remove while the process is watched all work. Malformed start, read, write and get_fd messages now fail with EINVAL. 200 rounds of start, kill and stop left dmesg clean. A session whose backup has finished also expires if the process exits before push_backup_stop, and the fd then returns ESTALE instead of 0. This is intended: the backup tool died before it stopped the session, so we treat it as a failed backup. The target keeps its reference on the struct pid of the dead process until push_backup_stop, the next push_backup_start or the target destroy. This is the same as the rest of the expired session state, such as the backup bitmap, and an open pidfd also keeps the struct pid of a dead process. Dropping it earlier would need more synchronization between the wake callback, the worker and the control path, and it would only free one struct pid. The other older bugs that sashiko found in the driver have separate tickets: VSTOR-155790 restarting an expired session leaks the backup bitmaps VSTOR-155791 a cluster size of 0 divides by zero in the constructor https://virtuozzo.atlassian.net/browse/VSTOR-153891 Signed-off-by: Vasileios Almpanis --- Changes in v2: - Add the fix for VSTOR-155761 as the first patch, so that an unknown fourth argument of push_backup_start returns -EINVAL. - Report expires_in as 0 for every expired session, also when writes were postponed and the deadline is still in the future. This is now a separate patch. - Commit message: say that the message has to come from the backup process, fix the reason for watching the process and not the fd, say that 60 seconds is the ploop-backup default and split the paragraph about the mechanism. - Link to v1: http://lore.virtuozzo.com/20261118-vstor-153891-v1-1-f31daea66355@virtuozzo.com --- Vasileios Almpanis (3): dm/push_backup: return -EINVAL for malformed target messages dm/push_backup: report expires_in as 0 for an expired session dm/push_backup: stop the backup when the process that started it exits drivers/md/dm-push-backup.c | 64 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 60 insertions(+), 4 deletions(-) --- base-commit: 5c8ade0760b8aba04b51b69556b629f77e72261e change-id: 20261118-vstor-153891-2b6ada96728a -- Best regards, Vasileios Almpanis Software Developer, Virtuozzo. _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel