[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070119163030.GA12507@localhost.sw.ru>
Date: Fri, 19 Jan 2007 19:30:30 +0300
From: Alexey Dobriyan <adobriyan@...nvz.org>
To: akpm@...l.org
Cc: Alexey Kuznetsov <kuznet@....inr.ac.ru>,
linux-kernel@...r.kernel.org
Subject: [PATCH] Don't map random pages if swapoff errors
From: Alexey Kuznetsov <kuznet@....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@....inr.ac.ru>
Signed-off-by: Alexey Dobriyan <adobriyan@...nvz.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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists