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 0F192803F6 for ; Tue, 17 Nov 2026 14:01:27 +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 6AHE07Hg009778; Tue, 17 Nov 2026 17:00:09 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AHE07Hg009778 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="qI0S8PR2" 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 6AHE02rm009761 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Tue, 17 Nov 2026 17:00:03 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AHE02rm009761 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-48e0af48c18so3140130f8f.2 for ; Tue, 17 Nov 2026 06:00:03 -0800 (PST) X-Gm-Message-State: APuU4Z/lxSJGXlBi9WKDYni2Mei21t7qQn7EFfytdtJnWN9YJwyh6NJv FraxGgBuXpdPRopVNNe2/XrN5CW6i+d+Ff6LLLtmPIAIgreXMIMwVuDjpd+7ff8V6ckjHfMpOeB ARK7bBcukmBjy5WpJFWvnJNlAuPxgHe0nCmeZQEueBXa5eQ6yDvERFQ== X-Gm-Gg: AYBFou0e/MbETTaptjf1UQrQEOXXmSL6mNiv8nCWJnOE/T1Suf4SHlHkWXRdD8/dQ2R GxndLFHeHQmg7F/hLpMFIaPyvTQzqR8PL3NvADTuiPhAtRSea14LdS316z6UnXGqYsDnu4v3eGU lFLjq1oQiRXfgOVVp51LEBKaf64zEKSKe/V/Qz29EGKwBpaWFqXHGdvrx6d/znQJXzXtEa0IGeM Bm3CMOJH1WWvmnaI+z1fbCVMCuvFqQ9/h/C0WXWUDNzVfKft6S72zDUQRMQXax57WqQnxa5cnUp Peik+lTpu7mqvltdda9y1HVxcG2PgKZPj1y45mtefmkM6aYHVsnW04WcoVtgjdOJ8Zm/x56hWZg w9THpM6E7TXC/jiUD X-Received: by 2002:a05:600c:3b96:b0:4bb:679a:86ee with SMTP id 5b1f17b1804b1-4bb679a8e01mr236526565e9.29.1794924002620; Tue, 17 Nov 2026 06:00:02 -0800 (PST) X-Received: by 2002:a05:600c:3b96:b0:4bb:679a:86ee with SMTP id 5b1f17b1804b1-4bb679a8e01mr236525795e9.29.1794924002049; Tue, 17 Nov 2026 06:00:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1794924002; cv=none; d=google.com; s=arc-20260327; b=qG0ZMJfA6IKH2IflhFrOaYR6KM1vzR0r3hJx853QAo7Qp88qW6rpM6GK2AaYDCKSED BKr/xdSgZG+LZ5SNPfDlDxZ0Fg9jhD9IxCmZ/xTb7DHqbBsfVzEtSYjgABq5x1wFHyv1 mc4HgZH8L0VoSV71sjkcbc/fi/J3M+b0CNYuOQm3A/+f2XdZ48TAwCGWPpTLqE5fzeKj Cp9pB8ra7/O1968fiOv+kAqW+vuaK3ZYACeFBX4xtlpjqF8WfqXpenv9hsO0N0Khl27y iuhxUHzQSC5x60GAEWovawv0MWS7HdQn1MjmG+CXOOnsL/fsvvAbOmiUVl9lQfdUdwJD RVpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=message-id:date:references:in-reply-to:cc:to:from:subject :content-transfer-encoding:mime-version:dkim-signature; bh=/1KBum8Y+aJKM8jKvfSR7JRTA4BelWkoNSyV/8AfAII=; fh=9a32gKL5KKeaohQjBh2D3pG89qkyVDxjDGg4yWgrCuo=; b=hiqDY/ECY55ksR338575Zcxt1IkeiG4NTG76v/ah92AkviZnZ4xdoUVdYVlyrp17Q6 okxA6JqXAA951EAS8jxQAq6Bgew0MbzW9+tXR1Luj8NgkZwMaulWZx5cGpTyrOV0ymkZ V4ZsnV19fuoiCtdLJdJM3VlsMpYqWSnB4PiKTVxYa3TCt4x+9m7pFibzh2G5CsRhCCe9 +Yo/1mdcpqapfDeJ80ETPQMFcpIcQM0wKumNbdzGHMrIktNASsTD0ZPcTKzME/nN/9pe lmq7rm+4BaWfeIllQ4G7ask29CgvwBBm43MLmoQfd06L9Xy/P5hrgJttt0c76x2D5rv5 hCEw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=qI0S8PR2; spf=pass (google.com: domain of khorenko@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=khorenko@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-49c6312230fsi28831677f8f.127.2026.11.17.06.00.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2026 06:00:02 -0800 (PST) Received-SPF: pass (google.com: domain of khorenko@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=qI0S8PR2; spf=pass (google.com: domain of khorenko@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=khorenko@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:Date:From:Subject:Content-Type: MIME-Version; bh=/1KBum8Y+aJKM8jKvfSR7JRTA4BelWkoNSyV/8AfAII=; b=qI0S8PR2bBm2 so5FgLnNQM1Wubr/IoaQOUHxx44yBGPe5By36qWF+q9z6Kqk4ElZyjBo8CEIXFQETWltNAAnr95xE pWB0nrsyRbnb1v5KZnnOTBDz1hBdyyiTkuccZtyz7F4kBP6lcClzKjhe0kW1s9sQokcLYfw9zSzVx cCUxdiokA+Qui41qd83uuNAGzTLbIgJbbEml6DAgVv95uWquwZV03m6Ot6AEqSYJjg4ffAiLcOKmF nvB5y89BRRjUqs+Z2J1pMe7k5EH+AweJfhuavfmMmttQYyB9sofb6LJJKWUXx6skHE09ZoWaSgrkW /YGvFENN4q1GMg2jt4rjTw==; Received: from ch-demo-asa.virtuozzo.com ([130.117.225.8] helo=f0.sw.ru) by relay.virtuozzo.com with esmtp (Exim 4.96) (envelope-from ) id 1xTJer-00Df4p-0X; Tue, 17 Nov 2026 14:59:51 +0100 MIME-Version: 1.0 From: Konstantin Khorenko To: Alexey Kuznetsov In-Reply-To: References: Date: Tue, 17 Nov 2026 15:00:00 +0100 Message-Id: <179492400071.138826.5468175470996454760.b4-review@b4> X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3153; i=khorenko@virtuozzo.com; h=from:subject:message-id; bh=sIXdJVhRXel69Wb0fFHwU9ksTrtuDNTgGxu2hrgIoO4=; b=owEBbQKS/ZANAwAKAVGWCkf5YVwqAcsmYgBq/F3gbaaDqzTbY0JlKlDhpOq/yoR0vajnTSDgm 1weW7fUU9+JAjMEAAEKAB0WIQRWD23IPcXT0GO9CCxRlgpH+WFcKgUCavxd4AAKCRBRlgpH+WFc KvctD/0Sr2bLMYLQ+MKxY0JxxfBkGo9AjAbUPFfUuV+ZzJnmpV0PHLfX00oobsRP+E1+kRbqefk r+/ZzeYcYwYdOT61Ft12jSB53X7E1C2w/uPDFa/UtMnmVFe+B6cMnfaQWhS9QdlEH3cHLPCBf+Y a6cbSNhg+5dMe9bOfYlyQDvpLOwtDBo/6POJAVT2tVE91sqh5nbZ+ZMbfN9Igd64cSklSgDwcJw tXHvv+t5cLt4hUuekZm5GoIT9bmYaotArUkffZLGGY2R4UGRHQqTLhx2YLOboAQVivFsz3m/LRV 9kIhxA3V+I9S50FrM6kw9gVzRy4PVcUPV0FRzFcsIx4gO1Hu2qXKG2h33zDtt+/Sq7dedxhZoFD OI/sKsdCEgf/AzMN2f4Z3SYA8OpV2Xf+gcH3wt0li9o+TBegtcvOZFHU29pUvVkYJX6xfjOl4/G 6o8QrIoUqtFa+ZkYOf5WHEy4rLNFqa4VfMU74n8JR4W488CoA1yfHd7wETOnGJkVyjoH4bFlU1M vTG3QgrofSHiDAYGYn1OXmCZHTznrGIItA4jnMhX6v7jmMKjAEF9WFGjVP0IUE5Nc3ioTqqf5Ek 2vxpNdv+BC7d/nFz7bTCh/XTc+Y9XMus940wmMqjHxStJkQn6tvw2fKHJwUgqoPATKiC95bfu6i 8VB5e4436kt5Qzw== X-Developer-Key: i=khorenko@virtuozzo.com; a=openpgp; fpr=560F6DC83DC5D3D063BD082C51960A47F9615C2A X-OZ-Fwd: true Cc: azaitsev@virtuozzo.com, devel@openvz.org, kui.liu@virtuozzo.com Subject: Re: [Devel] [PATCH hci-8.1 1/2] fs/ext4: rectify behaviour of swapext ioctl on error 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 I won't apply this version, please send v2 with the changes below. This series has no cover letter, so the whole list is here; my reply to 2/2 points to it. 1. Patch 1 message: say what the patch fixes in the kernel, not only the moved_len user space reads back: - a retry after -ENOSPC or -EBUSY restarted from orig_blk and swapped the done part back; - a short or zero moved_len on error left the page cache of the swapped blocks in place. Drop the "It was forgotten ... found this missing element" paragraph. 2. Patch 1: add Fixes: 1a3d440e7fbc ("fs/ext4: swapext ioctl"). 3. Both patches: the tracker URL https://virtuozzo.atlassian.net/browse/VSTOR-148028 and "Feature: ext4: swapext ioctl: swap range of blocks between two files", as the earlier swapext commits have. 4. Patch 2 message: name the case where the estimate falls short and what the user sees then (the handle aborts, an ext4 error, the fs goes read-only), and say that the restart relies on patch 1. Drop "The patch is suggested by Claude. It looks reasonable," and "I guess"; "warranty" -> "guarantee". 5. Patch 2: one donor extent can now be swapped in two transactions. Please confirm that csd recovers from a crash between them, and say it in the message. 6. Patch 2 code comment: "continue from lblk1 + replaced_count" is not where the caller resumes: lblk1 has already been advanced by replaced_count at that point. Separate patches, not needed for this series. I created a task for each: 1. On ext4 without a journal swap_one_extent() and expose_one_extent() dereference the fake handle (handle->h_requested_credits) and oops. https://virtuozzo.atlassian.net/browse/VSTOR-155599 2. jblocks grows with the number of orig extents; on a fragmented range it goes above the jbd2 per-handle limit, which WARNs and fails the ioctl with -ENOSPC. With patch 2 it can be capped. https://virtuozzo.atlassian.net/browse/VSTOR-155600 3. ext4_ioc_swap_extents() does not call inode_dio_wait() on the two inodes, unlike ext4_move_extents(), and does not mark the swap fast-commit ineligible. https://virtuozzo.atlassian.net/browse/VSTOR-155601 On Tue, 17 Nov 2026 21:24:01 +0800, Alexey Kuznetsov wrote: > It was forgotten, but did not affect existing user space > csd, because it aborted on any error of this kind. > But now we work on better handling of errors, both > recoverable and not-recoverable and found this missing element. 1. The code does more than this says. Before the patch a retry in swap_one_extent() started again at orig_blk, so the extents already swapped were swapped back: without UNWRITE_DONOR the ioctl reported the full moved_len while that part held the old data, with it the retry failed with -ENODATA. And truncate_pagecache_range() is sized by moved_len, so a short one left stale cached pages over swapped blocks. Mainline fixed the latter for move_extent in 55583e899a53 ("ext4: fix double-free of blocks due to wrong extents moved_len"). Thanks. -- Konstantin Khorenko, Virtuozzo Linux Kernel Team _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel