Blame SOURCES/e2fsprogs-1.45.5-e2fsck-don-t-try-to-rehash-a-deleted-directory.patch

a9c310
From c8bbee5fdc46876ec96be9c40831dcafadbcb983 Mon Sep 17 00:00:00 2001
a9c310
From: Theodore Ts'o <tytso@mit.edu>
a9c310
Date: Thu, 19 Dec 2019 19:45:06 -0500
a9c310
Subject: [PATCH 08/10] e2fsck: don't try to rehash a deleted directory
a9c310
a9c310
If directory has been deleted in pass1[bcd] processing, then we
a9c310
shouldn't try to rehash the directory in pass 3a when we try to
a9c310
rehash/reoptimize directories.
a9c310
a9c310
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
a9c310
---
a9c310
 e2fsck/pass1b.c | 4 ++++
a9c310
 e2fsck/rehash.c | 2 ++
a9c310
 2 files changed, 6 insertions(+)
a9c310
a9c310
diff --git a/e2fsck/pass1b.c b/e2fsck/pass1b.c
a9c310
index 5693b9cf..bca701ca 100644
a9c310
--- a/e2fsck/pass1b.c
a9c310
+++ b/e2fsck/pass1b.c
a9c310
@@ -705,6 +705,10 @@ static void delete_file(e2fsck_t ctx, ext2_ino_t ino,
a9c310
 		fix_problem(ctx, PR_1B_BLOCK_ITERATE, &pctx);
a9c310
 	if (ctx->inode_bad_map)
a9c310
 		ext2fs_unmark_inode_bitmap2(ctx->inode_bad_map, ino);
a9c310
+	if (ctx->inode_reg_map)
a9c310
+		ext2fs_unmark_inode_bitmap2(ctx->inode_reg_map, ino);
a9c310
+	ext2fs_unmark_inode_bitmap2(ctx->inode_dir_map, ino);
a9c310
+	ext2fs_unmark_inode_bitmap2(ctx->inode_used_map, ino);
a9c310
 	ext2fs_inode_alloc_stats2(fs, ino, -1, LINUX_S_ISDIR(dp->inode.i_mode));
a9c310
 	quota_data_sub(ctx->qctx, &dp->inode, ino,
a9c310
 		       pb.dup_blocks * fs->blocksize);
a9c310
diff --git a/e2fsck/rehash.c b/e2fsck/rehash.c
a9c310
index 3dd1e941..2c908be0 100644
a9c310
--- a/e2fsck/rehash.c
a9c310
+++ b/e2fsck/rehash.c
a9c310
@@ -1028,6 +1028,8 @@ void e2fsck_rehash_directories(e2fsck_t ctx)
a9c310
 			if (!ext2fs_u32_list_iterate(iter, &ino))
a9c310
 				break;
a9c310
 		}
a9c310
+		if (!ext2fs_test_inode_bitmap2(ctx->inode_dir_map, ino))
a9c310
+			continue;
a9c310
 
a9c310
 		pctx.dir = ino;
a9c310
 		if (first) {
a9c310
-- 
a9c310
2.21.1
a9c310