提交 4c28f811 编写于 作者: C Christoph Lameter 提交者: Linus Torvalds

[PATCH] page migration: Fix fallback behavior for dirty pages

Currently we check PageDirty() in order to make the decision to swap out
the page.  However, the dirty information may be only be contained in the
ptes pointing to the page.  We need to first unmap the ptes before checking
for PageDirty().  If unmap is successful then the page count of the page
will also be decreased so that pageout() works properly.

This is a fix necessary for 2.6.17.  Without this fix we may migrate dirty
pages for filesystems without migration functions.  Filesystems may keep
pointers to dirty pages.  Migration of dirty pages can result in the
filesystem keeping pointers to freed pages.

Unmapping is currently not be separated out from removing all the
references to a page and moving the mapping.  Therefore try_to_unmap will
be called again in migrate_page() if the writeout is successful.  However,
it wont do anything since the ptes are already removed.

The coming updates to the page migration code will restructure the code
so that this is no longer necessary.
Signed-off-by: NChristoph Lameter <clameter@sgi.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 a4b741e3
......@@ -439,6 +439,17 @@ int migrate_pages(struct list_head *from, struct list_head *to,
goto unlock_both;
}
/* Make sure the dirty bit is up to date */
if (try_to_unmap(page, 1) == SWAP_FAIL) {
rc = -EPERM;
goto unlock_both;
}
if (page_mapcount(page)) {
rc = -EAGAIN;
goto unlock_both;
}
/*
* Default handling if a filesystem does not provide
* a migration function. We can only migrate clean
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册