[PATCH resend v2 3/3] makedumpfile: implementation of dealing with kdump-compressed dumpfile with ENOSPC error

Atsushi Kumagai kumagai-atsushi at mxc.nes.nec.co.jp
Tue Oct 7 22:39:31 PDT 2014


>kdump-compressed:
>Dump the bitmap before any page header and page data. This format use
>"status" of "disk_dump_header" to indicate that it has been modified.
>
>Signed-of-by: Wang Xiao <wangx.fnst at cn.fujitsu.com>
>---
> diskdump_mod.h |  2 ++
> makedumpfile.c | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++++----
> 2 files changed, 82 insertions(+), 5 deletions(-)
>

[snip]

>+int
>+check_and_modify_multiple_kdump_headers() {
>+	int i, status, ret = TRUE;
>+	pid_t pid;
>+	pid_t array_pid[info->num_dumpfile];
>+
>+	for (i = 0; i < info->num_dumpfile; i++) {
>+		if ((pid = fork()) < 0) {
>+			return FALSE;
>+
>+		} else if (pid == 0) { /* Child */
>+			if (!check_and_modify_kdump_headers(SPLITTING_DUMPFILE(i)))
>+				exit(1);

reassemble_kdump_header() adopts only the dh.status of SPLITTING_DUMPFILE(0),
we should fix it to take over incomplete flags of the other dump files.


Thanks
Atsushi Kumagai

>+			exit(0);
>+		}
>+		array_pid[i] = pid;
>+	}
>+
>+	for (i = 0; i < info->num_dumpfile; i++) {
>+		waitpid(array_pid[i], &status, WUNTRACED);
>+		if (!WIFEXITED(status) || WEXITSTATUS(status) == 1) {
>+			ERRMSG("Check and modify the incomplete dumpfile(%s) failed.\n",
>+			       SPLITTING_DUMPFILE(i));
>+			ret = FALSE;
>+		}
>+	}
>+
>+	return ret;
>+}
>+
>+int
> rearrange_dumpdata(void)
> {
> 	int read_size, tmp_read_size;
>@@ -7185,11 +7250,11 @@ write_kdump_pages_and_bitmap_cyclic(struct cache_data *cd_header, struct cache_d
> 		if (!exclude_unnecessary_pages_cyclic(&cycle))
> 			return FALSE;
>
>-		if (!write_kdump_pages_cyclic(cd_header, cd_page, &pd_zero,
>-					&offset_data, &cycle))
>+		if (!write_kdump_bitmap2_cyclic(&cycle))
> 			return FALSE;
>
>-		if (!write_kdump_bitmap2_cyclic(&cycle))
>+		if (!write_kdump_pages_cyclic(cd_header, cd_page, &pd_zero,
>+					&offset_data, &cycle))
> 			return FALSE;
> 	}
>
>@@ -8189,12 +8254,12 @@ writeout_dumpfile(void)
> 	} else {
> 		if (!write_kdump_header())
> 			goto out;
>+		if (!write_kdump_bitmap())
>+			goto out;
> 		if (!write_kdump_pages(&cd_header, &cd_page))
> 			goto out;
> 		if (!write_kdump_eraseinfo(&cd_page))
> 			goto out;
>-		if (!write_kdump_bitmap())
>-			goto out;
> 	}
> 	if (info->flag_flatten) {
> 		if (!write_end_flat_header())
>@@ -8405,6 +8470,16 @@ retry:
> 					if (check_and_modify_elf_headers(info->name_dumpfile))
> 						MSG("This is an incomplete dumpfile,"
> 						    " but might analyzable.\n");
>+				} else {
>+					if (info->flag_split) {
>+						if (check_and_modify_multiple_kdump_headers())
>+							MSG("The splited dumpfiles are incomplete,"
>+							    " but might analyzable.\n");
>+					} else {
>+						if (check_and_modify_kdump_headers(info->name_dumpfile))
>+							MSG("This is an incomplete dumpfile,"
>+							    " but might analyzable.\n");
>+					}
> 				}
> 			}
>
>--
>1.8.3.1
>
>
>_______________________________________________
>kexec mailing list
>kexec at lists.infradead.org
>http://lists.infradead.org/mailman/listinfo/kexec



More information about the kexec mailing list