e2fsprogs/tests/f_h_badnode
Andreas Dilger 19961cd000 e2fsck: fix e2fsck -fD directory truncation
When an extent-mapped directory is compacted by "e2fsck -fD" and
frees enough leaf blocks that it loses an extent tree index block,
the old e2fsck_rehash_dir->ext2fs_block_iterate3->write_dir_block()
code would not free the extent block, which would result in the
extent tree becoming corrupted when it is written out.

    Pass 1: Checking inodes, blocks, and sizes
    Inode 17825800, end of extent exceeds allowed value
            (logical block 710, physical block 570459684, len 1019)

This results in loss of a whole index block of directory leaf blocks
and maybe thousands or millions of files in lost+found.

Fix e2fsck_rehash_dir() to call ext2fs_punch() to free the blocks
at the end of the directory instead of trying to handle this itself
while writing out the directory.  That properly handles all of the
cases of updating the extent tree as well as accounting for blocks
that are released (both leaf blocks and index blocks).

Add a test case for compacting the directory to be smaller than the
index block that originally caused the corruption.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2015-11-30 15:26:35 -05:00
..
expect.1 e2fsck: fix e2fsck -fD directory truncation 2015-11-30 15:26:35 -05:00
expect.2 e2fsck: fix e2fsck -fD directory truncation 2015-11-30 15:26:35 -05:00
image.gz Add directory hashed signed/unsigned hint to superblock 2006-11-11 22:32:35 -05:00
name Add initial support for htree directories. 2002-06-25 23:26:34 -04:00
script tests: use make rules to run tests in parallel 2012-05-29 08:41:26 -04:00