]> git.baikalelectronics.ru Git - kernel.git/commit
filemap: Don't release a locked folio
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Tue, 7 Jun 2022 19:45:53 +0000 (15:45 -0400)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Thu, 9 Jun 2022 20:24:25 +0000 (16:24 -0400)
commit00704560ec43d457b13aca3e0953d3b9d84f921f
treeed0e4594baaf65b943a2a522ebcba63bcc4e69f4
parent6f754e91eeed9677839ef0b5476b7249f82aecb0
filemap: Don't release a locked folio

We must hold a reference over the call to filemap_release_folio(),
otherwise the page cache will put the last reference to the folio
before we unlock it, leading to splats like this:

 BUG: Bad page state in process u8:5  pfn:1ab1f4
 page:ffffea0006ac7d00 refcount:0 mapcount:0 mapping:0000000000000000 index:0x28b1de pfn:0x1ab1f4
 flags: 0x17ff80000040001(locked|reclaim|node=0|zone=2|lastcpupid=0xfff)
 raw: 017ff80000040001 dead000000000100 dead000000000122 0000000000000000
 raw: 000000000028b1de 0000000000000000 00000000ffffffff 0000000000000000
 page dumped because: PAGE_FLAGS_CHECK_AT_FREE flag(s) set

It's an error path, so it doesn't see much testing.

Reported-by: Darrick J. Wong <djwong@kernel.org>
Fixes: ca2caef9893d ("readahead: Use a folio in read_pages()")
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
mm/readahead.c