OpenAFS Master Repository branch, openafs-stable-1_8_x, updated. openafs-stable-1_8_15-5-gc1c2307
Gerrit Code Review
gerrit@openafs.org
Thu, 26 Mar 2026 12:07:00 -0400
The following commit has been merged in the openafs-stable-1_8_x branch:
commit c1c2307bc74840af646570f2b84f265e125bf459
Author: Andrew Deason <adeason@sinenomine.net>
Date: Fri Feb 20 13:46:19 2026 -0600
LINUX: Log warning on recursive folio writeback
Since commit 4a587356a3 (linux-mmap-antirecursion-20081020) our page
writeback functions have returned AOP_WRITEPAGE_ACTIVATE when detecting
a recursive writeback request (afs_linux_writepage_sync() at the time,
now afs_linux_prepare_writeback()). At the time, the recursion was noted
as following this code path:
afs_linux_writepage_sync -> afs_DoPartialWrite -> afs_StoreAllSegments
-> osi_VM_StoreAllSegments -> filemap_fdatawrite -> [writeback]
Since commit 5e0e1ea254 (linux-mmap-antirecursion-fix-20090512), the
vcache was flaged as "in writeback" in afs_linux_writepage_sync()
itself, rather than in osi_VM_StoreAllSegments(). But checks to avoid
recursive calls were effectively in both afs_linux_writepage_sync()
(which returned AOP_WRITEPAGE_ACTIVATE) and osi_VM_StoreAllSegments()
(which just skipped the writeback).
Later, in commit 95b857399d (Linux: mmap: Apply recursion check only to
recursion cases), the check was restricted to catch only actual
recursion, so writeback in different processes didn't trigger this.
Since then, it's not clear if afs_linux_prepare_writeback() ever
actually catches the recursion case and returns AOP_WRITEPAGE_ACTIVATE.
With the current code, the above recursion code path now looks like
this:
afs_linux_end_writeback -> afs_linux_dopartialwrite ->
afs_DoPartialWrite -> afs_StoreAllSegments -> osi_VM_StoreAllSegments ->
filemap_fdatawrite -> [writeback]
But now it shouldn't be possible for osi_VM_StoreAllSegments() to
recurse into writeback, since avc->pagewriters will be non-empty when we
call it from afs_linux_end_writeback(), and so osi_VM_StoreAllSegments()
will return early. Handling the errors for this recursion is a strange,
questionably-handled corner case in the page handling code for modern
Linux with folios, so it would be nice to remove the
AOP_WRITEPAGE_ACTIVATE code paths if they're not needed.
However, it's hard to be sure there aren't other code paths that can
also trigger similar recursion deadlocks. So for now, log a message with
a stack trace when it happens, so we can try to do something about it if
the log message is actually seen.
Reviewed-on: https://gerrit.openafs.org/16697
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
(cherry picked from commit 1b3b3bc08e36ab5e0ee69e725d9834bfdeb4a4d8)
Change-Id: I25d8518a70d1d51c37c9d6e5232bea327d437122
Reviewed-on: https://gerrit.openafs.org/16705
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
src/afs/LINUX/osi_vnodeops.c | 7 +++++++
1 file changed, 7 insertions(+)
--
OpenAFS Master Repository