2002-09-29 Theodore Ts'o <tytso@mit.edu>
+ * pass2.c (check_dir_block): Do a more paranoid check when trying
+ to determine whether or not a directory entry is a
+ completely empty leaf block or leaf node. Otherwise
+ e2fsck might get confused into thinking that a valid dxdir
+ was corrupted.
+
* rehash.c (e2fsck_rehash_dir): Apply patch from Christopher Li
which avoids creating an empty directory entry at the end
of the directory block. This screws up earlier versions
e2fsck_t ctx;
int problem;
struct ext2_dx_root_info *root;
+ struct ext2_dx_countlimit *limit;
cd = (struct check_dir_struct *) priv_data;
buf = cd->buf;
dx_db->max_hash = 0;
dirent = (struct ext2_dir_entry *) buf;
+ limit = (struct ext2_dx_countlimit *) (buf+8);
if (db->blockcnt == 0) {
root = (struct ext2_dx_root_info *) (buf + 24);
dx_db->type = DX_DIRBLOCK_ROOT;
}
dx_dir->hashversion = root->hash_version;
} else if ((dirent->inode == 0) &&
- (dirent->rec_len == fs->blocksize))
+ (dirent->rec_len == fs->blocksize) &&
+ (dirent->name_len == 0) &&
+ (limit->limit == ((fs->blocksize-8) /
+ sizeof(struct ext2_dx_entry))))
dx_db->type = DX_DIRBLOCK_NODE;
}
#endif /* ENABLE_HTREE */