Memory migration might be rolled back during file truncation. In this case these pages must be checked whether it has happened. Signed-off-by: Hirokazu Takahashi Signed-off-by: Dave Hansen --- memhotplug-dave/mm/truncate.c | 13 +++++++++++++ 1 files changed, 13 insertions(+) diff -puN mm/truncate.c~AA-PM-11.0-migrate-truncate mm/truncate.c --- memhotplug/mm/truncate.c~AA-PM-11.0-migrate-truncate 2005-07-28 13:50:40.000000000 -0700 +++ memhotplug-dave/mm/truncate.c 2005-07-28 13:50:40.000000000 -0700 @@ -140,6 +140,9 @@ void truncate_inode_pages(struct address unlock_page(page); continue; } + /* page->mapping check is done in + * truncate_complete_page() when the page has been + * migrated. */ truncate_complete_page(mapping, page); unlock_page(page); } @@ -170,6 +173,16 @@ void truncate_inode_pages(struct address struct page *page = pvec.pages[i]; lock_page(page); + if (page->mapping == NULL) { + struct page *newpage; + unlock_page(page); + if ((newpage = find_lock_page(mapping, page->index))) { + /* memory migration has been rolled back. */ + page_cache_release(page); + pvec.pages[i] = page = newpage; + } else + lock_page(page); + } wait_on_page_writeback(page); if (page->index > next) next = page->index; _