Commit 59ddc721 authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Linus Torvalds

[PATCH] populate nonlinear mappings unconditionally

filemap_populate and shmem_populate must install even a linear file_pte,
in case there was a nonlinear page or file_pte already installed there:
could only happen if already VM_NONLINEAR, but no need to check that.

Acked by Ingo and Hugh.
Signed-off-by: default avatarHugh Dickins <hugh@veritas.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ee886bb8
...@@ -1421,16 +1421,10 @@ static int filemap_populate(struct vm_area_struct *vma, ...@@ -1421,16 +1421,10 @@ static int filemap_populate(struct vm_area_struct *vma,
return err; return err;
} }
} else { } else {
/*
* If a nonlinear mapping then store the file page offset
* in the pte.
*/
if (pgoff != linear_page_index(vma, addr)) {
err = install_file_pte(mm, vma, addr, pgoff, prot); err = install_file_pte(mm, vma, addr, pgoff, prot);
if (err) if (err)
return err; return err;
} }
}
len -= PAGE_SIZE; len -= PAGE_SIZE;
addr += PAGE_SIZE; addr += PAGE_SIZE;
......
...@@ -1121,16 +1121,10 @@ static int shmem_populate(struct vm_area_struct *vma, ...@@ -1121,16 +1121,10 @@ static int shmem_populate(struct vm_area_struct *vma,
return err; return err;
} }
} else if (nonblock) { } else if (nonblock) {
/*
* If a nonlinear mapping then store the file page
* offset in the pte.
*/
if (pgoff != linear_page_index(vma, addr)) {
err = install_file_pte(mm, vma, addr, pgoff, prot); err = install_file_pte(mm, vma, addr, pgoff, prot);
if (err) if (err)
return err; return err;
} }
}
len -= PAGE_SIZE; len -= PAGE_SIZE;
addr += PAGE_SIZE; addr += PAGE_SIZE;
......
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