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 2B25280E7E for ; Tue, 3 Nov 2026 08:09:41 +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 6A388PZO002183; Tue, 3 Nov 2026 11:08:26 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6A388PZO002183 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="lJ840a/K" Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6A388J3K002148 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Tue, 3 Nov 2026 11:08:19 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6A388J3K002148 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-48dff112136so2510134f8f.1 for ; Tue, 03 Nov 2026 00:08:19 -0800 (PST) X-Gm-Message-State: APuU4Z/QLMcmNP+btEd1OMkP/ogwJPWLNnKTkdx2HHba98MYOiLl1y2r PtsMK5CRufGslO7vCTfhAD8pzo2l3ynftMERnr7slWxt3xtJStatKFFx4PSCC6NQRHqE970IbKC 6zQRmtdmUKmSQsPVC6y2+0YDeBG7WfvXSG/lL5n5p9j5J5hlS95633g== X-Gm-Gg: AYBFou06sszdyQ8Yc9sNCRvce6fEqpCs39gPh415PiYtboDmMSv4mt8OuvyBHu1p1TM 4nwmPM10fEGfbCQYTSA7d8VTJUjvw3vvXuOUG8U0+9dGB1XBMxoenc7d47/WfeA8kmmPdK3lh7N W1MS5Rlqre/lQg8LMhLIQlhw5Mo8DKLCNbIQskSPEhc7eM6mUrJZm368vYamj9oWHZktZWtAyYP fk7RwgL0gM8t4e+6gMh5r+VBf1ztEnrOu+Meb67YvaOJPjWSviL82+wZpsXyqdxQ3uFdi/tCHXF 3SF/xJYtu0aETHNJE0PY7ZRpthP/fX5iJjnQizJZD5fluqaHxliONZQ4iKVeJxL65xcqjFSQY91 khWLSlE+2lESOIrE0KkQS3/6QEhVW X-Received: by 2002:a05:6000:1785:b0:48e:3767:d885 with SMTP id ffacd0b85a97d-48e6e4f8c42mr29144273f8f.53.1793693298866; Tue, 03 Nov 2026 00:08:18 -0800 (PST) X-Received: by 2002:a05:6000:1785:b0:48e:3767:d885 with SMTP id ffacd0b85a97d-48e6e4f8c42mr29144233f8f.53.1793693298314; Tue, 03 Nov 2026 00:08:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1793693298; cv=none; d=google.com; s=arc-20260327; b=Fp1g02bS2QAB9jb4E/5XuQ/uDWpsZ+Nuq6A1DxgX4HmbFr7cvTAqgLGe7NCHW5v/t9 hixMCuBb4wStSb8rW+7jIfzY/DM18+lNDZvlcqNdPvwSY8Jx5sLLKG0Zs0TQDVY0OgK+ PrSk47dhv1X0BNfIiD57DFV61Q8xb9onbYbZa0azTzTwkvTOFVDc5hN2N4SbeuIqXrB8 pRWwut61/eRw9eG2/oaDiDi1K6ZDPrJEWScVjKWPvTKEUSEYo0jHdd4ak0trdpZyuhph ZUqfuranS5oA2RHDotFJgPTXDwAbO5rn6EzUaLuJrCxz03vYDGaT5w4RdjL0/7gL8QKO 1PNw== 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=emLBgIEf4FHOTO6fPOtCpqU9J056mVViCg7yDNcmYqA=; fh=ElTTnnNtphHTCCOZ+58STyaWac7y7ytLDJZIF4HMMJ4=; b=Ou5cRc2n+DRU/fCS+mJ1CctTzfxwEf7aBvomxqgtsk7lP3EYyF6au+M0tiWtW5KQV7 SInj7Atmciv6sYhL1DO/1VqyaZS47Ac4ir3A0fOSUrLgAUwCANdAzyNnm8Qh3+qu2UdQ Q+E5L6ymYOxzG3euMCBDPyNUGHRwKfDrX7brKebXKZZbphxtGVwxPuOUvCg6Uueh9JIZ XLXEO/TWjPIdMvzBtxLbvdIdnYjGlQAsoi2lfVUTOQpQeAJF4PucxJvzPc1Rt6AxeJ/9 pdmIXwvz3seW7JwA124pHxVmWPbE0sjoDkbEthBNMP6ynBUfo40gFPvThSUchrI6obm0 AMMw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b="lJ840a/K"; spf=pass (google.com: domain of andrey.zhadchenko@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=andrey.zhadchenko@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-48e71bcce55si23721416f8f.397.2026.11.03.00.08.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Nov 2026 00:08:18 -0800 (PST) Received-SPF: pass (google.com: domain of andrey.zhadchenko@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="lJ840a/K"; spf=pass (google.com: domain of andrey.zhadchenko@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=andrey.zhadchenko@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=MIME-Version:Message-ID:Date:Subject:From: Content-Type; bh=emLBgIEf4FHOTO6fPOtCpqU9J056mVViCg7yDNcmYqA=; b=lJ840a/K7PLE ekbe0n0fN/6AP5duDh0u5/9NSMsbx63mwRXPvSWg/TK3oceKS2dVO3debq/K6Mso85wD0W7ynriMu PMj0pWn98SntdK5u1BxOtX82W6mQq03VKd4lFH5H15PyxUZdpd+SqUTGh90a5jCfpxENmv+BcsP5l tzgjfhMTNcZjJ9g51EjsqkY8Amv64ELSfLyiX901gQKFlSUXdF0qSssHxItMHkV+EI7oSsMjkBeDQ BZqKPaq3Y1rJLih4wS7NlaY7EvcXAxyZNfgHM3LvtTAzCapRBU9pNNzoehws0dfgiXpNaG8Kz31WY OMfY3Sntw6vmyGywtvb8RA==; Received: from [130.117.225.5] (helo=vz9-demens-1.aci.vzint.dev) by relay.virtuozzo.com with esmtp (Exim 4.96) (envelope-from ) id 1xO9V8-0086OY-2y; Tue, 03 Nov 2026 09:08:08 +0100 From: Andrey Zhadchenko To: khorenko@virtuozzo.com, alexander.ivanov@virtuozzo.com Date: Tue, 3 Nov 2026 11:03:52 +0300 Message-ID: <20261103080358.723186-1-andrey.zhadchenko@virtuozzo.com> X-Mailer: git-send-email 2.43.5 MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.1 v4 0/6] dm/push_backup: event fd interface and fixes 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 push_backup target currently makes the backup tool wait for the next cluster range inside the "push_backup_read" target message. dm runs target_message() under dm_get_live_table(), i.e. with md->io_barrier SRCU read-locked, so while the tool sleeps there anything that needs synchronize_srcu(&md->io_barrier) on that device is stuck: suspend, table reload/remove and dm_internal_suspend_fast() from "@stats_create". An unrelated dm-stats user hangs, and everything that later queues behind md->suspend_lock hangs with it. Patch 6 adds a file descriptor based interface instead. The tool gets an anon inode fd via the "push_backup_get_fd" message and then uses plain read()/write() of struct dm_push_backup_range to fetch the next range and to acknowledge it, without going through dm messages on the data path. The fd pins struct push_backup with a kref so it survives target removal and simply returns -ENODEV afterwards. The legacy messages are kept for compatibility. Patches 1-5 are fixes found while working on this: 1. init the lock, waitqueue and timer before anything that can fail so pb_destroy() is safe from any error path; 2. clear pb->alive under pb->lock like the other users do; 3. drop the redundant mod_timer() in push_backup_write(). The timer re-arms itself from pb->deadline_jiffies, so updating the deadline under the lock is enough. This was also the only place that armed the timer outside the window push_backup_stop() waits for, which matters once writes may arrive via the fd without pb->ctl_rwsem; 4. pass absolute expiry to mod_timer(). Both remaining callers passed a relative value, so after ~5 min of uptime the timer fired and re-armed on every tick while a write was delayed; 5. arm the timer under pb->lock and wait for its callback properly. pb_timer_func() and postpone_if_required_for_backup() both decided under the lock and armed after dropping it, so a stale S64_MAX could overwrite a fresh deadline and park the timer ~12 days out with delayed writes still pending. Also, timer_delete_sync_try() does not wait for a running callback, so one blocked on pb->lock could outlive push_backup_stop() and expire a later session. With arming done under the lock, the callback checking pb->alive and stop/destroy waiting via timer_delete_sync()/timer_shutdown_sync(), the RCU dance between postpone and stop is no longer needed and is removed. v4: - 3/6, 6/6: commit message typos. - 4/6: added Fixes: tag. v3: - 5/6: pb_timer_func() bails out when !pb->alive; push_backup_stop() uses timer_delete_sync() and pb_destroy() timer_shutdown_sync() instead of WARNing on timer_delete_sync_try() < 0, which never waited for a running callback. Commit message corrected accordingly. - 6/6: push_backup_get_fd() installs the fd only after its number fits into the result buffer (reserve -> emit -> check -> install), so a too small buffer no longer leaks the fd with its pb kref and module reference. pb->dead renamed to pb->destroyed. UAPI type namespaced as struct dm_push_backup_range. read() now requires exactly sizeof(range) like write(). Subject prefix aligned with the rest of the series. v2: - 2/6: reworded the commit message, dropped the KCSAN claim. - 5/6: new patch: arm the deadline timer under pb->lock and drop the rcu_read_lock()/synchronize_rcu() between postpone_if_required_for_backup() and push_backup_stop(). - 6/6: resubmit_pbios() now frees the pbio before dm_requeue_original_rq(). The requeue drops the md reference held by the in-flight request, after which __dm_destroy() may run .dtr and destroy pbio_pool under the fd writer's feet. https://virtuozzo.atlassian.net/browse/VSTOR-152912 Andrey Zhadchenko (6): drivers/md/push_backup: correct initialization drivers/md/push_backup: clear pb->alive under pb->lock drivers/md/push_backup: do not re-arm deadline timer in push_backup_write() drivers/md/push_backup: fix mod_timer() usage drivers/md/push_backup: arm deadline timer under pb->lock drivers/md/push_backup: add event file descriptor interface drivers/md/dm-push-backup.c | 268 +++++++++++++++++++++------- include/uapi/linux/dm-push-backup.h | 39 ++++ 2 files changed, 246 insertions(+), 61 deletions(-) create mode 100644 include/uapi/linux/dm-push-backup.h -- 2.43.5 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel