All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] e2fsck: fix "can't find dup_blk" error
@ 2011-11-18  2:52 Robin Dong
  2011-11-19  4:02 ` Ted Ts'o
  0 siblings, 1 reply; 6+ messages in thread
From: Robin Dong @ 2011-11-18  2:52 UTC (permalink / raw)
  To: linux-ext4; +Cc: Robin Dong

From: Robin Dong <sanbai@taobao.com>

After:
1. mke2fs -O ^has_journal,^resize_inode,^uninit_bg,extent,meta_bg,flex_bg,bigalloc /dev/sda
2. mount -t ext4 /dev/sda /test/
3. create file (8192K size, extent' e_len is 2) /test/1 ~ /test/10
4. use tool to change the /test/5 extent's e_len to 100, corrupt file
5. e2fsck -f /dev/sda

And it will report like:

 Clone multiply-claimed blocks<y>? yes

 clone_file_block: internal error: can't find dup_blk for 525345

 clone_file_block: internal error: can't find dup_blk for 525346

 clone_file_block: internal error: can't find dup_blk for 525347

 clone_file_block: internal error: can't find dup_blk for 525348


In bigalloc filesystem, "blockcnt > 0" should change to "blockcnt >= cluster_ratio"

Signed-off-by: Robin Dong <sanbai@taobao.com>
---
 e2fsck/pass1b.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/e2fsck/pass1b.c b/e2fsck/pass1b.c
index d5585dd..a9cdd9e 100644
--- a/e2fsck/pass1b.c
+++ b/e2fsck/pass1b.c
@@ -703,7 +703,7 @@ static int clone_file_block(ext2_filsys fs,
 	if (check_if_fs_cluster(ctx, EXT2FS_B2C(fs, *block_nr)))
 		is_meta = 1;
 
-	if (((blockcnt > 0) && c == cs->dup_cluster) ||
+	if (((blockcnt >= EXT2FS_CLUSTER_RATIO(fs)) && c == cs->dup_cluster) ||
 	    ext2fs_test_block_bitmap2(ctx->block_dup_map, *block_nr)) {
 		n = dict_lookup(&clstr_dict,
 				INT_TO_VOIDPTR(EXT2FS_B2C(fs, *block_nr)));
-- 
1.7.3.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-11-28 17:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-18  2:52 [PATCH] e2fsck: fix "can't find dup_blk" error Robin Dong
2011-11-19  4:02 ` Ted Ts'o
2011-11-19  8:32   ` Robin Dong
2011-11-28 17:02     ` Ted Ts'o
2011-11-28 17:15       ` [PATCH 1/2] e2fsck: fix handling of duplicate blocks with bigalloc file systems Theodore Ts'o
2011-11-28 17:15         ` [PATCH 2/2] tests: add test case for multiply claimed blocks with bigalloc Theodore Ts'o

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.