From: Alexey Dobriyan <adobriyan@openvz.org>
To: akpm@osdl.org
Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>, linux-kernel@vger.kernel.org
Subject: [PATCH] Don't map random pages if swapoff errors
Date: Fri, 19 Jan 2007 19:30:30 +0300 [thread overview]
Message-ID: <20070119163030.GA12507@localhost.sw.ru> (raw)
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
next reply other threads:[~2007-01-19 16:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-19 16:30 Alexey Dobriyan [this message]
2007-01-19 18:08 ` [PATCH] Don't map random pages if swapoff errors Hugh Dickins
2007-01-19 19:16 ` Alexey Kuznetsov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070119163030.GA12507@localhost.sw.ru \
--to=adobriyan@openvz.org \
--cc=akpm@osdl.org \
--cc=kuznet@ms2.inr.ac.ru \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox