Whamcloud - gitweb
LU-8465 e2fsck: set E2F_FLAG_ALLOC_OK after threads 44/39844/10
authorWang Shilong <wshilong@ddn.com>
Thu, 16 Apr 2020 07:08:31 +0000 (15:08 +0800)
committerAndreas Dilger <adilger@whamcloud.com>
Sat, 26 Sep 2020 06:37:07 +0000 (06:37 +0000)
Only flag ALLOC OK after all threads finished without problem.

Signed-off-by: Wang Shilong <wshilong@ddn.com>
Change-Id: I9127cca33f982100ed62a8ae0230f5eae6c8f7c1
Reviewed-on: https://review.whamcloud.com/39844
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Andreas Dilger <adilger@whamcloud.com>
e2fsck/pass1.c

index eee5ea8..0be5937 100644 (file)
@@ -1583,9 +1583,12 @@ static void e2fsck_pass1_post(e2fsck_t ctx)
 {
        struct problem_context pctx;
        ext2_filsys fs = ctx->fs;
+       char *block_buf;
 
-       char *block_buf =
-               (char *)e2fsck_allocate_memory(ctx, ctx->fs->blocksize * 3,
+       if (e2fsck_should_abort(ctx))
+               return;
+
+       block_buf = (char *)e2fsck_allocate_memory(ctx, ctx->fs->blocksize * 3,
                                              "block interate buffer");
        reserve_block_for_root_repair(ctx);
        reserve_block_for_lnf_repair(ctx);
@@ -1663,6 +1666,8 @@ static void e2fsck_pass1_post(e2fsck_t ctx)
                ext2fs_free_mem(&block_buf);
                ctx->flags &= ~E2F_FLAG_DUP_BLOCK;
        }
+
+       ctx->flags |= E2F_FLAG_ALLOC_OK;
 }
 
 
@@ -2537,7 +2542,6 @@ void e2fsck_pass1_run(e2fsck_t ctx)
                goto endit;
        }
 
-       ctx->flags |= E2F_FLAG_ALLOC_OK;
        ext2fs_free_mem(&inodes_to_process);
 endit:
        e2fsck_use_inode_shortcuts(ctx, 0);