diff --git a/fs/nilfs2/page.c b/fs/nilfs2/page.c index 879fa86..0797458 100644 --- a/fs/nilfs2/page.c +++ b/fs/nilfs2/page.c @@ -427,7 +427,15 @@ void nilfs_clear_dirty_pages(struct address_space *mapping, bool silent) struct page *page = pvec.pages[i]; lock_page(page); - nilfs_clear_dirty_page(page, silent); + + /* + * This page may have been removed from the address + * space by truncation or invalidation when the lock + * was acquired. Skip processing in that case. + */ + if (likely(page->mapping == mapping)) + nilfs_clear_dirty_page(page, silent); + unlock_page(page); } pagevec_release(&pvec);