lkml.org 
[lkml]   [1999]   [May]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: 2.2.9 hangs in truncate_inode_pages
Hi,

On Sun, 30 May 1999 10:05:09 -0700 (PDT), Linus Torvalds
<torvalds@transmeta.com> said:

>> 2. __wait_on_page says you are supposed to own the page before waiting
>> on it (ie up page->count). I don't see where we do that. We even
>> go back to the start to allow for the pages on the inode changing
>> if we sleep but we don't up the count ourselves.

> This may be the real offender - I think you found a real bug, and it looks
> extremely hard to trigger, but it looks like it has been there from the
> very first version.

I can't see how it will be a problem. It's not like a buffer_head: the
struct page is static, so the wait queue and the flags will certainly be
valid even after page reuse. The page locked flag is only set during
IO, so we guarantee that if a page becomes locked, it will become
unlocked some time in the future and will deliver a wakeup to the page
at that point.

It doesn't matter if we end up waiting for the wrong page by mistake: as
long as we don't expect the same page to be there on wakeup, we should
be fine. In truncate_inode_pages(), we do

if (PageLocked(page)) {
wait_on_page(page);
goto repeat;
}

which looks safe enough from this respect.

> The "goto repeat" is actually _trying_ to fix exactly the same bug:
> because we sleep, we can't rely on the list being the same any more, so we
> have to start anew from the beginning. But it misses the fact that you
> can't even rely on the _one_ page being there unless you increment the
> page count for it.

We can't rely on the page being used for this inode, but we can rely on
the struct page being there, and I think that is all that counts here.

--Stephen

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

\
 
 \ /
  Last update: 2005-03-22 13:52    [W:0.571 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site