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

3b974a
From 16c22d11ac511d6b228db36b62c1567e9578f290 Mon Sep 17 00:00:00 2001
3b974a
From: Theodore Ts'o <tytso@mit.edu>
3b974a
Date: Thu, 19 Dec 2019 19:45:06 -0500
3b974a
Subject: [PATCH 2/7] e2fsck: don't try to rehash a deleted directory
3b974a
3b974a
If directory has been deleted in pass1[bcd] processing, then we
3b974a
shouldn't try to rehash the directory in pass 3a when we try to
3b974a
rehash/reoptimize directories.
3b974a
3b974a
RHBZ: 1797731
3b974a
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3b974a
---
3b974a
 e2fsck/pass1b.c | 4 ++++
3b974a
 e2fsck/rehash.c | 3 +++
3b974a
 2 files changed, 7 insertions(+)
3b974a
3b974a
diff --git a/e2fsck/pass1b.c b/e2fsck/pass1b.c
3b974a
index 13bd9e98..0e6c29ef 100644
3b974a
--- a/e2fsck/pass1b.c
3b974a
+++ b/e2fsck/pass1b.c
3b974a
@@ -643,6 +643,10 @@ static void delete_file(e2fsck_t ctx, ext2_ino_t ino,
3b974a
 		fix_problem(ctx, PR_1B_BLOCK_ITERATE, &pctx);
3b974a
 	if (ctx->inode_bad_map)
3b974a
 		ext2fs_unmark_inode_bitmap2(ctx->inode_bad_map, ino);
3b974a
+	if (ctx->inode_reg_map)
3b974a
+		ext2fs_unmark_inode_bitmap2(ctx->inode_reg_map, ino);
3b974a
+	ext2fs_unmark_inode_bitmap2(ctx->inode_dir_map, ino);
3b974a
+	ext2fs_unmark_inode_bitmap2(ctx->inode_used_map, ino);
3b974a
 	ext2fs_inode_alloc_stats2(fs, ino, -1, LINUX_S_ISDIR(dp->inode.i_mode));
3b974a
 	quota_data_sub(ctx->qctx, &dp->inode, ino,
3b974a
 		       pb.dup_blocks * fs->blocksize);
3b974a
diff --git a/e2fsck/rehash.c b/e2fsck/rehash.c
3b974a
index fbc4e558..6f65edf3 100644
3b974a
--- a/e2fsck/rehash.c
3b974a
+++ b/e2fsck/rehash.c
3b974a
@@ -882,6 +882,9 @@ void e2fsck_rehash_directories(e2fsck_t ctx)
3b974a
 		}
3b974a
 		if (ino == ctx->lost_and_found)
3b974a
 			continue;
3b974a
+		if (!ext2fs_test_inode_bitmap2(ctx->inode_dir_map, ino))
3b974a
+			continue;
3b974a
+
3b974a
 		pctx.dir = ino;
3b974a
 		if (first) {
3b974a
 			fix_problem(ctx, PR_3A_PASS_HEADER, &pctx);
3b974a
-- 
3b974a
2.21.1
3b974a