* [PATCH] vfs: Fix vmtruncate() regression
@ 2010-01-11 18:40 OGAWA Hirofumi
2010-01-13 6:07 ` Nick Piggin
0 siblings, 1 reply; 8+ messages in thread
From: OGAWA Hirofumi @ 2010-01-11 18:40 UTC (permalink / raw)
To: Al Viro, Nick Piggin; +Cc: linux-kernel, linux-fsdevel
Hi,
Could you review this one?
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.
Cc: stable@kernel.org
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 02:41:27.000000000 +0900
+++ linux-2.6-hirofumi/mm/truncate.c 2010-01-12 02:42:53.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);
_
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] vfs: Fix vmtruncate() regression
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
0 siblings, 1 reply; 8+ messages in thread
From: Nick Piggin @ 2010-01-13 6:07 UTC (permalink / raw)
To: OGAWA Hirofumi; +Cc: Al Viro, linux-kernel, linux-fsdevel
On Tue, Jan 12, 2010 at 03:40:42AM +0900, OGAWA Hirofumi wrote:
> Hi,
>
> Could you review this one?
>
>
>
> 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.
>
> Cc: stable@kernel.org
> Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Hmm, truncate_pagecache() is for truncating the mm/vm part of the
pagecache. vmtruncate should still call inode->i_op->truncate() to
trim blocks if required.
However I'd say we do still need to ensure do_invalidatepage is
called for the page, for private metadata. So yes I think your patch
looks good.
Acked-by: Nick Piggin <npiggin@suse.de>
Please apply to mainline and 2.6.32.
> ---
>
> 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 02:41:27.000000000 +0900
> +++ linux-2.6-hirofumi/mm/truncate.c 2010-01-12 02:42:53.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);
>
> _
>
> --
> OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] vfs: Fix vmtruncate() regression
2010-01-13 6:07 ` Nick Piggin
@ 2010-01-13 12:07 ` OGAWA Hirofumi
2010-01-13 12:14 ` OGAWA Hirofumi
0 siblings, 1 reply; 8+ messages in thread
From: OGAWA Hirofumi @ 2010-01-13 12:07 UTC (permalink / raw)
To: Nick Piggin; +Cc: Al Viro, linux-kernel, linux-fsdevel
Nick Piggin <npiggin@suse.de> writes:
>> 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.
>>
>> Cc: stable@kernel.org
>> Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
>
> Hmm, truncate_pagecache() is for truncating the mm/vm part of the
> pagecache. vmtruncate should still call inode->i_op->truncate() to
> trim blocks if required.
>
> However I'd say we do still need to ensure do_invalidatepage is
> called for the page, for private metadata. So yes I think your patch
> looks good.
Thanks for reviewing. Yes, and it also needs to be called to ensure that
have the same state on-disk and page/bh state. [BTW, this became the
cause of fatfs corruption.]
Thanks.
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] vfs: Fix vmtruncate() regression
2010-01-13 12:07 ` OGAWA Hirofumi
@ 2010-01-13 12:14 ` OGAWA Hirofumi
2010-01-14 22:30 ` Andrew Morton
0 siblings, 1 reply; 8+ messages in thread
From: OGAWA Hirofumi @ 2010-01-13 12:14 UTC (permalink / raw)
To: Linus Torvalds
Cc: Nick Piggin, Al Viro, linux-kernel, linux-fsdevel, Andrew Morton
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);
_
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] vfs: Fix vmtruncate() regression
2010-01-13 12:14 ` OGAWA Hirofumi
@ 2010-01-14 22:30 ` Andrew Morton
2010-01-15 0:26 ` OGAWA Hirofumi
0 siblings, 1 reply; 8+ messages in thread
From: Andrew Morton @ 2010-01-14 22:30 UTC (permalink / raw)
To: OGAWA Hirofumi
Cc: Linus Torvalds, Nick Piggin, Al Viro, linux-kernel, linux-fsdevel,
stable
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?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] vfs: Fix vmtruncate() regression
2010-01-14 22:30 ` Andrew Morton
@ 2010-01-15 0:26 ` OGAWA Hirofumi
2010-01-18 3:51 ` Nick Piggin
0 siblings, 1 reply; 8+ messages in thread
From: OGAWA Hirofumi @ 2010-01-15 0:26 UTC (permalink / raw)
To: Andrew Morton
Cc: Linus Torvalds, Nick Piggin, Al Viro, linux-kernel, linux-fsdevel,
stable
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.
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] vfs: Fix vmtruncate() regression
2010-01-15 0:26 ` OGAWA Hirofumi
@ 2010-01-18 3:51 ` Nick Piggin
2010-01-19 23:52 ` [stable] " Greg KH
0 siblings, 1 reply; 8+ messages in thread
From: Nick Piggin @ 2010-01-18 3:51 UTC (permalink / raw)
To: OGAWA Hirofumi
Cc: Andrew Morton, Linus Torvalds, Al Viro, linux-kernel,
linux-fsdevel, stable
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.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [stable] [PATCH] vfs: Fix vmtruncate() regression
2010-01-18 3:51 ` Nick Piggin
@ 2010-01-19 23:52 ` Greg KH
0 siblings, 0 replies; 8+ messages in thread
From: Greg KH @ 2010-01-19 23:52 UTC (permalink / raw)
To: Nick Piggin
Cc: OGAWA Hirofumi, linux-kernel, Al Viro, linux-fsdevel,
Andrew Morton, Linus Torvalds, stable
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
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2010-01-19 23:52 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [stable] " Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).