Re: filemap_nopage() tries to copy to page 0, eek.

Chuck Lever (cel@monkey.org)
Wed, 11 Aug 1999 16:32:14 -0400 (EDT)


the way i have fixed this is to strip out everything in the no_cached_page
branch of filemap_nopage except for the first few lines that implement the
cluster read. just after the cluster read, use "goto retry_find;".

so do this:

no_cached_page:
/*
* Try to read in an entire cluster at once.
*/
...
for (i = 1 << page_cluster; i > 0; --i, reada += PAGE_CACHE_SIZE)
new_page = try_to_read_ahead(file, reada, new_page);

goto retry_find;

page_not_uptodate:

...

On Tue, 10 Aug 1999, Steve Dodd wrote:
> I've just been chasing down the problem with writes to mmap()d areas hanging,
> and it turns out that filemap_nopage() will try to clobber page 0 if the
> page isn't found in the page cache and no_share is true:
>
> no_cached_page:
> .
> .
> .
> /*
> * Now it's ours and locked, we can do initial IO to it:
> */
> new_page = 0;
>
> page_not_uptodate:
> error = inode->i_op->readpage(file, page);
> if (!error) {
> wait_on_page(page);
> if (PageError(page))
> goto page_read_error;
> goto success;
> }
>
> success:
> old_page = page_address(page);
> if (!no_share) {
> ...
> }
>
> /*
> * No sharing ... copy to the new page.
> */
> if (!new_page)
> printk(KERN_CRIT "filemap_nopage(): erk, new_page == 0\n");
> copy_page(new_page, old_page);
>
> I don't claim to understand (yet) what the fix is; I'm also not on clear why
> the page fault handler just tries to re-enter itself, ultimately deadlocking
> on current->mm->mmap_sem -- does it show that I'm /way/ out of my depth
> here? ;-)

- Chuck Lever

--
corporate:	<chuckl@netscape.com>
personal:	<chucklever@netscape.net> or <cel@monkey.org>

The Linux Scalability project: http://www.citi.umich.edu/projects/linux-scalability/

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