Forced-threaded interrupt handlers pass the in_task() check in folio_end_dropbehind() but run with interrupts disabled on !PREEMPT_RT, and invalidating the folio turns them back on. ext4 RWF_DONTCACHE overwrites hit this with threadirqs until commit 7d7c9c83c822 ("ext4: complete dropbehind writeback in task context"), and folios marked dropbehind after their writeback was submitted still can. Skip the drop when interrupts are disabled. The folio stays cached, as it does when the completion runs in hardirq context. Fixes: ae21c0c0ac56 ("ext4: support uncached buffered I/O") Cc: stable@vger.kernel.org Signed-off-by: Usama Arif --- mm/filemap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index a49cca600f8c3e..6674c4ef8fe036 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -1663,9 +1663,10 @@ void folio_end_dropbehind(struct folio *folio) * but can happen if normal writeback just happens to find dirty folios * that were created as part of uncached writeback, and that writeback * would otherwise not need non-IRQ handling. Just skip the - * invalidation in that case. + * invalidation in that case, and also when interrupts are disabled, + * as they are in forced-threaded interrupt handlers. */ - if (in_task() && folio_trylock(folio)) { + if (in_task() && !irqs_disabled() && folio_trylock(folio)) { filemap_end_dropbehind(folio); folio_unlock(folio); } -- 2.53.1-Meta