Re: writepage fs corruption fixes
From: Andrea Arcangeli
Date: Fri Jul 09 2004 - 19:17:27 EST
On Thu, Jul 08, 2004 at 09:56:45PM -0700, Andrew Morton wrote:
> Andrea Arcangeli <andrea@xxxxxxx> wrote:
> >
> > BTW, the new mpage code looks great,
>
> You should have seen the first version! But after all the bugs were fixed
> and the real world hit it, some spaghetti got in there.
fun ;)
> Unfortunately it's hard to use mpage_writepages() even in ext3's writeback
> mode, because ext3_get_block() assumes that it is called with a transaction
> open. Not impossible though I guess - use a different get_block() which
> opens a transaction for itself... But only open it if the page isn't
> already mapped to disk. (/me gets itchy fingers)
it would be great to enable it. at least readpages already works.
Unfortunately I wasn't reproducing this bug (despite the bug was real),
infact it should trigger only near oom.
So I returning back into debugging, and am I right this is the real fix
I was looking for? Think i_size == 4097, this buggy below code was used
to write only 1 block, but it should write _two_ of them. This also
explains why it only triggers on ia64 with page_size > 4k and not on x86 :).
I hope this time I'm done with it.
--- sles/fs/mpage.c.~1~ 2004-07-09 23:48:33.233205496 +0200
+++ sles/fs/mpage.c 2004-07-10 02:11:59.922789800 +0200
@@ -460,7 +460,7 @@ mpage_writepage(struct bio *bio, struct
*/
BUG_ON(!PageUptodate(page));
block_in_file = page->index << (PAGE_CACHE_SHIFT - blkbits);
- last_block = (i_size_read(inode) - 1) >> blkbits;
+ last_block = (i_size_read(inode) + (1 << blkbits) - 1) >> blkbits;
map_bh.b_page = page;
for (page_block = 0; page_block < blocks_per_page; ) {
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/