LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [RESEND] [PATCH] fix invalidate_inode_pages2_range not to clear ret
@ 2008-02-15 4:36 Hisashi Hifumi
2008-02-20 18:08 ` Jeff Moyer
0 siblings, 1 reply; 4+ messages in thread
From: Hisashi Hifumi @ 2008-02-15 4:36 UTC (permalink / raw)
To: akpm, linux-kernel
Hi Andrew.
DIO invalidates page cache through invalidate_inode_pages2_range().
invalidate_inode_pages2_range() sets ret=-EIO when invalidate_complete_page2()
fails, but this ret is cleared if do_launder_page() succeed on a page of next index.
In this case, dio is carried out even if invalidate_complete_page2() fails on some pages.
This can cause inconsistency between memory and blocks on HDD because the page
cache still exists.
Following patch fixes this issue.
Thanks.
Signed-off-by :Hisashi Hifumi <hifumi.hisashi@oss.ntt.co.jp>
diff -Nrup linux-2.6.25-rc1.org/mm/truncate.c linux-2.6.25-rc1/mm/truncate.c
--- linux-2.6.25-rc1.org/mm/truncate.c 2008-02-12 13:37:41.000000000 +0900
+++ linux-2.6.25-rc1/mm/truncate.c 2008-02-15 11:24:33.000000000 +0900
@@ -392,6 +392,7 @@ int invalidate_inode_pages2_range(struct
pgoff_t next;
int i;
int ret = 0;
+ int ret2 = 0;
int did_range_unmap = 0;
int wrapped = 0;
@@ -439,9 +440,11 @@ int invalidate_inode_pages2_range(struct
}
}
BUG_ON(page_mapped(page));
- ret = do_launder_page(mapping, page);
- if (ret == 0 && !invalidate_complete_page2(mapping, page))
- ret = -EIO;
+ ret2 = do_launder_page(mapping, page);
+ if (ret2 == 0 && !invalidate_complete_page2(mapping, page))
+ ret2 = -EIO;
+ if (ret2 < 0)
+ ret = ret2;
unlock_page(page);
}
pagevec_release(&pvec);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RESEND] [PATCH] fix invalidate_inode_pages2_range not to clear ret
2008-02-15 4:36 [RESEND] [PATCH] fix invalidate_inode_pages2_range not to clear ret Hisashi Hifumi
@ 2008-02-20 18:08 ` Jeff Moyer
2008-02-21 2:23 ` Hisashi Hifumi
0 siblings, 1 reply; 4+ messages in thread
From: Jeff Moyer @ 2008-02-20 18:08 UTC (permalink / raw)
To: Hisashi Hifumi; +Cc: akpm, linux-kernel
Hisashi Hifumi <hifumi.hisashi@oss.ntt.co.jp> writes:
> Hi Andrew.
>
> DIO invalidates page cache through invalidate_inode_pages2_range().
> invalidate_inode_pages2_range() sets ret=-EIO when invalidate_complete_page2()
> fails, but this ret is cleared if do_launder_page() succeed on a page of next index.
> In this case, dio is carried out even if invalidate_complete_page2() fails on some pages.
> This can cause inconsistency between memory and blocks on HDD because the page
> cache still exists.
>
> Following patch fixes this issue.
I agree with the patch (and I see Andrew already accepted it). Do you
have a reproducer for this problem?
Cheers,
Jeff
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RESEND] [PATCH] fix invalidate_inode_pages2_range not to clear ret
2008-02-20 18:08 ` Jeff Moyer
@ 2008-02-21 2:23 ` Hisashi Hifumi
2008-02-21 13:22 ` Jeff Moyer
0 siblings, 1 reply; 4+ messages in thread
From: Hisashi Hifumi @ 2008-02-21 2:23 UTC (permalink / raw)
To: Jeff Moyer; +Cc: akpm, linux-kernel
Hi Jeff.
>
>I agree with the patch (and I see Andrew already accepted it). Do you
>have a reproducer for this problem?
Do you want to know the way of failing invalidate_complete_page2() ?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RESEND] [PATCH] fix invalidate_inode_pages2_range not to clear ret
2008-02-21 2:23 ` Hisashi Hifumi
@ 2008-02-21 13:22 ` Jeff Moyer
0 siblings, 0 replies; 4+ messages in thread
From: Jeff Moyer @ 2008-02-21 13:22 UTC (permalink / raw)
To: Hisashi Hifumi; +Cc: akpm, linux-kernel, Zach Brown
Hisashi Hifumi <hifumi.hisashi@oss.ntt.co.jp> writes:
> Hi Jeff.
>
>>
>>I agree with the patch (and I see Andrew already accepted it). Do you
>>have a reproducer for this problem?
>
> Do you want to know the way of failing invalidate_complete_page2() ?
I was hoping for a test program that shows the problem. Looking through
the previous threads on this subject, it seems that Zach may have had a
reproducer. I tried running the aio-dio-regress tests on the 2.6.25-rc2
kernel, but was unable to trigger this problem.
-Jeff
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-02-21 13:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-15 4:36 [RESEND] [PATCH] fix invalidate_inode_pages2_range not to clear ret Hisashi Hifumi
2008-02-20 18:08 ` Jeff Moyer
2008-02-21 2:23 ` Hisashi Hifumi
2008-02-21 13:22 ` Jeff Moyer
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).