From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796379393; b=gXQQvihiDa9lHUKeDxuNxvyDbvY9eX3eeyHG5qbI1n8UjVtvSIzbcTMQPVFFz9ruDitO 6yNM177znEFmEZ+Fxx7MPqO4nskDmULlgbKevC1SqRZrfm7n/IYYMM4TJP0zi3vMGxAWv 5LheWvRMyT+Qjsj14Dr37nkuggXv/KUQbl8g/FWVwvaGuksiv3BAt3VLSZso4yvgLnM6M KjvjFEXyxeIht5S54aVArVi0jrlwl/lyhoX3VNiSlsnYhx91XT5Epiz0XyZ/tmGp57Nxt KdsHFvhEs8guaW/yQjADL6pQKrIU60BX5RxVgZZ/9MMSHL8WmIdBhq0Hc3S6KcO7DQA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796379393; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=hstweQmXKGcp1l3fpjiCmlWAkwuNv8XIeIzUTxQJgMA=; b=JMpYeEUwh2fUEfjPXRY0GLviDpWG08PGCEJth5C/jwUFEM1TdNWyn8yzPI4tzZjVVRDi tO/DUEOJuuSY0gmoabsJf/QftsJ5Ek3ZtAEEn3RRvmbkD4d/VYSYbwbuFL8ySLtlbr6cz A0W6NhMa+eV2kEDHqevaInlbBoAmoy9YVt33a+loohV/2qbZxH1NsRiNiDOLyxGiiqrsr yJ0PbwHqmz8dx1XKOAw1qnZrAImi/YFQuMCne6zF/YndmFNLiXEARg33Ns+lmpRXB84vT lvoZsxNOw3wlDR3/Gvkdngqgb/OJ4sZp5SJm5QJms3W6rZzOzz5L2U5tn6/AdNHaGxA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Ah34ssc2; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A6A27606A330; Fri, 4 Dec 2026 10:16:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Ah34ssc2 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24B1E1F00937; Fri, 4 Dec 2026 10:16:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796379393; bh=hstweQmXKGcp1l3fpjiCmlWAkwuNv8XIeIzUTxQJgMA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Ah34ssc25C4uMzBBfRdoGj1PAVMkUmHAMtnQcV4wHZwp46iT6PZDhFtCBAgg/WTp6 TLH9rBbgOkHe2mvw2xlo6q2B/AttTQRdQxxJtaEBFs5H/T7Tjfctv+rfyPSvMuG0nH xAECuDY/C4REbEPYRd+QF56pwUQLeOECBunDpIz0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jan Kara , Theodore Tso , Sasha Levin Subject: [PATCH 6.18 013/703] ext4: fix transaction overflow during writeback Date: Fri, 4 Dec 2026 18:58:32 +0900 Message-ID: <20261204100627.902985913@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jan Kara [ Upstream commit 46e8e31771f4f1c5e1cdec37a889a6730e42e9f1 ] Commit 95ad8ee45cdb ("ext4: correct the reserved credits for extent conversion") was correct to note that we need to reserve enough credits for all extents possibly underlying a large folio. However it was too eager to reduce the number of reserved credits. Extent conversion may not only need to touch several leaf extent blocks, it may also need to split extents - for example a single large unwritten extent may need to be split into many small written ones in case of sparse folio dirtying. This can thus result not only in extent leaf modifications but also in a need to allocate new extent tree nodes. As a result the reserved transaction credits were not sufficient in some corner cases. Use ext4_meta_trans_blocks() for correct upper bound credit estimate. Fixes: 95ad8ee45cdb ("ext4: correct the reserved credits for extent conversion") Signed-off-by: Jan Kara Link: https://patch.msgid.link/20260805153605.166545-5-jack@suse.cz Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin --- fs/ext4/inode.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index a8325b778355e..2a9167bff4c26 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -2862,10 +2862,10 @@ static int ext4_do_writepages(struct mpage_da_data *mpd) if (ext4_should_dioread_nolock(inode)) { int bpf = ext4_journal_blocks_per_folio(inode); /* - * We may need to convert up to one extent per block in - * the folio and we may dirty the inode. + * We may need to convert up to one extent per block in the + * folio. */ - rsv_blocks = 1 + ext4_ext_index_trans_blocks(inode, bpf); + rsv_blocks = ext4_meta_trans_blocks(inode, bpf, bpf, 0); } if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX) -- 2.53.0