aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2004-07-22 04:38:29 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-07-22 04:38:29 -0700
commit6ad38b905d0b5b488d01d4ef3980bd9c1d398019 (patch)
tree129a45fa6f39bb8786fb71fba1c27a228fce3c62 /mm
parent23a43a63efb6d6b822043dc58a60cba2335b8924 (diff)
downloadhistory-6ad38b905d0b5b488d01d4ef3980bd9c1d398019.tar.gz
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.
Diffstat (limited to 'mm')
-rw-r--r--mm/fremap.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/mm/fremap.c b/mm/fremap.c
index e10dcea9791373..f5c8b64ffb711f 100644
--- a/mm/fremap.c
+++ b/mm/fremap.c
@@ -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++;