Skip to content

Commit 960ea97

Browse files
author
Matthew Wilcox (Oracle)
committed
filemap: Use a folio in filemap_page_mkwrite
This fixes a bug for tail pages. They always have a NULL mapping, so the check would fail and we would never mark the folio as dirty. Ends up growing the kernel by 19 bytes although there will be fewer calls to compound_head() dynamically. Signed-off-by: Matthew Wilcox (Oracle) <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: William Kucharski <[email protected]>
1 parent 820b05e commit 960ea97

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

mm/filemap.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3349,24 +3349,24 @@ EXPORT_SYMBOL(filemap_map_pages);
33493349
vm_fault_t filemap_page_mkwrite(struct vm_fault *vmf)
33503350
{
33513351
struct address_space *mapping = vmf->vma->vm_file->f_mapping;
3352-
struct page *page = vmf->page;
3352+
struct folio *folio = page_folio(vmf->page);
33533353
vm_fault_t ret = VM_FAULT_LOCKED;
33543354

33553355
sb_start_pagefault(mapping->host->i_sb);
33563356
file_update_time(vmf->vma->vm_file);
3357-
lock_page(page);
3358-
if (page->mapping != mapping) {
3359-
unlock_page(page);
3357+
folio_lock(folio);
3358+
if (folio->mapping != mapping) {
3359+
folio_unlock(folio);
33603360
ret = VM_FAULT_NOPAGE;
33613361
goto out;
33623362
}
33633363
/*
3364-
* We mark the page dirty already here so that when freeze is in
3364+
* We mark the folio dirty already here so that when freeze is in
33653365
* progress, we are guaranteed that writeback during freezing will
3366-
* see the dirty page and writeprotect it again.
3366+
* see the dirty folio and writeprotect it again.
33673367
*/
3368-
set_page_dirty(page);
3369-
wait_for_stable_page(page);
3368+
folio_mark_dirty(folio);
3369+
folio_wait_stable(folio);
33703370
out:
33713371
sb_end_pagefault(mapping->host->i_sb);
33723372
return ret;

0 commit comments

Comments
 (0)