ext4: fix rehashing of the lost+found directory
Commit 07307114dea didn't correctly handle the lost+found directory
when it added support for metadata checksums. First of all,
e2fsck_get_lost_and_found() assumed that the inode_dir_map bitmap was
initialized, and it wasn't when it was called earlier by a change in
that commit. Secondly, it's important that lost+found dirctory is
processed in case its directory checksums are incorrect, but should
preserve any empty dirctory blocks so there space available for e2fsck
to reconnect any orphan inodes.
Fix these problems, to fix test failures: f_holedir2 and f_rehash_dir
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
diff --git a/e2fsck/pass3.c b/e2fsck/pass3.c
index ad733c2..a379e9b 100644
--- a/e2fsck/pass3.c
+++ b/e2fsck/pass3.c
@@ -375,7 +375,7 @@
if (retval && !fix)
return 0;
if (!retval) {
- if (ext2fs_test_inode_bitmap2(ctx->inode_dir_map, ino)) {
+ if (ext2fs_check_directory(fs, ino) == 0) {
ctx->lost_and_found = ino;
return ino;
}