Re: [PATCH v2 1/2] mm/memory: recheck PG_uptodate after ->page_mkwrite()

From: Matthew Wilcox

Date: Mon Nov 09 2026 - 15:33:34 EST


On Mon, Nov 09, 2026 at 12:04:01PM +0000, Kiryl Shutsemau (Meta) wrote:
> do_shared_fault() unlocks the folio around ->page_mkwrite(). Writeback
> can lock it in that window, fail, and clear PG_uptodate with the folio
> left in the page cache. ecryptfs_writepages() does this when encryption
> fails. filemap_page_mkwrite() relocks the folio and checks only
> ->mapping, so the fault maps a folio that is not uptodate:

Filesystems that do this are buggy. They shuld be fixed, not worked
around like this.