public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Don't map random pages if swapoff errors
@ 2007-01-19 16:30 Alexey Dobriyan
  2007-01-19 18:08 ` Hugh Dickins
  0 siblings, 1 reply; 3+ messages in thread
From: Alexey Dobriyan @ 2007-01-19 16:30 UTC (permalink / raw)
  To: akpm; +Cc: Alexey Kuznetsov, linux-kernel

From: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>

If read failed we cannot map not-uptodate page to user space.
Actually, we are in serious troubles, we do not even know what
process to kill. So, the only variant remains: to stop swapoff()
and allow someone to kill processes to zap invalid pages.

Signed-off-by: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Signed-off-by: Alexey Dobriyan <adobriyan@openvz.org>
---

 mm/swapfile.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)

--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -766,6 +766,19 @@ static int try_to_unuse(unsigned int typ
 		lock_page(page);
 		wait_on_page_writeback(page);
 
+		/* If read failed we cannot map not-uptodate page to
+		 * user space. Actually, we are in serious troubles,
+		 * we do not even know what process to kill. So, the only
+		 * variant remains: to stop swapoff() and allow someone
+		 * to kill processes to zap invalid pages.
+		 */
+		if (unlikely(!PageUptodate(page))) {
+			unlock_page(page);
+			page_cache_release(page);
+			retval = -EIO;
+			break;
+		}
+
 		/*
 		 * Remove all references to entry.
 		 * Whenever we reach init_mm, there's no address space


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

end of thread, other threads:[~2007-01-19 20:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-19 16:30 [PATCH] Don't map random pages if swapoff errors Alexey Dobriyan
2007-01-19 18:08 ` Hugh Dickins
2007-01-19 19:16   ` Alexey Kuznetsov

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