From: Hugh Dickins My recent mm patch to give pte_ERROR in do_file_page unless VM_NONLINEAR was incorrect. I was forgetting Oleg's patch to the populate functions, which forces install_file_pte when MAP_POPULATE + MAP_NONBLOCK but page not in cache (in case an existing nonlinear entry needs removing). But that's only necessary in the VM_NONLINEAR case: let's keep the strict check in do_file_page, and adjust filemap_populate and shmem_populate. Signed-off-by: Hugh Dickins Signed-off-by: Andrew Morton --- mm/filemap.c | 2 +- mm/shmem.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff -puN mm/filemap.c~mm-page-fault-handlers-tidyup-fix mm/filemap.c --- devel/mm/filemap.c~mm-page-fault-handlers-tidyup-fix 2005-10-11 00:34:33.000000000 -0700 +++ devel-akpm/mm/filemap.c 2005-10-11 00:34:33.000000000 -0700 @@ -1520,7 +1520,7 @@ repeat: page_cache_release(page); return err; } - } else { + } else if (vma->vm_flags & VM_NONLINEAR) { /* No page was found just because we can't read it in now (being * here implies nonblock != 0), but the page may exist, so set * the PTE to fault it in later. */ diff -puN mm/shmem.c~mm-page-fault-handlers-tidyup-fix mm/shmem.c --- devel/mm/shmem.c~mm-page-fault-handlers-tidyup-fix 2005-10-11 00:34:33.000000000 -0700 +++ devel-akpm/mm/shmem.c 2005-10-11 00:34:33.000000000 -0700 @@ -1201,7 +1201,7 @@ static int shmem_populate(struct vm_area page_cache_release(page); return err; } - } else { + } else if (vma->vm_flags & VM_NONLINEAR) { /* No page was found just because we can't read it in * now (being here implies nonblock != 0), but the page * may exist, so set the PTE to fault it in later. */ _