* [PATCH 0/2] ceph: fix writeback congestion accounting
@ 2026-09-04 16:12 Tal Zussman
2026-09-04 16:12 ` [PATCH 1/2] ceph: fix writeback_count leak when a bounce page allocation fails Tal Zussman
2026-09-04 16:12 ` [PATCH 2/2] ceph: don't clear write_congested when collecting folios Tal Zussman
0 siblings, 2 replies; 3+ messages in thread
From: Tal Zussman @ 2026-09-04 16:12 UTC (permalink / raw)
To: Ilya Dryomov, Alex Markuze, Viacheslav Dubeyko, Milind Changire,
Jeff Layton, Xiubo Li, Christian Brauner
Cc: ceph-devel, linux-kernel, Sashiko, Tal Zussman
Two fixes for the writeback congestion accounting in
ceph_process_folio_batch(), both found while reworking the writeback
path for folios.
Patch 1 fixes a writeback_count leak when an fscrypt bounce page
allocation fails, which can eventually leave the mount permanently
congested. Patch 2 restores the set-only semantics for write_congested
that the folio batch refactor lost.
---
Tal Zussman (2):
ceph: fix writeback_count leak when a bounce page allocation fails
ceph: don't clear write_congested when collecting folios
fs/ceph/addr.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
---
base-commit: ef063f72b23420b2889a8f631887fe0adae4af12
change-id: 20260904-ceph-writeback-count-leak-2a577e8c15f9
Best regards,
--
Tal Zussman <tz2294@columbia.edu>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] ceph: fix writeback_count leak when a bounce page allocation fails
2026-09-04 16:12 [PATCH 0/2] ceph: fix writeback congestion accounting Tal Zussman
@ 2026-09-04 16:12 ` Tal Zussman
2026-09-04 16:12 ` [PATCH 2/2] ceph: don't clear write_congested when collecting folios Tal Zussman
1 sibling, 0 replies; 3+ messages in thread
From: Tal Zussman @ 2026-09-04 16:12 UTC (permalink / raw)
To: Ilya Dryomov, Alex Markuze, Viacheslav Dubeyko, Milind Changire,
Jeff Layton, Xiubo Li, Christian Brauner
Cc: ceph-devel, linux-kernel, Sashiko, Tal Zussman
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 <sashiko-bot@kernel.org>
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 <tz2294@columbia.edu>
---
fs/ceph/addr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index f1404664c97a..69f2c4c8498a 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -1457,8 +1457,6 @@ void ceph_process_folio_batch(struct address_space *mapping,
boutc(cl, "%llx.%llx will write folio %p idx %lu\n",
ceph_vinop(inode), folio, folio->index);
- fsc->write_congested = is_write_congestion_happened(fsc);
-
rc = move_dirty_folio_in_page_array(mapping, wbc, ceph_wbc,
folio);
if (rc) {
@@ -1471,6 +1469,8 @@ void ceph_process_folio_batch(struct address_space *mapping,
break;
}
+ fsc->write_congested = is_write_congestion_happened(fsc);
+
ceph_wbc->fbatch.folios[i] = NULL;
ceph_wbc->len += folio_size(folio);
}
--
2.39.5
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/2] ceph: don't clear write_congested when collecting folios
2026-09-04 16:12 [PATCH 0/2] ceph: fix writeback congestion accounting Tal Zussman
2026-09-04 16:12 ` [PATCH 1/2] ceph: fix writeback_count leak when a bounce page allocation fails Tal Zussman
@ 2026-09-04 16:12 ` Tal Zussman
1 sibling, 0 replies; 3+ messages in thread
From: Tal Zussman @ 2026-09-04 16:12 UTC (permalink / raw)
To: Ilya Dryomov, Alex Markuze, Viacheslav Dubeyko, Milind Changire,
Jeff Layton, Xiubo Li, Christian Brauner
Cc: ceph-devel, linux-kernel, Tal Zussman
ceph_process_folio_batch() assigns the result of
is_write_congestion_happened() to fsc->write_congested for every folio
it collects. The code it replaced only ever set write_congested to true
here, leaving the decrement paths to clear it once writeback_count
drops below CONGESTION_OFF_THRESH. The unconditional assignment means
that a sync writeback that runs while the count sits between the off and
on thresholds clears the flag on its first folio, and background
writeback resumes early.
Only set the flag here, as before.
Fixes: ce80b76dd327 ("ceph: introduce ceph_process_folio_batch() method")
Assisted-by: Claude:fable-5.1
Signed-off-by: Tal Zussman <tz2294@columbia.edu>
---
fs/ceph/addr.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index 69f2c4c8498a..7c9508fdc41a 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -1469,7 +1469,8 @@ void ceph_process_folio_batch(struct address_space *mapping,
break;
}
- fsc->write_congested = is_write_congestion_happened(fsc);
+ if (is_write_congestion_happened(fsc))
+ fsc->write_congested = true;
ceph_wbc->fbatch.folios[i] = NULL;
ceph_wbc->len += folio_size(folio);
--
2.39.5
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-09-04 16:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-04 16:12 [PATCH 0/2] ceph: fix writeback congestion accounting Tal Zussman
2026-09-04 16:12 ` [PATCH 1/2] ceph: fix writeback_count leak when a bounce page allocation fails Tal Zussman
2026-09-04 16:12 ` [PATCH 2/2] ceph: don't clear write_congested when collecting folios Tal Zussman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®