Re: invalidate_inode_pages2

From: Andrew Morton
Date: Tue May 18 2004 - 19:25:56 EST


Andrea Arcangeli <andrea@xxxxxxx> wrote:
>
> Something broke in invalidate_inode_pages2 between 2.4 and 2.6, this
> causes malfunctions with mapped pages in 2.6.

What is the malfunction?

> I guess the below untested one liner should be enough to fix it. The
> only single point of invalidate_inode_pages2, is to invalidate _mapped_
> pages too. Otherwise we could as well use invalidate_inode_pages.
> Clearly the dirty bit doesn't mean invalidate, invalidate primarly means
> clearing the uptodate bitflag.
>
> --- sles/mm/truncate.c.~1~ 2004-05-18 19:24:40.000000000 +0200
> +++ sles/mm/truncate.c 2004-05-19 02:09:28.311781864 +0200
> @@ -260,9 +260,10 @@ void invalidate_inode_pages2(struct addr
> if (page->mapping == mapping) { /* truncate race? */
> wait_on_page_writeback(page);
> next = page->index + 1;
> - if (page_mapped(page))
> + if (page_mapped(page)) {
> + ClearPageUptodate(page);
> clear_page_dirty(page);
> - else
> + } else
> invalidate_complete_page(mapping, page);
> }
> unlock_page(page);

It's currently the case that pages which are mapped into process pagetables
are always up to date, which sounds like a good invariant to have. This
changes that rule. I dunno if it'll break anything though.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/