Whamcloud - gitweb
e2fsck: don't try to rehash a deleted directory
authorTheodore Ts'o <tytso@mit.edu>
Fri, 20 Dec 2019 00:45:06 +0000 (19:45 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 9 Jan 2020 19:19:58 +0000 (14:19 -0500)
If directory has been deleted in pass1[bcd] processing, then we
shouldn't try to rehash the directory in pass 3a when we try to
rehash/reoptimize directories.

Addresses-Debian-Bug: 948508
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
(cherry picked from commit 71ba13755337e19c9a826dfc874562a36e1b24d3)

e2fsck/pass1b.c
e2fsck/rehash.c

index 5693b9c..bca701c 100644 (file)
@@ -705,6 +705,10 @@ static void delete_file(e2fsck_t ctx, ext2_ino_t ino,
                fix_problem(ctx, PR_1B_BLOCK_ITERATE, &pctx);
        if (ctx->inode_bad_map)
                ext2fs_unmark_inode_bitmap2(ctx->inode_bad_map, ino);
+       if (ctx->inode_reg_map)
+               ext2fs_unmark_inode_bitmap2(ctx->inode_reg_map, ino);
+       ext2fs_unmark_inode_bitmap2(ctx->inode_dir_map, ino);
+       ext2fs_unmark_inode_bitmap2(ctx->inode_used_map, ino);
        ext2fs_inode_alloc_stats2(fs, ino, -1, LINUX_S_ISDIR(dp->inode.i_mode));
        quota_data_sub(ctx->qctx, &dp->inode, ino,
                       pb.dup_blocks * fs->blocksize);
index 27e1429..0a5888a 100644 (file)
@@ -1024,6 +1024,8 @@ void e2fsck_rehash_directories(e2fsck_t ctx)
                        if (!ext2fs_u32_list_iterate(iter, &ino))
                                break;
                }
+               if (!ext2fs_test_inode_bitmap2(ctx->inode_dir_map, ino))
+                       continue;
 
                pctx.dir = ino;
                if (first) {