Package: e2fsprogs Version: 1.41.9-1 Severity: normal Tags: patch *** Please type your report below this line *** "logdump -b<block>" command in debugfs show incorrect allocation status in block bitmap
== What happens == $ debugfs /dev/sda1 debugfs: logdump -b1827766 It always report "block is SET" like this, FS block 1802240 logged at journal block 14742 (flags 0x2) (block bitmap for block 1827766: block is SET) FS block 1802240 logged at journal block 14749 (flags 0x2) (block bitmap for block 1827766: block is SET) == What should happen == It should show SET or CLEAR correspond to the bitmap logged in the journal like this, FS block 1802240 logged at journal block 14742 (flags 0x2) (block bitmap for block 1827766: block is CLEAR) FS block 1802240 logged at journal block 14749 (flags 0x2) (block bitmap for block 1827766: block is SET) == How to fix == The attachment is the patch to fix this. -- System Information: Debian Release: testing/unstable APT prefers warty-updates APT policy: (800, 'warty-updates'), (800, 'warty-security'), (800, 'warty-backports'), (800, 'warty'), (700, 'hoary-updates'), (700, 'hoary-security'), (700, 'hoary-backports'), (700, 'hoary'), (600, 'breezy-updates'), (600, 'breezy-security'), (600, 'breezy-backports'), (600, 'breezy'), (599, 'dapper-updates'), (599, 'dapper-security'), (599, 'dapper-backports'), (599, 'dapper'), (500, 'jaunty-updates'), (500, 'jaunty-security'), (500, 'jaunty-backports'), (500, 'jaunty'), (500, 'intrepid-updates'), (500, 'intrepid-security'), (500, 'intrepid-backports'), (500, 'intrepid'), (500, 'hardy-updates'), (500, 'hardy-security'), (500, 'hardy-backports'), (500, 'hardy'), (500, 'gutsy-updates'), (500, 'gutsy-security'), (500, 'gutsy-backports'), (500, 'gutsy'), (500, 'feisty-backports'), (500, 'edgy-backports') Architecture: i386 (i686) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.15-52-386 Locale: LANG=C, LC_CTYPE=thai (charmap=TIS-620)
diff -urN --exclude '.*.sw?' e2fsprogs-1.41.9.orig/debugfs/logdump.c e2fsprogs-1.41.9.develop/debugfs/logdump.c --- e2fsprogs-1.41.9.orig/debugfs/logdump.c 2009-08-23 09:39:05.000000000 +0700 +++ e2fsprogs-1.41.9.develop/debugfs/logdump.c 2009-12-29 11:04:00.588051480 +0700 @@ -40,7 +40,7 @@ int dump_all, dump_contents, dump_descriptors; blk_t block_to_dump, bitmap_to_dump, inode_block_to_dump; -unsigned int group_to_dump, inode_offset_to_dump; +unsigned int group_to_dump, bitmap_offset_to_dump, inode_offset_to_dump; ext2_ino_t inode_to_dump; struct journal_source @@ -183,6 +183,9 @@ es->s_first_data_block) / es->s_blocks_per_group); bitmap_to_dump = current_fs->group_desc[group_to_dump].bg_block_bitmap; + bitmap_offset_to_dump = ((block_to_dump - + es->s_first_data_block) + % es->s_blocks_per_group); } if (!journal_fn && check_fs_open(argv[0])) @@ -615,17 +618,10 @@ return; if (fs_blocknr == bitmap_to_dump) { - struct ext2_super_block *super; - int offset; - - super = current_fs->super; - offset = ((fs_blocknr - super->s_first_data_block) % - super->s_blocks_per_group); - fprintf(out_file, " (block bitmap for block %u: " "block is %s)\n", block_to_dump, - ext2fs_test_bit(offset, buf) ? "SET" : "CLEAR"); + ext2fs_test_bit(bitmap_offset_to_dump, buf) ? "SET" : "CLEAR"); } if (fs_blocknr == inode_block_to_dump) {