Re: writepages drops bh on not uptodate page

From: Andrea Arcangeli
Date: Wed Jul 28 2004 - 08:47:48 EST


On Wed, Jul 28, 2004 at 09:03:39AM -0400, Chris Mason wrote:
> Ahhhh, this really explains it, thanks andrea. I agree your fix should
> solve things, but I'm wondering if we shouldn't make readpage[s] do a
> wait_on_page_writeback(). That might do a better job of protecting us
> from future variations of this problem.

the invariant is that not-fully-uptodate pages needs the bh on them
while they're under writeback. As far as this holds true, there seems
not to be other issues since readpage checks the bh, and readpages don't
need to check for anything since it only does I/O on newly allocated
pages (which cannot be under writeback). try_to_free_buffers doesn't
allow the bh to go away under writeback.

So the other approach would be to wait_on_page_writeback before a
->readpage (not ->readpages), if we're not in a add_to_page_cache case
(where we know the page cannot be under writeback). But that looks less
efficient and we don't need that as long as we don't break the above
invariant. Though I certainly agree that adding the
wait_on_page_writeback in the highlevel code that goes to call readpage
would have fixed the bug too.
-
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/