Re: [PATCH 11/12] vmscan: Write out dirty pages in batch

From: Nick Piggin
Date: Tue Jun 15 2010 - 07:13:48 EST


On Tue, Jun 15, 2010 at 06:53:41AM -0400, Christoph Hellwig wrote:
> > + /*
> > + * XXX: This is the Holy Hand Grenade of PotentiallyInvalidMapping. As
> > + * the page lock has been dropped by ->writepage, that mapping could
> > + * be anything
> > + */
>
> Why is this an XXX comment?

It's just a pretty simple use-after-free. Maybe people forget it because
->writepage is an asynchronous API.


> > + *
> > + * XXX: Is there a problem with holding multiple page locks like this?
>
> I think there is. There's quite a few places that do hold multiple
> pages locked, but they always lock pages in increasing page->inxex order.
> Given that this locks basically in random order it could cause problems
> for those places.

There shouldn't be a problem _holding_ the locks, but there is a problem
waiting for multiple locks out of page->index order.

But there is a problem with holding the lock of a lot of pages while
calling ->writepage on them. So yeah, you can't do that.

Hmm, I should rediff that lockdep page_lock patch and get it merged.
(although I don't know if that can catch these all these problems easily)

--
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/