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 03EA58017D for ; Wed, 4 Nov 2026 18:56:37 +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 6A4ItONS026165; Wed, 4 Nov 2026 21:55:25 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6A4ItONS026165 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=default; t=1793818526; bh=6FWxtX/8tawnh79DH6NctTqVm5S+54ZF6lvu5Xqy+HY=; h=From:To:Date:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe; b=L0enRB3WKaDZLzSXnAxWO33Xs2sPMNgXcMQ2FM5e6YTIgwqbb8NmdX5FdIUUio7Bl 2qeM5fZZQFOQSzL4Kaecj7N8dNs6EzsGFNCXnej1QNf7kJJV/GM0x5zKyh70ZF1aMN iULWS2vBG1nIZ0zXiBduCvRUAc/YPXT29qmBTxb3uBhxpmSPKzh5Zd1bOMnJL5LRhN S3/2Nu89laYhzKiYeR1WKzDCzrbMOuzoKQKQcDkksD2f0MWgnVcISbZd/22XKNXUk9 DTUwte00muMakyeOlM6cJdVTWHAJK3yhauKqaven1dCtZYhCvPYUpMXzDyVBPTvBEd i3hOHiqvyELiw== 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 6A4ItNdp026157 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Wed, 4 Nov 2026 21:55:23 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6A4ItNdp026157 Authentication-Results: mail.openvz.org; dkim=pass (2048-bit key) header.d=openvz.org header.i=@openvz.org header.b="oAdfgkKg" Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-4902ce85f72so856263f8f.2 for ; Wed, 04 Nov 2026 10:55:23 -0800 (PST) X-Forwarded-Encrypted: i=2; AKwUvBwY7PWqGUmXxpYEMRvChYSaR4AxrresEGkEMFdAcMpQccUXZJA3rgqWn2ijXtkqf6hjvMwhhA==@openvz.org X-Gm-Message-State: APuU4Z82OClz/XRa8i2/s25ubJAOuCtjTmHsPyAd47DiBCpL1K9QvMbT 3hmoBaVW+5ll5YKreYFUSnIWUnr1ukHvgr0F0Pfj6YQ+9fL13E9J0MN4mVoKtrMZN5Xugyz7T8s jFm5n1uiWH6QI+MG/HclYrO2LiaKGEI2ifF782Fzm6n9ntPAx2YdDdw== X-Gm-Gg: AYBFou0ad/MDTS1ZOiwDRRCSxH0TCUw3L4lSx6gqwnQ1/igEd4zIw+I3y9mswTlwiCk dRmA1a/aHZdr6o24vJ4R3JG3Xtoxk/ZChuLG3gyIA8xLuoXs7qFkQPB2UPnj/wfrCibKmdXGZ2z xkmmmVSrNg8EIx1Nz7flyG3tcVtPGdi4+r8sdvQlHyWtTAbVOpqhGXn0R1eZB/seZG7TlyGjVQj vnP1DxVhDnXSO6Sc0c5nSlqwFHjHqShPC+TIxoo9xPNJFxhqvy/hDI3tkVxRQ5zTuvQSVSVp8fm BxudvwApTA== X-Received: by 2002:a05:6000:2403:b0:48b:59f:db9c with SMTP id ffacd0b85a97d-48e6e514746mr34766685f8f.53.1793818522964; Wed, 04 Nov 2026 10:55:22 -0800 (PST) X-Received: by 2002:a05:6000:2403:b0:48b:59f:db9c with SMTP id ffacd0b85a97d-48e6e514746mr34766654f8f.53.1793818522542; Wed, 04 Nov 2026 10:55:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1793818522; cv=none; d=google.com; s=arc-20260327; b=j7bh81EMgkQbo7ILl6mlEslLYt/VOPRUEaHv1ULWiW6xkVCD34NpoyNxZMexTqJptY MyIZP0vcg+Ig0MvEeyh7dNRG5hvcupBAilVK4aizE3njSC2RcDD6S/wZhB5kt8SjY2fz LZuN4d1tC0vmHJGfkpMgjMpYLVO19YVY7895McR6lAhIk4PUE24VqH6fCeBCZIWv+YU7 5ldAHz6UEcb5we1qB+xiFcZW2KazitgNDSTpoYGFnmUgobDGg3l8knF+vZ3/yhLKlTFv +oCjbWDQLNatrrfpn1jJGMDEY7XTScBpvKor9XQFJLn8Z006darMRmHWIdqTFVR9b45L 7+7w== 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=VJuyqQQBXD8DuTdZHJfXrl2Xt/qeHaaU98dUdQQBado=; fh=XEmIRNq8qDWTWjKDB+15ugoMRWnMsp1bJIryDqh/wuE=; b=mYjJFKUJ2iXXqcx7L737UWjqJdF0HfqssV4cPzrA3Kq08YU7qAHRZdwibUY6+Mmlsv Rom2nnwjIR7czYZoOGvjIqms532J1Qsc3E0c0NWFiNI9AcJdub2KxVGW1V9X4hYHyj8+ T4bvGU/KpGWaN2n8LDiLa8qqIqx7oszOBGuTqAtRjkAMWCjwEbsjMiIv/OZ1FZPewRMu ShFnajqphRX/OT4S1RFnr1n8zTOzQx/CRjPMIeZU7YRqZ807vvY3ebGcrA3PxNwlPKtv ysqN2XoaeAHhxCO1v7siMcHlO+axgHV3+Y40EcGswFIckEBLm77MQsMkk8HO6EOUV9GJ IrDw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz.org header.s=google header.b=oAdfgkKg; spf=softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:162e:5a6e:fd46:18b7 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-48fef111d3esor619216f8f.13.2026.11.04.10.55.22 for (Google Transport Security); Wed, 04 Nov 2026 10:55:22 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:162e:5a6e:fd46:18b7 as permitted sender) client-ip=2a06:5b06:b600:300:162e:5a6e:fd46:18b7; Authentication-Results: mx.google.com; dkim=pass header.i=@openvz.org header.s=google header.b=oAdfgkKg; spf=softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:162e:5a6e:fd46:18b7 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=1793818522; x=1794423322; 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=VJuyqQQBXD8DuTdZHJfXrl2Xt/qeHaaU98dUdQQBado=; b=oAdfgkKgkintcA4hqJe1U+VeA5Spj4pVekY6FuGlVyGj82Q8yacWpWSfBYmHBgDgUf gOo2maUo5S4irm+AQ6FrX6Xs5EQZn9uafdBgZFSttpzv9HRdG/EbIOtHASdmLzXbbUfv M0jR9sg/1RZ2L1g14KSc19DbzakGlhPgoRHlW3QCRqj0YmeNCwLVKBANboVBCazJxSZf VGq07i3q/xUzSVg9WLHoIoXfs4cE/bChdOA2kmnrifqx+WvaskvwfnOyAkgzlb3ZvQKv 1sPgR1NWYuqU5YE7DVnhDd8UtjjuDRkvGTPKqyfXqhBXvQubUempDj5rSQkHibV66iGl flhA== X-Forwarded-Encrypted: i=1; AKwUvByr5XRFz1+o3A0RjgiKEMrx0wU3X85O5BXc92zeQEJHdgZamAvvA2TBb9EZK3+IGQQQuz34xg==@openvz.org X-Received: by 2002:a05:600c:46ce:b0:4a1:f625:2108 with SMTP id 5b1f17b1804b1-4ac18a88820mr382577995e9.33.1793818521934; Wed, 04 Nov 2026 10:55:21 -0800 (PST) Received: from athena.sw.ru ([2a06:5b06:b600:300:162e:5a6e:fd46:18b7]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4b56e2ae762sm4482435e9.2.2026.11.04.10.55.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Nov 2026 10:55:21 -0800 (PST) From: "Denis V. Lunev" To: andrey.zhadchenko@virtuozzo.com Date: Wed, 4 Nov 2026 19:55:15 +0100 Message-ID: <20261104185519.1870488-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 the pio submission stop around cmds 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 A cmd stops pio submission and waits for the inflight pios before it rewrites the BAT levels or deltas[], and expects nothing to touch them until it resumes. Konstantin found three ways this does not hold while reviewing the VSTOR-151979 series (VSTOR-152985, VSTOR-152984, VSTOR-152981): - a submitter racing the stop either runs without the cmd waiting for it, or is parked after resume and never completes (patch 1); - the ploop_allocator() thread is not stopped at all. It truncates the top delta while merge, notify_merged or flip moves it in deltas[], cutting the live image (patch 3). The thread can also miss a wakeup, which stalls the device by itself and would hang the new wait, so patch 2 fixes that first; - a grow failing to copy a cluster resumes submission with that cluster's BAT page still busy, and writes to it hang (patch 4). Patches 1 and 3 both lose data: a pio slipping past the stop can read and write through a delta that merge has already released, and the allocator cuts the live image. Patch 3 is the easiest to hit, a snapshot delete under write load is enough. Tested on dev-cl04, stock 6.12.0-211.52.1.22.11.vz10, dm-ploop built out of tree: - each bug reproduced on the stock module, the races with a test-only kprobe module widening the window: a pio running past the suspend of a cmd; a pio never completing after resume; the top image truncated from 512M to 128M by a merge and to 256M by a flip; after a grow failing with ENOSPC on a full host fs, a writer stuck in D state, an unsuspendable device and a later cmd failing with ETIMEDOUT. None of them reproduce with the series; - set_noresume, suspend, a grow to 2T, which relocates 8 clusters and restarts the allocator, and flip_upper_deltas with the allocator held: v1 cut the old top image from 640M to 256M, v2 waits for the allocator and the image keeps its data. On a stock kernel the flip oopses first: the check in ploop_check_delta_before_flip() walks past the md pages of the lower delta once the BAT has grown. The test ran with a local fix for that, which will be sent separately; - fio 4k random reads and writes, O_DIRECT, 1 to 48 jobs, on a fully allocated image over brd: IOPS and system CPU stay within the run-to-run spread of the stock module. This setup tops out at about 420K IOPS elsewhere in dm-ploop and would not show a lock taken on submission either, so patch 1 keeps that path lockless; - the ploop pytest suite, ploop and qcow2 formats, passes. A test for patch 4 goes to the ploop tests separately. Changes in v2, after Konstantin's review: - 1/4: notify_merged named among the cmds hit by the race; - 2/4: the stall does not end by itself, and the reorder fixes a lost kthread_stop() wakeup as well; - 3/4: also wait for the allocator in ploop_flip_upper_deltas(), as a resize of a dm suspended device restarts it after postsuspend; the message names notify_merged, which moves the top delta in both directions; - 4/4: unchanged; - rebased on rh10-6.12.0-211.52.1.22.17.vz10, Reviewed-by tags added to 1/4, 2/4 and 4/4. v1: http://lore.virtuozzo.com/kernel/20261103083642.130885-1-den@openvz.org/ Denis V. Lunev (4): dm-ploop: fix pio submission racing with the suspend and resume of a cmd dm-ploop: fix a lost wakeup of the ploop_allocator() thread dm-ploop: wait for the ploop_allocator() thread before changing deltas[] dm-ploop: fix a failed cluster copy on grow leaving the BAT page busy drivers/md/dm-ploop-cmd.c | 24 ++++++++++++++++++++++-- drivers/md/dm-ploop-map.c | 22 +++++++++++++++------- drivers/md/dm-ploop-target.c | 4 ++++ drivers/md/dm-ploop.h | 1 + 4 files changed, 42 insertions(+), 9 deletions(-) base-commit: 95ab11e2c57e8468412ca586d4be8cd75b6bfbf0 -- 2.53.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel