lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1586342714-12536-30-git-send-email-wangshilong1991@gmail.com>
Date:   Wed,  8 Apr 2020 19:44:57 +0900
From:   Wang Shilong <wangshilong1991@...il.com>
To:     linux-ext4@...r.kernel.org
Cc:     lixi@....com, adilger@...ger.ca, sihara@....com,
        Wang Shilong <wshilong@....com>
Subject: [RFC PATCH 29/46] e2fsck: merge dirs_to_hash when threads finish

From: Wang Shilong <wshilong@....com>

This will fix t_dangerous test failure with 2 threads.

Signed-off-by: Wang Shilong <wshilong@....com>
---
 e2fsck/pass1.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
index 0044d7e8..52598838 100644
--- a/e2fsck/pass1.c
+++ b/e2fsck/pass1.c
@@ -2512,6 +2512,27 @@ static errcode_t e2fsck_pass1_merge_icounts(e2fsck_t global_ctx, e2fsck_t thread
 	return 0;
 }
 
+static int e2fsck_pass1_merge_dirs_to_hash(e2fsck_t global_ctx, e2fsck_t thread_ctx)
+{
+	int retval = 0;
+
+	if (thread_ctx->dirs_to_hash) {
+		if (!global_ctx->dirs_to_hash)
+			retval = ext2fs_badblocks_copy(thread_ctx->dirs_to_hash,
+						       &global_ctx->dirs_to_hash);
+		else
+			retval = ext2fs_badblocks_merge(thread_ctx->dirs_to_hash,
+							global_ctx->dirs_to_hash);
+
+		if (retval)
+			return retval;
+
+		ext2fs_badblocks_list_free(thread_ctx->dirs_to_hash);
+		thread_ctx->dirs_to_hash = 0;
+	}
+	return retval;
+}
+
 static int e2fsck_pass1_thread_join_one(e2fsck_t global_ctx, e2fsck_t thread_ctx)
 {
 	errcode_t	 retval;
@@ -2553,6 +2574,7 @@ static int e2fsck_pass1_thread_join_one(e2fsck_t global_ctx, e2fsck_t thread_ctx
 	__u32	large_files = global_ctx->large_files;
 	int dx_dir_info_size = global_ctx->dx_dir_info_size;
 	int dx_dir_info_count = global_ctx->dx_dir_info_count;
+	ext2_u32_list dirs_to_hash = global_ctx->dirs_to_hash;
 
 #ifdef HAVE_SETJMP_H
 	jmp_buf		 old_jmp;
@@ -2619,6 +2641,12 @@ static int e2fsck_pass1_thread_join_one(e2fsck_t global_ctx, e2fsck_t thread_ctx
 	com_err(global_ctx->program_name, 0, _("while merging icounts\n"));
 		return retval;
 	}
+	global_ctx->dirs_to_hash = dirs_to_hash;
+	retval = e2fsck_pass1_merge_dirs_to_hash(global_ctx, thread_ctx);
+	if (retval) {
+		com_err(global_ctx->program_name, 0, _("while merging dirs to hash\n"));
+		return retval;
+	}
 
 	/*
 	 * PASS1_COPY_CTX_BITMAP might return directly from this function,
-- 
2.25.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ