public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Nick Piggin <npiggin@suse.de>
Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>,
	linux-kernel@vger.kernel.org, Al Viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	stable@kernel.org
Subject: Re: [stable] [PATCH] vfs: Fix vmtruncate() regression
Date: Tue, 19 Jan 2010 15:52:24 -0800	[thread overview]
Message-ID: <20100119235224.GJ4034@kroah.com> (raw)
In-Reply-To: <20100118035146.GA7447@laptop>

On Mon, Jan 18, 2010 at 02:51:46PM +1100, Nick Piggin wrote:
> On Fri, Jan 15, 2010 at 09:26:02AM +0900, OGAWA Hirofumi wrote:
> > Andrew Morton <akpm@linux-foundation.org> writes:
> > 
> > > On Wed, 13 Jan 2010 21:14:09 +0900
> > > OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> wrote:
> > >
> > >> 
> > >> If __block_prepare_write() was failed in block_write_begin(), the
> > >> allocated blocks can be outside of ->i_size.
> > >> 
> > >> But new truncate_pagecache() in vmtuncate() does nothing if new < old.
> > >> It means the above usage is not working anymore.
> > >> 
> > >> So, this patch fixes it by removing "new < old" check. It would need
> > >> more cleanup/change. But, now -rc and truncate working is in progress,
> > >> so, this tried to fix it minimum change.
> > >> 
> > >> Acked-by: Nick Piggin <npiggin@suse.de>
> > >> Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
> > >> ---
> > >> 
> > >>  mm/truncate.c |   28 +++++++++++++---------------
> > >>  1 file changed, 13 insertions(+), 15 deletions(-)
> > >> 
> > >> diff -puN mm/truncate.c~truncate_pagecache-fix mm/truncate.c
> > >> --- linux-2.6/mm/truncate.c~truncate_pagecache-fix	2010-01-12 05:43:06.000000000 +0900
> > >> +++ linux-2.6-hirofumi/mm/truncate.c	2010-01-12 05:43:06.000000000 +0900
> > >> @@ -522,22 +522,20 @@ EXPORT_SYMBOL_GPL(invalidate_inode_pages
> > >>   */
> > >>  void truncate_pagecache(struct inode *inode, loff_t old, loff_t new)
> > >>  {
> > >> -	if (new < old) {
> > >> -		struct address_space *mapping = inode->i_mapping;
> > >> +	struct address_space *mapping = inode->i_mapping;
> > >>  
> > >> -		/*
> > >> -		 * unmap_mapping_range is called twice, first simply for
> > >> -		 * efficiency so that truncate_inode_pages does fewer
> > >> -		 * single-page unmaps.  However after this first call, and
> > >> -		 * before truncate_inode_pages finishes, it is possible for
> > >> -		 * private pages to be COWed, which remain after
> > >> -		 * truncate_inode_pages finishes, hence the second
> > >> -		 * unmap_mapping_range call must be made for correctness.
> > >> -		 */
> > >> -		unmap_mapping_range(mapping, new + PAGE_SIZE - 1, 0, 1);
> > >> -		truncate_inode_pages(mapping, new);
> > >> -		unmap_mapping_range(mapping, new + PAGE_SIZE - 1, 0, 1);
> > >> -	}
> > >> +	/*
> > >> +	 * unmap_mapping_range is called twice, first simply for
> > >> +	 * efficiency so that truncate_inode_pages does fewer
> > >> +	 * single-page unmaps.  However after this first call, and
> > >> +	 * before truncate_inode_pages finishes, it is possible for
> > >> +	 * private pages to be COWed, which remain after
> > >> +	 * truncate_inode_pages finishes, hence the second
> > >> +	 * unmap_mapping_range call must be made for correctness.
> > >> +	 */
> > >> +	unmap_mapping_range(mapping, new + PAGE_SIZE - 1, 0, 1);
> > >> +	truncate_inode_pages(mapping, new);
> > >> +	unmap_mapping_range(mapping, new + PAGE_SIZE - 1, 0, 1);
> > >>  }
> > >>  EXPORT_SYMBOL(truncate_pagecache);
> > >
> > > The fix was applied to 2.6.33-rcX
> > > (cedabed49b39b4319bccc059a63344b6232b619c), appears to be needed in
> > > 2.6.32.x but no cc:stable's are present?
> > 
> > Ah, yes. I forgot to add "Cc: stable". Please apply this to 2.6.32.x.
> 
> Thanks guys, it's quite important so please apply to stable 2.6.32 and
> consider it as a high priority to release.

Now queued up for the next .32 -stable release.

greg k-h

      reply	other threads:[~2010-01-20  0:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-11 18:40 [PATCH] vfs: Fix vmtruncate() regression OGAWA Hirofumi
2010-01-13  6:07 ` Nick Piggin
2010-01-13 12:07   ` OGAWA Hirofumi
2010-01-13 12:14     ` OGAWA Hirofumi
2010-01-14 22:30       ` Andrew Morton
2010-01-15  0:26         ` OGAWA Hirofumi
2010-01-18  3:51           ` Nick Piggin
2010-01-19 23:52             ` Greg KH [this message]

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=20100119235224.GJ4034@kroah.com \
    --to=greg@kroah.com \
    --cc=akpm@linux-foundation.org \
    --cc=hirofumi@mail.parknet.co.jp \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=npiggin@suse.de \
    --cc=stable@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    /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