Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 1 | From 71ba13755337e19c9a826dfc874562a36e1b24d3 Mon Sep 17 00:00:00 2001 |
| 2 | From: Theodore Ts'o <tytso@mit.edu> |
| 3 | Date: Thu, 19 Dec 2019 19:45:06 -0500 |
| 4 | Subject: [PATCH] e2fsck: don't try to rehash a deleted directory |
| 5 | |
| 6 | If directory has been deleted in pass1[bcd] processing, then we |
| 7 | shouldn't try to rehash the directory in pass 3a when we try to |
| 8 | rehash/reoptimize directories. |
| 9 | |
| 10 | Signed-off-by: Theodore Ts'o <tytso@mit.edu> |
| 11 | |
| 12 | Upstream-Status: Backport [https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git/commit/?id=71ba13755337e19c9a826dfc874562a36e1b24d3] |
| 13 | Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> |
| 14 | --- |
| 15 | e2fsck/pass1b.c | 4 ++++ |
| 16 | e2fsck/rehash.c | 2 ++ |
| 17 | 2 files changed, 6 insertions(+) |
| 18 | |
| 19 | diff --git a/e2fsck/pass1b.c b/e2fsck/pass1b.c |
| 20 | index 5693b9cf..bca701ca 100644 |
| 21 | --- a/e2fsck/pass1b.c |
| 22 | +++ b/e2fsck/pass1b.c |
| 23 | @@ -705,6 +705,10 @@ static void delete_file(e2fsck_t ctx, ext2_ino_t ino, |
| 24 | fix_problem(ctx, PR_1B_BLOCK_ITERATE, &pctx); |
| 25 | if (ctx->inode_bad_map) |
| 26 | ext2fs_unmark_inode_bitmap2(ctx->inode_bad_map, ino); |
| 27 | + if (ctx->inode_reg_map) |
| 28 | + ext2fs_unmark_inode_bitmap2(ctx->inode_reg_map, ino); |
| 29 | + ext2fs_unmark_inode_bitmap2(ctx->inode_dir_map, ino); |
| 30 | + ext2fs_unmark_inode_bitmap2(ctx->inode_used_map, ino); |
| 31 | ext2fs_inode_alloc_stats2(fs, ino, -1, LINUX_S_ISDIR(dp->inode.i_mode)); |
| 32 | quota_data_sub(ctx->qctx, &dp->inode, ino, |
| 33 | pb.dup_blocks * fs->blocksize); |
| 34 | diff --git a/e2fsck/rehash.c b/e2fsck/rehash.c |
| 35 | index 3dd1e941..2c908be0 100644 |
| 36 | --- a/e2fsck/rehash.c |
| 37 | +++ b/e2fsck/rehash.c |
| 38 | @@ -1028,6 +1028,8 @@ void e2fsck_rehash_directories(e2fsck_t ctx) |
| 39 | if (!ext2fs_u32_list_iterate(iter, &ino)) |
| 40 | break; |
| 41 | } |
| 42 | + if (!ext2fs_test_inode_bitmap2(ctx->inode_dir_map, ino)) |
| 43 | + continue; |
| 44 | |
| 45 | pctx.dir = ino; |
| 46 | if (first) { |
| 47 | -- |
| 48 | 2.24.1 |
| 49 | |