When a page fault occurs on a file-backed mapping for a page that was previously in the page cache but has later been evicted, the fault handler calls pagecache_map_page_if_filled(), which should return false because the newly re-allocated page has not been filled yet. Commit 132a832e79c8a50fd9f5d47b0661fd3295b8605f introduced a regression which causes pagecache_map_page_if_filled() to return true instead; this leads to page cache contents inconsistent with file contents and erroneous data accessed by the user program via the file-backed mapping.
This change fixes the above issue by amending the touch_or_fill_page_nodelocked() function so that it returns false when the relevant page is in the ALLOC state.
When a page fault occurs on a file-backed mapping for a page that was previously in the page cache but has later been evicted, the fault handler calls pagecache_map_page_if_filled(), which should return
false
because the newly re-allocated page has not been filled yet. Commit 132a832e79c8a50fd9f5d47b0661fd3295b8605f introduced a regression which causes pagecache_map_page_if_filled() to returntrue
instead; this leads to page cache contents inconsistent with file contents and erroneous data accessed by the user program via the file-backed mapping. This change fixes the above issue by amending the touch_or_fill_page_nodelocked() function so that it returnsfalse
when the relevant page is in the ALLOC state.