All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Nick Piggin <npiggin@suse.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Hugh Dickins <hugh@veritas.com>,
	Linux Kernel <linux-kernel@vger.kernel.org>,
	Linux Memory Management <linux-mm@kvack.org>,
	Linux Filesystems <linux-fsdevel@vger.kernel.org>
Subject: Re: [patch 2/3] fs: buffer don't PageUptodate without page locked
Date: Tue, 6 Feb 2007 00:21:40 -0800	[thread overview]
Message-ID: <20070206002140.4030a11f.akpm@linux-foundation.org> (raw)
In-Reply-To: <20070206054947.21042.32493.sendpatchset@linux.site>

On Tue,  6 Feb 2007 09:02:23 +0100 (CET) Nick Piggin <npiggin@suse.de> wrote:

> __block_write_full_page is calling SetPageUptodate without the page locked.
> This is unusual, but not incorrect, as PG_writeback is still set.
> 
> However with the previous patch, this is now a problem: so don't bother
> setting the page uptodate in this case (it is weird that the write path
> does such a thing anyway). Instead just leave it to the read side to bring
> the page uptodate when it notices that all buffers are uptodate.
> 
> Signed-off-by: Nick Piggin <npiggin@suse.de>
> 
> Index: linux-2.6/fs/buffer.c
> ===================================================================
> --- linux-2.6.orig/fs/buffer.c
> +++ linux-2.6/fs/buffer.c
> @@ -1679,6 +1679,7 @@ static int __block_write_full_page(struc
>  	 */
>  	BUG_ON(PageWriteback(page));
>  	set_page_writeback(page);
> +	unlock_page(page);
>  
>  	do {
>  		struct buffer_head *next = bh->b_this_page;
> @@ -1688,7 +1689,6 @@ static int __block_write_full_page(struc
>  		}
>  		bh = next;
>  	} while (bh != head);
> -	unlock_page(page);
>  
>  	err = 0;
>  done:

Why this change?  Without looking at it too hard, it seems that if
submit_bh() completes synchronously, this thread can end up playing with
the buffers on a non-locked, non-PageWriteback page.  Someone else could
whip the buffers away and oops?


WARNING: multiple messages have this Message-ID (diff)
From: Andrew Morton <akpm@linux-foundation.org>
To: Nick Piggin <npiggin@suse.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Hugh Dickins <hugh@veritas.com>,
	Linux Kernel <linux-kernel@vger.kernel.org>,
	Linux Memory Management <linux-mm@kvack.org>,
	Linux Filesystems <linux-fsdevel@vger.kernel.org>
Subject: Re: [patch 2/3] fs: buffer don't PageUptodate without page locked
Date: Tue, 6 Feb 2007 00:21:40 -0800	[thread overview]
Message-ID: <20070206002140.4030a11f.akpm@linux-foundation.org> (raw)
In-Reply-To: <20070206054947.21042.32493.sendpatchset@linux.site>

On Tue,  6 Feb 2007 09:02:23 +0100 (CET) Nick Piggin <npiggin@suse.de> wrote:

> __block_write_full_page is calling SetPageUptodate without the page locked.
> This is unusual, but not incorrect, as PG_writeback is still set.
> 
> However with the previous patch, this is now a problem: so don't bother
> setting the page uptodate in this case (it is weird that the write path
> does such a thing anyway). Instead just leave it to the read side to bring
> the page uptodate when it notices that all buffers are uptodate.
> 
> Signed-off-by: Nick Piggin <npiggin@suse.de>
> 
> Index: linux-2.6/fs/buffer.c
> ===================================================================
> --- linux-2.6.orig/fs/buffer.c
> +++ linux-2.6/fs/buffer.c
> @@ -1679,6 +1679,7 @@ static int __block_write_full_page(struc
>  	 */
>  	BUG_ON(PageWriteback(page));
>  	set_page_writeback(page);
> +	unlock_page(page);
>  
>  	do {
>  		struct buffer_head *next = bh->b_this_page;
> @@ -1688,7 +1689,6 @@ static int __block_write_full_page(struc
>  		}
>  		bh = next;
>  	} while (bh != head);
> -	unlock_page(page);
>  
>  	err = 0;
>  done:

Why this change?  Without looking at it too hard, it seems that if
submit_bh() completes synchronously, this thread can end up playing with
the buffers on a non-locked, non-PageWriteback page.  Someone else could
whip the buffers away and oops?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2007-02-06  8:21 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-06  8:02 [patch 0/3] 2.6.20 fix for PageUptodate memorder problem Nick Piggin
2007-02-06  8:02 ` Nick Piggin
2007-02-06  8:02 ` [patch 1/3] mm: fix PageUptodate memorder Nick Piggin
2007-02-06  8:02   ` Nick Piggin
2007-02-06  8:25   ` Andrew Morton
2007-02-06  8:25     ` Andrew Morton
2007-02-06  8:51     ` Nick Piggin
2007-02-06  8:51       ` Nick Piggin
2007-02-06  8:02 ` [patch 2/3] fs: buffer don't PageUptodate without page locked Nick Piggin
2007-02-06  8:02   ` Nick Piggin
2007-02-06  8:21   ` Andrew Morton [this message]
2007-02-06  8:21     ` Andrew Morton
2007-02-06  8:31     ` Nick Piggin
2007-02-06  8:31       ` Nick Piggin
2007-02-06  8:02 ` [patch 3/3] mm: make read_cache_page synchronous Nick Piggin
2007-02-06  8:02   ` Nick Piggin
2007-02-06  8:28   ` Andrew Morton
2007-02-06  8:28     ` Andrew Morton
2007-02-06  8:56     ` Nick Piggin
2007-02-06  8:56       ` Nick Piggin
2007-02-06  8:58     ` Nick Piggin
2007-02-06  8:58       ` Nick Piggin
2007-02-06 22:58 ` [patch 0/3] 2.6.20 fix for PageUptodate memorder problem David Chinner
2007-02-06 22:58   ` David Chinner
2007-02-07  3:13   ` Nick Piggin
2007-02-07  3:13     ` Nick Piggin
  -- strict thread matches above, loose matches on Subject: below --
2007-02-08 13:26 [patch 0/3] 2.6.20 fix for PageUptodate memorder problem (try 2) Nick Piggin
2007-02-08 13:27 ` [patch 2/3] fs: buffer don't PageUptodate without page locked Nick Piggin
2007-02-08 13:27   ` Nick Piggin
2007-02-10  2:31 [patch 0/3] 2.6.20 fix for PageUptodate memorder problem (try 3) Nick Piggin
2007-02-10  2:31 ` [patch 2/3] fs: buffer don't PageUptodate without page locked Nick Piggin
2007-02-10  2:31   ` Nick Piggin
2007-02-15  7:31 [patch 0/3] 2.6.20 fix for PageUptodate memorder problem (try 4) Nick Piggin
2007-02-15  7:31 ` [patch 2/3] fs: buffer don't PageUptodate without page locked Nick Piggin
2007-02-15  7:31   ` Nick Piggin

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=20070206002140.4030a11f.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=hugh@veritas.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=npiggin@suse.de \
    --cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.