2008-04-02 16:03:22

by Valerie Clement

[permalink] [raw]
Subject: [PATCH] ext4: Fix filesystem corruption on FS mounted with delalloc

ext4: Fix filesystem corruption on FS mounted with delalloc

From: "Valerie Clement" <[email protected]>

This patch fixes a filesystem corruption issue when the filesystem is
mounted with the delalloc option and blocksize < pagesize.

In the mpage_put_bnr_to_bhs() function, when skipping the first blocks
at the beginning of the first page, pblock should not be incremented,
otherwise the last blocks are corrupted. When writing into blocks at the
end of a group, the first blocks of the following group can be corrupted.
In that case, we've got the error message below:
EXT4-fs error (device sdc1): ext4_valid_block_bitmap: Invalid block bitmap -
block_group = 6233, block = 51060737

(Issue found when using fsstress tool on ext4 FS with 1K blocksize)

Signed-off-by: Valerie Clement <[email protected]>

---
mpage.c | 1 -
1 file changed, 1 deletion(-)

Index: linux-2.6.25-rc6/fs/mpage.c
===================================================================
--- linux-2.6.25-rc6.orig/fs/mpage.c 2008-04-02 17:12:03.000000000 +0200
+++ linux-2.6.25-rc6/fs/mpage.c 2008-04-02 17:12:11.000000000 +0200
@@ -844,7 +844,6 @@ static void mpage_put_bnr_to_bhs(struct
if (cur_logical >= logical)
break;
cur_logical++;
- pblock++;
} while ((bh = bh->b_this_page) != head);

do {