mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: Charles Edward Lever <chucklever@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: Yet another borken page_count() check in invalidate_inode_pages2()....
Date: Wed, 15 Nov 2006 08:46:41 -0800	[thread overview]
Message-ID: <20061115084641.827494be.akpm@osdl.org> (raw)
In-Reply-To: <1163596689.5691.40.camel@lade.trondhjem.org>

On Wed, 15 Nov 2006 08:18:09 -0500
Trond Myklebust <Trond.Myklebust@netapp.com> wrote:

> The following patch allows try_to_release_page() to wait on page writeback
> instead of failing if the user specified __GFP_WAIT.
> 
> The reason is that when running NetApp's simulated I/O tool (sio_ntap) on
> the NFS client, I can currently reliably trigger the WARN_ON() in
> invalidate_inode_pages2().
> Whereas we do wait on page_writeback in invalidate_inode_pages2_range(), we
> do so before we unmap the page. There is still a race which will cause the
> call to try_to_release_page() to fail the test for PageWriteback(page).
> 
> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
> ---
> 
>  mm/filemap.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/mm/filemap.c b/mm/filemap.c
> index 7b84dc8..d37f77b 100644
> --- a/mm/filemap.c
> +++ b/mm/filemap.c
> @@ -2445,7 +2445,9 @@ int try_to_release_page(struct page *pag
>  	struct address_space * const mapping = page->mapping;
>  
>  	BUG_ON(!PageLocked(page));
> -	if (PageWriteback(page))
> +	if (gfp_mask & __GFP_WAIT)
> +		wait_on_page_writeback(page);
> +	else if (PageWriteback(page))
>  		return 0;
>  
>  	if (mapping && mapping->a_ops->releasepage)

The change probably makes sense.  Need to think about that a bit more and
review callers..

But I don't see how it can change invalidate_inode_pages2().  What we
would effectively have is: 

invalidate_inode_pages2_range()
{
	lock_page(page);
	wait_on_page_writeback(page);

	...

				
	wait_on_page_writeback(page);

but nobody could have started another writeback after the "..." because they
couldn't have got the lock_page(), and lock_page() is required for
->writepage()?



  reply	other threads:[~2006-11-15 16:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-15  5:33 Trond Myklebust
2006-11-15  5:42 ` Andrew Morton
2006-11-15 13:18 ` Trond Myklebust
2006-11-15 16:46   ` Andrew Morton [this message]
2006-11-15 18:05     ` Trond Myklebust
2006-11-15 19:24       ` Andrew Morton
2006-11-15 20:57         ` Trond Myklebust
2006-11-15 21:12           ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061115084641.827494be.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=Trond.Myklebust@netapp.com \
    --cc=chucklever@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®