linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: shmem: unlock valid page
@ 2012-03-04  5:17 Hillf Danton
  2012-03-04 17:51 ` Hugh Dickins
  0 siblings, 1 reply; 3+ messages in thread
From: Hillf Danton @ 2012-03-04  5:17 UTC (permalink / raw)
  To: Linux-MM; +Cc: Hugh Dickins, Andrew Morton, LKML, Hillf Danton

In shmem_read_mapping_page_gfp() page is unlocked if no error returned,
so the unlocked page has to valid.

To guarantee that validity, when getting page, success result is feed
back to caller only when page is valid.

Signed-off-by: Hillf Danton <dhillf@gmail.com>
---

--- a/mm/shmem.c	Sun Mar  4 12:17:42 2012
+++ b/mm/shmem.c	Sun Mar  4 12:26:56 2012
@@ -889,13 +889,13 @@ repeat:
 		goto failed;
 	}

-	if (page || (sgp == SGP_READ && !swap.val)) {
+	if (page) {
 		/*
 		 * Once we can get the page lock, it must be uptodate:
 		 * if there were an error in reading back from swap,
 		 * the page would not be inserted into the filecache.
 		 */
-		BUG_ON(page && !PageUptodate(page));
+		BUG_ON(!PageUptodate(page));
 		*pagep = page;
 		return 0;
 	}
--

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-03-05 12:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-04  5:17 [PATCH] mm: shmem: unlock valid page Hillf Danton
2012-03-04 17:51 ` Hugh Dickins
2012-03-05 12:15   ` Hillf Danton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox