From: Wang Shilong Date: Thu, 16 Apr 2020 07:08:31 +0000 (+0800) Subject: e2fsck: set E2F_FLAG_ALLOC_OK after threads X-Git-Tag: v1.47.0-wc1~48 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=5bc7185a009a7c084fb836b9e4ff99a1258e2a59;p=tools%2Fe2fsprogs.git e2fsck: set E2F_FLAG_ALLOC_OK after threads Only flag ALLOC OK after all threads finished without problem. E2fsprogs-commit: 2c1e9ced674f0d8e634c3b6299ce9bdfbe4b8739 Change-Id: I764d08bab5299ec0aec9d7d5e9b21320c085dee9 Signed-off-by: Wang Shilong Reviewed-by: Andreas Dilger Signed-off-by: Theodore Ts'o --- diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c index 37e9f6b..c446555 100644 --- a/e2fsck/pass1.c +++ b/e2fsck/pass1.c @@ -1391,9 +1391,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); @@ -1471,6 +1474,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; } @@ -2361,6 +2366,7 @@ void e2fsck_pass1_run(e2fsck_t ctx) } ctx->flags |= E2F_FLAG_ALLOC_OK; + ext2fs_free_mem(&inodes_to_process); endit: e2fsck_use_inode_shortcuts(ctx, 0); ext2fs_free_mem(&inodes_to_process);