Whamcloud - gitweb
LU-14768 e2fsck: merge casefolded dir lists after thread finish
authorWang Shilong <wshilong@ddn.com>
Thu, 12 Mar 2020 11:40:27 +0000 (19:40 +0800)
committerLi Dongyang <dongyangli@ddn.com>
Fri, 28 Apr 2023 00:47:13 +0000 (10:47 +1000)
This is missed and should be done after threads finish.

Original commit:
18538b27 ("LU-8465 e2fsck: merge encrypted dir lists after thread finish")
Upstream is now using e2fsck_struct->casefolded_dirs instead of
encrypted_dirs.

Only for the correctness of pfsck, we won't use casefolded feature on
ldiskfs.

Change-Id: I6f3a28501886c2ed4bec26dc5c5e5a1914fece04
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Signed-off-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-on: https://review.whamcloud.com/44010
Reviewed-by: Wang Shilong <wshilong@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
e2fsck/pass1.c

index 4fa6d46..37e9f6b 100644 (file)
@@ -2663,6 +2663,7 @@ static errcode_t e2fsck_pass1_thread_prepare(e2fsck_t global_ctx, e2fsck_t *thre
        }
        memcpy(thread_context, global_ctx, sizeof(struct e2fsck_struct));
        thread_context->block_dup_map = NULL;
+       thread_context->casefolded_dirs = NULL;
 
        retval = e2fsck_allocate_block_bitmap(global_ctx->fs,
                                _("in-use block map"), EXT2FS_BMAP64_RBTREE,
@@ -2954,6 +2955,24 @@ static errcode_t e2fsck_pass1_merge_ea_refcount(e2fsck_t global_ctx,
        return retval;
 }
 
+static errcode_t e2fsck_pass1_merge_casefolded_dirs(e2fsck_t global_ctx,
+                                                  e2fsck_t thread_ctx)
+{
+       errcode_t retval = 0;
+
+       if (!thread_ctx->casefolded_dirs)
+               return 0;
+
+       if (!global_ctx->casefolded_dirs)
+               retval = ext2fs_badblocks_copy(thread_ctx->casefolded_dirs,
+                                              &global_ctx->casefolded_dirs);
+       else
+               retval = ext2fs_badblocks_merge(thread_ctx->casefolded_dirs,
+                                               global_ctx->casefolded_dirs);
+
+       return retval;
+}
+
 static errcode_t e2fsck_pass1_merge_context(e2fsck_t global_ctx,
                                            e2fsck_t thread_ctx)
 {
@@ -3020,6 +3039,13 @@ static errcode_t e2fsck_pass1_merge_context(e2fsck_t global_ctx,
        if (retval)
                return retval;
 
+       retval = e2fsck_pass1_merge_casefolded_dirs(global_ctx, thread_ctx);
+       if (retval) {
+               com_err(global_ctx->program_name, 0,
+                       _("while merging casefolded dirs\n"));
+               return retval;
+       }
+
        e2fsck_pass1_merge_invalid_bitmaps(global_ctx, thread_ctx);
 
        retval = e2fsck_pass1_merge_bitmap(global_fs,