Commit 6ad38b90 authored by Linus Torvalds's avatar Linus Torvalds

Make "install_page()" able to handle truncated pages.

This makes it much easier on the callers, no need to
worry about races with vmtruncate() and friends, since
"install_page()" will just cleanly handle that case
and tell the caller about it.
parent 23a43a63
......@@ -61,12 +61,6 @@ int install_page(struct mm_struct *mm, struct vm_area_struct *vma,
pmd_t *pmd;
pte_t pte_val;
/*
* We use page_add_file_rmap below: if install_page is
* ever extended to anonymous pages, this will warn us.
*/
BUG_ON(!page_mapping(page));
pgd = pgd_offset(mm, addr);
spin_lock(&mm->page_table_lock);
......@@ -78,6 +72,14 @@ int install_page(struct mm_struct *mm, struct vm_area_struct *vma,
if (!pte)
goto err_unlock;
/*
* This page may have been truncated. Tell the
* caller about it.
*/
err = -EAGAIN;
if (!page_mapping(page))
goto err_unlock;
zap_pte(mm, vma, addr, pte);
mm->rss++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment