From: Paolo 'Blaisorblade' Giarrusso <[email protected]>
Either shmem_getpage returns a failure, or it found a page, or it was told it
couldn't do any I/O. So it's useless to check nonblock in the else branch. We
could add a BUG() there but I preferred to comment the offending function.
This was taken out from one Ingo Molnar's old patch I'm resurrecting.
References: commit b103e8b204b317d52834671d5f09db95645523c2 of old-2.6-bkcvs,
pointing to BKrev: 3f5ed0c1llm6NnNwNXtPv-Z0IYzkwA
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <[email protected]>
---
linux-2.6.git-paolo/mm/filemap.c | 7 +++++++
linux-2.6.git-paolo/mm/shmem.c | 6 +++++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff -puN mm/shmem.c~mm-populate-optim-comment mm/shmem.c
--- linux-2.6.git/mm/shmem.c~mm-populate-optim-comment 2005-08-11 11:12:39.000000000 +0200
+++ linux-2.6.git-paolo/mm/shmem.c 2005-08-11 11:12:39.000000000 +0200
@@ -1195,6 +1195,7 @@ static int shmem_populate(struct vm_area
err = shmem_getpage(inode, pgoff, &page, sgp, NULL);
if (err)
return err;
+ /* Page may still be null, but only if nonblock was set. */
if (page) {
mark_page_accessed(page);
err = install_page(mm, vma, addr, page, prot);
@@ -1202,7 +1203,10 @@ static int shmem_populate(struct vm_area
page_cache_release(page);
return err;
}
- } else if (nonblock) {
+ } else {
+ /* 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. */
err = install_file_pte(mm, vma, addr, pgoff, prot);
if (err)
return err;
diff -puN mm/filemap.c~mm-populate-optim-comment mm/filemap.c
--- linux-2.6.git/mm/filemap.c~mm-populate-optim-comment 2005-08-11 11:12:39.000000000 +0200
+++ linux-2.6.git-paolo/mm/filemap.c 2005-08-11 11:12:39.000000000 +0200
@@ -1505,8 +1505,12 @@ repeat:
return -EINVAL;
page = filemap_getpage(file, pgoff, nonblock);
+
+ /* XXX: This is wrong, a filesystem I/O error may have happened. Fix that as
+ * done in shmem_populate calling shmem_getpage */
if (!page && !nonblock)
return -ENOMEM;
+
if (page) {
err = install_page(mm, vma, addr, page, prot);
if (err) {
@@ -1514,6 +1518,9 @@ repeat:
return err;
}
} else {
+ /* 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. */
err = install_file_pte(mm, vma, addr, pgoff, prot);
if (err)
return err;
_
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
|
|