patch-pre2.0.7 linux/mm/filemap.c

Next file: linux/net/appletalk/ddp.c
Previous file: linux/kernel/module.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file pre2.0.6/linux/mm/filemap.c linux/mm/filemap.c
@@ -745,7 +745,7 @@
 	if (page)
 		goto found_page;
 	if (!new_page)
-		return 0;
+		goto failure;
 	page = mem_map + MAP_NR(new_page);
 	new_page = 0;
 	add_to_page_cache(page, inode, offset);
@@ -757,7 +757,20 @@
 		free_page(new_page);
 found_page_dont_free:
 	wait_on_page(page);
-	return page_address(page);
+	if (PageUptodate(page)) {
+success:	
+		return page_address(page);
+	}
+	/* If not marked as error, try _once_ to read it again */
+	if (!PageError(page)) {
+		inode->i_op->readpage(inode, page);
+		wait_on_page(page);
+		if (PageUptodate(page))
+			goto success;
+	}
+	page->count--;
+failure:
+	return 0;
 }
 
 /*

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this