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=1796385310; b=kQzVKs9frG178tf//Vf1ZW0w/BjH336DE35S9QoGHFc7gRI7VOMmiLSejvmekbZjuGAJ +fwEyr5bJMvSqaq+9PVIZ/HQdJA1Whm1BX5SPCJHk+cMDl2pFt845EpMmUckHvUSYLHuB rSbyv7kJOeIopGoIZfJpzIyKDpHrh6nw+0aaljbWKdzRBIElsPylWd7a9rPKjMnU6L9AH DfboT4PgTbcMVdNPVqKXenCaw/gPZ7jgrqRvLF6K/AHehMJuIznmPy1hA+NAtcd51pllo n+jRb/WKX8N8AOcJPjEEyejJzZl3I2gr3zX5hRihmHMKGvte6I8XTCbkwkRys0AOb3g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385310; 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=Jcnkn97tyvk8mCEQ17hEW/zjfstFVqVjvIA20Yjmuho=; b=YS/aiiyxdXVophqExXvMRqnevguievVIwN9NIQppDz6UXsDGKVNRJ69lkRQrlM7pd0AE T8Z1xVoqeTEMcVj9s2arYLIdwNAcBicdTmcMdLr1/xPeANUqCUE/S9U6TtTxWddgqwpJh 42zfom95IB9JYc5WoFFlZAZQBcRk3lawjOS4m+CvQ/VndMDmb6k2jtzRujVrcoLK+bcKO UeSk/5h4tgQUKFDgXo2GpSnMPGgGhyUNeybmyFMElJARHXU9+pfTzFYM6PkNqSPYWr/eV VaQkl+B1AQYff6+a7UZiuvLIAzpasxR3OR4JljXxKWi1rC+G3e8t4Lea5aa200dcq/g== 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=a2thcTwl; 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 BA032606A322; Fri, 4 Dec 2026 11:55:10 +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=a2thcTwl Received: by smtp.kernel.org (Postfix) with ESMTPSA id 342EA1F000CE; Fri, 4 Dec 2026 11:55:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385310; bh=Jcnkn97tyvk8mCEQ17hEW/zjfstFVqVjvIA20Yjmuho=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=a2thcTwlhvwA1hIRToM8tyFiOEfYply5KKfyk9QsoSpEVrm0fVVRYokda2FcDZso1 L0T7YMDahT3fsE8oXiCxW1Qv8iL9E2Ja3fqiffnhvOxJ+63YypS7dL6egck7a03wNJ qnQ+qZBaJxSVv7tN3gT239RkPB+PfwNsZZcNuHvo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sashiko , Tal Zussman , Alex Markuze , Ilya Dryomov , Sasha Levin Subject: [PATCH 6.6 0463/1167] ceph: fix writeback_count leak when a bounce page allocation fails Date: Fri, 4 Dec 2026 18:58:10 +0900 Message-ID: <20261204100714.075702041@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tal Zussman [ Upstream commit 7807710d88ad03e7ca9b5f79f518f040db2a4e09 ] ceph_process_folio_batch() calls is_write_congestion_happened(), which increments fsc->writeback_count, before calling move_dirty_folio_in_page_array(). If the fscrypt bounce page allocation there fails, the folio is redirtied and never makes it into the page array, but the count is never dropped. write_congested is only cleared when a decrement falls below CONGESTION_OFF_THRESH, so the leaked counts set congestion early and eventually leave write_congested set for good. Every WB_SYNC_NONE writeback then returns 0 and background writeback stops entirely. Bump the count only once the folio is in the page array. Fixes: d55207717ded ("ceph: add encryption support to writepage and writepages") Reported-by: Sashiko Link: https://sashiko.dev/#/patchset/20260902-remove-wait-on-page-writeback-v5-0-0b512e77e75b%40columbia.edu?part=1 Assisted-by: Claude:fable-5.1 Signed-off-by: Tal Zussman Reviewed-by: Alex Markuze Signed-off-by: Ilya Dryomov [ sashal: Applied to ceph_writepages_start(), where this tree's page-array loop bumps the congestion count before the fscrypt bounce page allocation, rather than to ceph_process_folio_batch(). ] Signed-off-by: Sasha Levin --- fs/ceph/addr.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index 63a4e6ffc8a76..24d3951b3646f 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c @@ -1171,11 +1171,6 @@ static int ceph_writepages_start(struct address_space *mapping, doutc(cl, "%llx.%llx will write page %p idx %lu\n", ceph_vinop(inode), page, page->index); - if (atomic_long_inc_return(&fsc->writeback_count) > - CONGESTION_ON_THRESH( - fsc->mount_options->congestion_kb)) - fsc->write_congested = true; - if (IS_ENCRYPTED(inode)) { pages[locked_pages] = fscrypt_encrypt_pagecache_blocks(page, @@ -1202,6 +1197,11 @@ static int ceph_writepages_start(struct address_space *mapping, pages[locked_pages++] = page; } + if (atomic_long_inc_return(&fsc->writeback_count) > + CONGESTION_ON_THRESH( + fsc->mount_options->congestion_kb)) + fsc->write_congested = true; + fbatch.folios[i] = NULL; len += thp_size(page); } -- 2.53.0