[PATCH 0/5 v3] Dump core correctly to the bind mounted target in Atomic
by Minfei Huang
Enhance kdump to support bind mounted target, since kdump cann't parse
the bind mounted path.
Following is the testcases which kdump can generate the core sucessfully.
1) rootfs, default path / specified path
2) rootfs with bind mounted path which is in the rootfs device
# cat /etc/kdump | grep ^path
path /var/crash
# mount -o bind /var/crash /mnt/crash
4) rootfs with bind mounted path which is not in the rootfs device
# cat /etc/kdump | grep ^path
path /var/crash
# mount /dev/vdb /mnt
# mount -o bind /var/crash /mnt/crash
5) no-rootfs
6) no-rootfs with bind mounted path which is in the same device
7) no-rootfs with bind mounted path which is not in the same device
8) nfs
9) nfs with bind mounted path which is under the nfs mount point path
# cat /etc/kdump | grep ^nfs
nfs 192.168.122.134:/opt/crash
# cat /etc/kdump | grep ^path
path /var/crash
# mount.nfs 192.168.122.134:/opt/crash /mnt/nfs
# mount -o bind /mnt/nfs/var/crash /mnt/nfs/dump
10) nfs with bind mounted path which is not under the nfs mount point path
# cat /etc/kdump | grep ^nfs
nfs 192.168.122.134:/opt/crash
# cat /etc/kdump | grep ^path
path /var/crash
# mount.nfs 192.168.122.134:/opt/crash /mnt/nfs
# mount -o bind /mnt/nfs/var/crash /mnt/dump
11) nfs which don't specify the nfs option in the /etc/kdump, with bind mounted path which is under the nfs mount point path
# cat /etc/kdump | grep ^nfs
# mount.nfs 192.168.122.134:/opt/crash /mnt/nfs
# cat /etc/kdump | grep ^path
path /mnt/nfs/var/crash
# mount -o bind /mnt/nfs/var/crash /mnt/nfs/dump
12) nfs which don't specify the nfs option in the /etc/kdump, with bind mounted path which is not under the nfs mount point path
# cat /etc/kdump | grep ^nfs
# mount.nfs 192.168.122.134:/opt/crash /mnt/nfs
# cat /etc/kdump | grep ^path
path /mnt/nfs/var/crash
# mount -o bind /mnt/nfs/var/crash /mnt/dump
13) ext4
14) ext4 with bind mounted path which is under the ext4 mount point path
15) ext4 with bind mounted path which is not under the ext4 mount point path
16) btrfs
17) btrfs with subvolume which mounts under mount point path
18) btrfs with subvolume which does not mount under mount point path
---
changelog:
v2:
- bisect the patch to make it clear to be reviewed
- add the necessary function decription
v1:
- add the judgment to make it work only in Atomic
---
Minfei Huang (5):
kdump-lib: Add the new function to enhance bind mounted judgement
kdump-lib: Add new function to judge the system is Atomic or not
Get the mount point correctly, if the device has several mount point
Fix the warning if the target path is bind mount in Atomic
dracut-module-setup: Enhance kdump to support the bind mounted feature
in Atomic
dracut-module-setup.sh | 46 ++++++++++++++++++++++++++++++++--
kdump-lib.sh | 67 ++++++++++++++++++++++++++++++++++++++++++++++++--
mkdumprd | 36 +++++++++++++++++++++------
3 files changed, 138 insertions(+), 11 deletions(-)
--
1.9.3
9 years
[PATCH RESEND] mkdumprd: Fix the bug to get persistent device correctly
by Minfei Huang
One filesystem has an unique uuid to detect itself. For btrfs, several
diskes can have the same uuid, and the soft link /dev/disk/by-uuid/$uuid
points the only one disk which is contained in the btrfs.
It may fails to filter out the disk by uuid, although there is a
filesystem on the disk, like btrfs.
In order to get the persistent device, we can use command "blkid".
Signed-off-by: Minfei Huang <mhuang(a)redhat.com>
---
mkdumprd | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/mkdumprd b/mkdumprd
index 4d251ba..5fb578b 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -27,14 +27,14 @@ perror() {
}
get_persistent_dev() {
- local i _tmp _dev
+ local i _tmp _dev _uuid
_dev=$(udevadm info --query=name --name="$1" 2>/dev/null)
[ -z "$_dev" ] && {
perror_exit "Kernel dev name of $1 is not found."
}
- for i in /dev/mapper/* /dev/disk/by-uuid/* /dev/disk/by-id/*; do
+ for i in /dev/mapper/* /dev/disk/by-id/*; do
_tmp=$(udevadm info --query=name --name="$i" 2>/dev/null)
if [ "$_tmp" = "$_dev" ]; then
echo $i
@@ -42,6 +42,18 @@ get_persistent_dev() {
fi
done
+ if [ "x" != "x""$(blkid $1 | grep "UUID")" ]; then
+ _uuid=`blkid $1 | grep "UUID" | awk '{print $2}'`
+ _uuid=${_uuid#*\"}
+ _uuid=${_uuid%\"*}
+ _dev=/dev/disk/by-uuid/$_uuid
+ _tmp=$(udevadm info --query=name --name=$_dev 2>/dev/null)
+ if [ "x" != "x"$_tmp ]; then
+ echo $_dev
+ return
+ fi
+ fi
+
perror "WARNING: Persistent device name of $1 not found. Using $1 as dump target name"
echo $1
}
--
1.9.3
9 years
[PATCH] makedumpfile: remove useless patches
by Baoquan He
In commit 12b38ac kexec-tools was rebased to 2.0.8. These back ported
patches become useless since then. So clean up them.
Signed-off-by: Baoquan He <bhe(a)redhat.com>
---
...de-an-option-to-use-new-kexec-system-call.patch | 443 ---------------------
...-disabling-exception-handling-when-buildi.patch | 37 --
...exec-ppc64-move-to-device-tree-version-17.patch | 42 --
....0.7-ppc64-kdump-Fix-ELF-header-endianess.patch | 36 --
4 files changed, 558 deletions(-)
delete mode 100644 kexec-tools-2.0.7-Provide-an-option-to-use-new-kexec-system-call.patch
delete mode 100644 kexec-tools-2.0.7-kexec-ppc64-disabling-exception-handling-when-buildi.patch
delete mode 100644 kexec-tools-2.0.7-kexec-ppc64-move-to-device-tree-version-17.patch
delete mode 100644 kexec-tools-2.0.7-ppc64-kdump-Fix-ELF-header-endianess.patch
diff --git a/kexec-tools-2.0.7-Provide-an-option-to-use-new-kexec-system-call.patch b/kexec-tools-2.0.7-Provide-an-option-to-use-new-kexec-system-call.patch
deleted file mode 100644
index 7a2b61e..0000000
--- a/kexec-tools-2.0.7-Provide-an-option-to-use-new-kexec-system-call.patch
+++ /dev/null
@@ -1,443 +0,0 @@
-From 046d1755d2bd723a11a180c265e61a884990712e Mon Sep 17 00:00:00 2001
-From: Vivek Goyal <vgoyal(a)redhat.com>
-Date: Mon, 18 Aug 2014 11:22:32 -0400
-Subject: [PATCH] kexec: Provide an option to use new kexec system call
-
-Hi,
-
-This is v2 of the patch. Since v1, I moved syscall implemented check littler
-earlier in the function as per the feedback.
-
-Now a new kexec syscall (kexec_file_load()) has been merged in upstream
-kernel. This system call takes file descriptors of kernel and initramfs
-as input (as opposed to list of segments to be loaded). This new system
-call allows for signature verification of the kernel being loaded.
-
-One use of signature verification of kernel is secureboot systems where
-we want to allow kexec into a kernel only if it is validly signed by
-a key system trusts.
-
-This patch provides and option --kexec-file-syscall (-s), to force use of
-new system call for kexec. Default is to continue to use old syscall.
-
-Currently only bzImage64 on x86_64 can be loaded using this system call.
-As kernel adds support for more arches and for more image types, kexec-tools
-can be modified accordingly.
-
-Signed-off-by: Vivek Goyal <vgoyal(a)redhat.com>
-Acked-by: Baoquan He <bhe(a)redhat.com>
-Signed-off-by: Simon Horman <horms(a)verge.net.au>
----
- kexec/arch/x86_64/kexec-bzImage64.c | 86 +++++++++++++++++++++++
- kexec/kexec-syscall.h | 32 +++++++++
- kexec/kexec.c | 132 +++++++++++++++++++++++++++++++++++-
- kexec/kexec.h | 11 ++-
- 4 files changed, 257 insertions(+), 4 deletions(-)
-
-diff --git a/kexec/arch/x86_64/kexec-bzImage64.c b/kexec/arch/x86_64/kexec-bzImage64.c
-index 1983bcf..8edb3e4 100644
---- a/kexec/arch/x86_64/kexec-bzImage64.c
-+++ b/kexec/arch/x86_64/kexec-bzImage64.c
-@@ -235,6 +235,89 @@ static int do_bzImage64_load(struct kexec_info *info,
- return 0;
- }
-
-+/* This assumes file is being loaded using file based kexec syscall */
-+int bzImage64_load_file(int argc, char **argv, struct kexec_info *info)
-+{
-+ int ret = 0;
-+ char *command_line = NULL, *tmp_cmdline = NULL;
-+ const char *ramdisk = NULL, *append = NULL;
-+ int entry_16bit = 0, entry_32bit = 0;
-+ int opt;
-+ int command_line_len;
-+
-+ /* See options.h -- add any more there, too. */
-+ static const struct option options[] = {
-+ KEXEC_ARCH_OPTIONS
-+ { "command-line", 1, 0, OPT_APPEND },
-+ { "append", 1, 0, OPT_APPEND },
-+ { "reuse-cmdline", 0, 0, OPT_REUSE_CMDLINE },
-+ { "initrd", 1, 0, OPT_RAMDISK },
-+ { "ramdisk", 1, 0, OPT_RAMDISK },
-+ { "real-mode", 0, 0, OPT_REAL_MODE },
-+ { "entry-32bit", 0, 0, OPT_ENTRY_32BIT },
-+ { 0, 0, 0, 0 },
-+ };
-+ static const char short_options[] = KEXEC_ARCH_OPT_STR "d";
-+
-+ while ((opt = getopt_long(argc, argv, short_options, options, 0)) != -1) {
-+ switch (opt) {
-+ default:
-+ /* Ignore core options */
-+ if (opt < OPT_ARCH_MAX)
-+ break;
-+ case OPT_APPEND:
-+ append = optarg;
-+ break;
-+ case OPT_REUSE_CMDLINE:
-+ tmp_cmdline = get_command_line();
-+ break;
-+ case OPT_RAMDISK:
-+ ramdisk = optarg;
-+ break;
-+ case OPT_REAL_MODE:
-+ entry_16bit = 1;
-+ break;
-+ case OPT_ENTRY_32BIT:
-+ entry_32bit = 1;
-+ break;
-+ }
-+ }
-+ command_line = concat_cmdline(tmp_cmdline, append);
-+ if (tmp_cmdline)
-+ free(tmp_cmdline);
-+ command_line_len = 0;
-+ if (command_line) {
-+ command_line_len = strlen(command_line) + 1;
-+ } else {
-+ command_line = strdup("\0");
-+ command_line_len = 1;
-+ }
-+
-+ if (entry_16bit || entry_32bit) {
-+ fprintf(stderr, "Kexec2 syscall does not support 16bit"
-+ " or 32bit entry yet\n");
-+ ret = -1;
-+ goto out;
-+ }
-+
-+ if (ramdisk) {
-+ info->initrd_fd = open(ramdisk, O_RDONLY);
-+ if (info->initrd_fd == -1) {
-+ fprintf(stderr, "Could not open initrd file %s:%s\n",
-+ ramdisk, strerror(errno));
-+ ret = -1;
-+ goto out;
-+ }
-+ }
-+
-+ info->command_line = command_line;
-+ info->command_line_len = command_line_len;
-+ return ret;
-+out:
-+ free(command_line);
-+ return ret;
-+}
-+
- int bzImage64_load(int argc, char **argv, const char *buf, off_t len,
- struct kexec_info *info)
- {
-@@ -247,6 +330,9 @@ int bzImage64_load(int argc, char **argv, const char *buf, off_t len,
- int opt;
- int result;
-
-+ if (info->file_mode)
-+ return bzImage64_load_file(argc, argv, info);
-+
- /* See options.h -- add any more there, too. */
- static const struct option options[] = {
- KEXEC_ARCH_OPTIONS
-diff --git a/kexec/kexec-syscall.h b/kexec/kexec-syscall.h
-index 6238044..ce2e20b 100644
---- a/kexec/kexec-syscall.h
-+++ b/kexec/kexec-syscall.h
-@@ -53,6 +53,19 @@
- #endif
- #endif /*ifndef __NR_kexec_load*/
-
-+#ifndef __NR_kexec_file_load
-+
-+#ifdef __x86_64__
-+#define __NR_kexec_file_load 320
-+#endif
-+
-+#ifndef __NR_kexec_file_load
-+/* system call not available for the arch */
-+#define __NR_kexec_file_load 0xffffffff /* system call not available */
-+#endif
-+
-+#endif /*ifndef __NR_kexec_file_load*/
-+
- struct kexec_segment;
-
- static inline long kexec_load(void *entry, unsigned long nr_segments,
-@@ -61,10 +74,29 @@ static inline long kexec_load(void *entry, unsigned long nr_segments,
- return (long) syscall(__NR_kexec_load, entry, nr_segments, segments, flags);
- }
-
-+static inline int is_kexec_file_load_implemented(void) {
-+ if (__NR_kexec_file_load != 0xffffffff)
-+ return 1;
-+ return 0;
-+}
-+
-+static inline long kexec_file_load(int kernel_fd, int initrd_fd,
-+ unsigned long cmdline_len, const char *cmdline_ptr,
-+ unsigned long flags)
-+{
-+ return (long) syscall(__NR_kexec_file_load, kernel_fd, initrd_fd,
-+ cmdline_len, cmdline_ptr, flags);
-+}
-+
- #define KEXEC_ON_CRASH 0x00000001
- #define KEXEC_PRESERVE_CONTEXT 0x00000002
- #define KEXEC_ARCH_MASK 0xffff0000
-
-+/* Flags for kexec file based system call */
-+#define KEXEC_FILE_UNLOAD 0x00000001
-+#define KEXEC_FILE_ON_CRASH 0x00000002
-+#define KEXEC_FILE_NO_INITRAMFS 0x00000004
-+
- /* These values match the ELF architecture values.
- * Unless there is a good reason that should continue to be the case.
- */
-diff --git a/kexec/kexec.c b/kexec/kexec.c
-index 133e622..7e7b604 100644
---- a/kexec/kexec.c
-+++ b/kexec/kexec.c
-@@ -51,6 +51,8 @@
- unsigned long long mem_min = 0;
- unsigned long long mem_max = ULONG_MAX;
- static unsigned long kexec_flags = 0;
-+/* Flags for kexec file (fd) based syscall */
-+static unsigned long kexec_file_flags = 0;
- int kexec_debug = 0;
-
- void dbgprint_mem_range(const char *prefix, struct memory_range *mr, int nr_mr)
-@@ -787,6 +789,19 @@ static int my_load(const char *type, int fileind, int argc, char **argv,
- return result;
- }
-
-+static int kexec_file_unload(unsigned long kexec_file_flags)
-+{
-+ int ret = 0;
-+
-+ ret = kexec_file_load(-1, -1, 0, NULL, kexec_file_flags);
-+ if (ret != 0) {
-+ /* The unload failed, print some debugging information */
-+ fprintf(stderr, "kexec_file_load(unload) failed\n: %s\n",
-+ strerror(errno));
-+ }
-+ return ret;
-+}
-+
- static int k_unload (unsigned long kexec_flags)
- {
- int result;
-@@ -925,6 +940,7 @@ void usage(void)
- " (0 means it's not jump back or\n"
- " preserve context)\n"
- " to original kernel.\n"
-+ " -s, --kexec-file-syscall Use file based syscall for kexec operation\n"
- " -d, --debug Enable debugging to help spot a failure.\n"
- "\n"
- "Supported kernel file types and options: \n");
-@@ -1072,6 +1088,82 @@ char *concat_cmdline(const char *base, const char *append)
- return cmdline;
- }
-
-+/* New file based kexec system call related code */
-+static int do_kexec_file_load(int fileind, int argc, char **argv,
-+ unsigned long flags) {
-+
-+ char *kernel;
-+ int kernel_fd, i;
-+ struct kexec_info info;
-+ int ret = 0;
-+ char *kernel_buf;
-+ off_t kernel_size;
-+
-+ memset(&info, 0, sizeof(info));
-+ info.segment = NULL;
-+ info.nr_segments = 0;
-+ info.entry = NULL;
-+ info.backup_start = 0;
-+ info.kexec_flags = flags;
-+
-+ info.file_mode = 1;
-+ info.initrd_fd = -1;
-+
-+ if (!is_kexec_file_load_implemented()) {
-+ fprintf(stderr, "syscall kexec_file_load not available.\n");
-+ return -1;
-+ }
-+
-+ if (argc - fileind <= 0) {
-+ fprintf(stderr, "No kernel specified\n");
-+ usage();
-+ return -1;
-+ }
-+
-+ kernel = argv[fileind];
-+
-+ kernel_fd = open(kernel, O_RDONLY);
-+ if (kernel_fd == -1) {
-+ fprintf(stderr, "Failed to open file %s:%s\n", kernel,
-+ strerror(errno));
-+ return -1;
-+ }
-+
-+ /* slurp in the input kernel */
-+ kernel_buf = slurp_decompress_file(kernel, &kernel_size);
-+
-+ for (i = 0; i < file_types; i++) {
-+ if (file_type[i].probe(kernel_buf, kernel_size) >= 0)
-+ break;
-+ }
-+
-+ if (i == file_types) {
-+ fprintf(stderr, "Cannot determine the file type " "of %s\n",
-+ kernel);
-+ return -1;
-+ }
-+
-+ ret = file_type[i].load(argc, argv, kernel_buf, kernel_size, &info);
-+ if (ret < 0) {
-+ fprintf(stderr, "Cannot load %s\n", kernel);
-+ return ret;
-+ }
-+
-+ /*
-+ * If there is no initramfs, set KEXEC_FILE_NO_INITRAMFS flag so that
-+ * kernel does not return error with negative initrd_fd.
-+ */
-+ if (info.initrd_fd == -1)
-+ info.kexec_flags |= KEXEC_FILE_NO_INITRAMFS;
-+
-+ ret = kexec_file_load(kernel_fd, info.initrd_fd, info.command_line_len,
-+ info.command_line, info.kexec_flags);
-+ if (ret != 0)
-+ fprintf(stderr, "kexec_file_load failed: %s\n",
-+ strerror(errno));
-+ return ret;
-+}
-+
-
- int main(int argc, char *argv[])
- {
-@@ -1083,6 +1175,7 @@ int main(int argc, char *argv[])
- int do_ifdown = 0;
- int do_unload = 0;
- int do_reuse_initrd = 0;
-+ int do_kexec_file_syscall = 0;
- void *entry = 0;
- char *type = 0;
- char *endptr;
-@@ -1095,6 +1188,23 @@ int main(int argc, char *argv[])
- };
- static const char short_options[] = KEXEC_ALL_OPT_STR;
-
-+ /*
-+ * First check if --use-kexec-file-syscall is set. That changes lot of
-+ * things
-+ */
-+ while ((opt = getopt_long(argc, argv, short_options,
-+ options, 0)) != -1) {
-+ switch(opt) {
-+ case OPT_KEXEC_FILE_SYSCALL:
-+ do_kexec_file_syscall = 1;
-+ break;
-+ }
-+ }
-+
-+ /* Reset getopt for the next pass. */
-+ opterr = 1;
-+ optind = 1;
-+
- while ((opt = getopt_long(argc, argv, short_options,
- options, 0)) != -1) {
- switch(opt) {
-@@ -1127,6 +1237,8 @@ int main(int argc, char *argv[])
- do_shutdown = 0;
- do_sync = 0;
- do_unload = 1;
-+ if (do_kexec_file_syscall)
-+ kexec_file_flags |= KEXEC_FILE_UNLOAD;
- break;
- case OPT_EXEC:
- do_load = 0;
-@@ -1169,7 +1281,10 @@ int main(int argc, char *argv[])
- do_exec = 0;
- do_shutdown = 0;
- do_sync = 0;
-- kexec_flags = KEXEC_ON_CRASH;
-+ if (do_kexec_file_syscall)
-+ kexec_file_flags |= KEXEC_FILE_ON_CRASH;
-+ else
-+ kexec_flags = KEXEC_ON_CRASH;
- break;
- case OPT_MEM_MIN:
- mem_min = strtoul(optarg, &endptr, 0);
-@@ -1194,6 +1309,9 @@ int main(int argc, char *argv[])
- case OPT_REUSE_INITRD:
- do_reuse_initrd = 1;
- break;
-+ case OPT_KEXEC_FILE_SYSCALL:
-+ /* We already parsed it. Nothing to do. */
-+ break;
- default:
- break;
- }
-@@ -1238,10 +1356,18 @@ int main(int argc, char *argv[])
- }
-
- if (do_unload) {
-- result = k_unload(kexec_flags);
-+ if (do_kexec_file_syscall)
-+ result = kexec_file_unload(kexec_file_flags);
-+ else
-+ result = k_unload(kexec_flags);
- }
- if (do_load && (result == 0)) {
-- result = my_load(type, fileind, argc, argv, kexec_flags, entry);
-+ if (do_kexec_file_syscall)
-+ result = do_kexec_file_load(fileind, argc, argv,
-+ kexec_file_flags);
-+ else
-+ result = my_load(type, fileind, argc, argv,
-+ kexec_flags, entry);
- }
- /* Don't shutdown unless there is something to reboot to! */
- if ((result == 0) && (do_shutdown || do_exec) && !kexec_loaded()) {
-diff --git a/kexec/kexec.h b/kexec/kexec.h
-index 2fad7dc..4be2b2f 100644
---- a/kexec/kexec.h
-+++ b/kexec/kexec.h
-@@ -156,6 +156,13 @@ struct kexec_info {
- unsigned long kexec_flags;
- unsigned long backup_src_start;
- unsigned long backup_src_size;
-+ /* Set to 1 if we are using kexec file syscall */
-+ unsigned long file_mode :1;
-+
-+ /* Filled by kernel image processing code */
-+ int initrd_fd;
-+ char *command_line;
-+ int command_line_len;
- };
-
- struct arch_map_entry {
-@@ -207,6 +214,7 @@ extern int file_types;
- #define OPT_UNLOAD 'u'
- #define OPT_TYPE 't'
- #define OPT_PANIC 'p'
-+#define OPT_KEXEC_FILE_SYSCALL 's'
- #define OPT_MEM_MIN 256
- #define OPT_MEM_MAX 257
- #define OPT_REUSE_INITRD 258
-@@ -230,9 +238,10 @@ extern int file_types;
- { "mem-min", 1, 0, OPT_MEM_MIN }, \
- { "mem-max", 1, 0, OPT_MEM_MAX }, \
- { "reuseinitrd", 0, 0, OPT_REUSE_INITRD }, \
-+ { "kexec-file-syscall", 0, 0, OPT_KEXEC_FILE_SYSCALL }, \
- { "debug", 0, 0, OPT_DEBUG }, \
-
--#define KEXEC_OPT_STR "h?vdfxluet:p"
-+#define KEXEC_OPT_STR "h?vdfxluet:ps"
-
- extern void dbgprint_mem_range(const char *prefix, struct memory_range *mr, int nr_mr);
- extern void die(const char *fmt, ...)
---
-1.9.0
-
diff --git a/kexec-tools-2.0.7-kexec-ppc64-disabling-exception-handling-when-buildi.patch b/kexec-tools-2.0.7-kexec-ppc64-disabling-exception-handling-when-buildi.patch
deleted file mode 100644
index 4c92242..0000000
--- a/kexec-tools-2.0.7-kexec-ppc64-disabling-exception-handling-when-buildi.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From 335bad77fb0750f3961aa8df47c83a522d212b08 Mon Sep 17 00:00:00 2001
-From: Laurent Dufour <ldufour(a)linux.vnet.ibm.com>
-Date: Tue, 22 Jul 2014 18:22:28 +0200
-Subject: [PATCH] kexec/ppc64: disabling exception handling when building the
- purgatory
-
-Some Linux distributions would like to turn on the GCC exception handling
-by default. As this option introduces symbols in the built code that are
-defined in a separate shared library, this is not a good idea to have such
-an option activated when building the purgatory.
-
-This patch forces the exception handling to be turned off when building the
-purgatory on ppc64 BE and LE.
-
-Signed-off-by: Laurent Dufour <ldufour(a)linux.vnet.ibm.com>
-Signed-off-by: Simon Horman <horms(a)verge.net.au>
----
- purgatory/arch/ppc64/Makefile | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/purgatory/arch/ppc64/Makefile b/purgatory/arch/ppc64/Makefile
-index 712e2b1..6c58fa2 100644
---- a/purgatory/arch/ppc64/Makefile
-+++ b/purgatory/arch/ppc64/Makefile
-@@ -9,7 +9,8 @@ ppc64_PURGATORY_SRCS += purgatory/arch/ppc64/console-ppc64.c
- ppc64_PURGATORY_SRCS += purgatory/arch/ppc64/crashdump_backup.c
- ppc64_PURGATORY_SRCS += purgatory/arch/ppc64/misc.S
-
--ppc64_PURGATORY_EXTRA_CFLAGS += -m64 -msoft-float -fno-stack-protector
-+ppc64_PURGATORY_EXTRA_CFLAGS += -m64 -msoft-float -fno-stack-protector \
-+ -fno-exceptions
- ppc64_PURGATORY_EXTRA_ASFLAGS += -m64
- ifeq ($(SUBARCH),BE)
- ppc64_PURGATORY_EXTRA_LDFLAGS += -melf64ppc
---
-1.9.3
-
diff --git a/kexec-tools-2.0.7-kexec-ppc64-move-to-device-tree-version-17.patch b/kexec-tools-2.0.7-kexec-ppc64-move-to-device-tree-version-17.patch
deleted file mode 100644
index c7a4bb4..0000000
--- a/kexec-tools-2.0.7-kexec-ppc64-move-to-device-tree-version-17.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From 2ca220389d212249cc842d49084c95e524fb299b Mon Sep 17 00:00:00 2001
-From: Laurent Dufour <ldufour(a)linux.vnet.ibm.com>
-Date: Mon, 16 Jun 2014 14:42:43 +0200
-Subject: [PATCH] kexec/ppc64: move to device tree version 17
-
-Kernel commit e6a6928c3ea1d0195ed75a091e345696b916c09b changed the way the
-device tree is processed in the kernel. Now version 2 is no more supported.
-
-This patch move the version of the device tree generated in ppc64
-environment from 2 to 17, allowing to kexec kernel 3.16.
-
-In addition, automates the define of NEED_STRUCTURE_BLOCK_EXTRA_PAD which
-should not be set for DT version 16 and above.
-
-Signed-off-by: Laurent Dufour <ldufour(a)linux.vnet.ibm.com>
-Signed-off-by: Simon Horman <horms(a)verge.net.au>
----
- kexec/arch/ppc64/kexec-ppc64.h | 8 +++++---
- 1 file changed, 5 insertions(+), 3 deletions(-)
-
-diff --git a/kexec/arch/ppc64/kexec-ppc64.h b/kexec/arch/ppc64/kexec-ppc64.h
-index 9a0aecf..89ee942 100644
---- a/kexec/arch/ppc64/kexec-ppc64.h
-+++ b/kexec/arch/ppc64/kexec-ppc64.h
-@@ -6,9 +6,11 @@
- #define CORE_TYPE_ELF32 1
- #define CORE_TYPE_ELF64 2
-
--#define BOOT_BLOCK_VERSION 2
--#define BOOT_BLOCK_LAST_COMP_VERSION 2
--#define NEED_STRUCTURE_BLOCK_EXTRA_PAD
-+#define BOOT_BLOCK_VERSION 17
-+#define BOOT_BLOCK_LAST_COMP_VERSION 17
-+#if (BOOT_BLOCK_VERSION < 16)
-+# define NEED_STRUCTURE_BLOCK_EXTRA_PAD
-+#endif
- #define HAVE_DYNAMIC_MEMORY
- #define NEED_RESERVE_DTB
-
---
-1.9.3
-
diff --git a/kexec-tools-2.0.7-ppc64-kdump-Fix-ELF-header-endianess.patch b/kexec-tools-2.0.7-ppc64-kdump-Fix-ELF-header-endianess.patch
deleted file mode 100644
index eb6bbd7..0000000
--- a/kexec-tools-2.0.7-ppc64-kdump-Fix-ELF-header-endianess.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From 45b33eb2e70cd44f41abf1058a92659cb4315011 Mon Sep 17 00:00:00 2001
-From: Laurent Dufour <ldufour(a)linux.vnet.ibm.com>
-Date: Fri, 25 Jul 2014 17:07:49 +0200
-Subject: [PATCH] ppc64/kdump: Fix ELF header endianess
-
-The ELF header created among the loading of the kdump kernel should be
-flagged using the current endianess and not always as big endian.
-
-Without this patch the data exposed in /proc/vmcore are not readable when
-running in LE mode.
-
-Signed-off-by: Laurent Dufour <ldufour(a)linux.vnet.ibm.com>
-Signed-off-by: Simon Horman <horms(a)verge.net.au>
----
- kexec/arch/ppc64/crashdump-ppc64.c | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/kexec/arch/ppc64/crashdump-ppc64.c b/kexec/arch/ppc64/crashdump-ppc64.c
-index 00a0e63..6214b83 100644
---- a/kexec/arch/ppc64/crashdump-ppc64.c
-+++ b/kexec/arch/ppc64/crashdump-ppc64.c
-@@ -38,7 +38,11 @@
- static struct crash_elf_info elf_info64 =
- {
- class: ELFCLASS64,
-+#if BYTE_ORDER == LITTLE_ENDIAN
-+ data: ELFDATA2LSB,
-+#else
- data: ELFDATA2MSB,
-+#endif
- machine: EM_PPC64,
- page_offset: PAGE_OFFSET,
- lowmem_limit: MAXMEM,
---
-1.9.3
-
--
1.9.3
9 years
[PATCH v3] Remove duplicate slash in save path
by Minfei Huang
Now kdump cannt parse the path correctly, if the path contains
duplicated "/". Following is an example to explain it detail. (the
directory /mnt is a mount point which is mounted a block device)
path //mnt/var/crash
Then the warning will raise.
Force rebuild /boot/initramfs-3.19.1kdump.img
Rebuilding /boot/initramfs-3.19.1kdump.img
df: ‘/mnt///mnt/var/crash’: No such file or directory
/sbin/mkdumprd: line 239: [: -lt: unary operator expected
kexec: loaded kdump kernel
Starting kdump: [OK]
For above case, kdump fails to check the fs size, due to the incorrect
path.
In kdump code flow, we will cut out the mount point(/mnt) from the
path(//mnt/var/crash). But the mount point cannt match the path, because
of the duplicated "/".
To fix it, we will strip the duplicated "/" firstly.
Signed-off-by: Minfei Huang <mhuang(a)redhat.com>
---
changelog:
v2
- change the subject to match the patch properly
v1:
- change the implementation using "tr" to strip the duplicated "/"
---
dracut-module-setup.sh | 11 ++++++-----
mkdumprd | 3 +++
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 4641025..540e154 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -311,15 +311,17 @@ kdump_install_net() {
default_dump_target_install_conf()
{
local _target _fstype
- local _s _t
local _mntpoint
- local _path _save_path
+ local _save_path
is_user_configured_dump_target && return
_save_path=$(get_option_value "path")
[ -z "$_save_path" ] && _save_path=$DEFAULT_PATH
+ # strip the duplicated "/"
+ _save_path=$(echo $_save_path | tr -s /)
+
_mntpoint=$(get_mntpoint_from_path $_save_path)
_target=$(get_target_from_path $_save_path)
if [ "$_mntpoint" != "/" ]; then
@@ -334,13 +336,12 @@ default_dump_target_install_conf()
echo "$_fstype $_target" >> ${initdir}/tmp/$$-kdump.conf
- _path=${_save_path##"$_mntpoint"}
+ _save_path=${_save_path##"$_mntpoint"}
#erase the old path line, then insert the parsed path
sed -i "/^path/d" ${initdir}/tmp/$$-kdump.conf
- echo "path $_path" >> ${initdir}/tmp/$$-kdump.conf
+ echo "path $_save_path" >> ${initdir}/tmp/$$-kdump.conf
fi
-
}
#install kdump.conf and what user specifies in kdump.conf
diff --git a/mkdumprd b/mkdumprd
index 4d251ba..7c572a7 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -13,6 +13,9 @@ conf_file="/etc/kdump.conf"
SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa"
SAVE_PATH=$(grep ^path $conf_file| cut -d' ' -f2)
[ -z "$SAVE_PATH" ] && SAVE_PATH=$DEFAULT_PATH
+# strip the duplicated "/"
+SAVE_PATH=$(echo $SAVE_PATH | tr -s /)
+
extra_modules=""
dracut_args=("--hostonly" "-o" "plymouth dash resume")
OVERRIDE_RESETTABLE=0
--
1.9.3
9 years
[PATCH v2] dracut-module-setup: Fix the issue to cut out substring correctly
by Minfei Huang
Now kdump cannt parse the path correctly, if the path contains
duplicated "/". Following is an example to explain it detail. (the
directory /mnt is a mount point which is mounted a block device)
path //mnt/var/crash
Then the warning will raise, as kdump cannt cut out the substring
correctly.
Force rebuild /boot/initramfs-3.19.1kdump.img
Rebuilding /boot/initramfs-3.19.1kdump.img
df: ‘/mnt///mnt/var/crash’: No such file or directory
/sbin/mkdumprd: line 239: [: -lt: unary operator expected
kexec: loaded kdump kernel
Starting kdump: [OK]
To fix it, we will strip the duplicated "/" before.
Signed-off-by: Minfei Huang <mhuang(a)redhat.com>
---
changelog:
v1:
- change the implementation using "tr" to strip the duplicated "/"
---
dracut-module-setup.sh | 11 ++++++-----
mkdumprd | 3 +++
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 4641025..540e154 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -311,15 +311,17 @@ kdump_install_net() {
default_dump_target_install_conf()
{
local _target _fstype
- local _s _t
local _mntpoint
- local _path _save_path
+ local _save_path
is_user_configured_dump_target && return
_save_path=$(get_option_value "path")
[ -z "$_save_path" ] && _save_path=$DEFAULT_PATH
+ # strip the duplicated "/"
+ _save_path=$(echo $_save_path | tr -s /)
+
_mntpoint=$(get_mntpoint_from_path $_save_path)
_target=$(get_target_from_path $_save_path)
if [ "$_mntpoint" != "/" ]; then
@@ -334,13 +336,12 @@ default_dump_target_install_conf()
echo "$_fstype $_target" >> ${initdir}/tmp/$$-kdump.conf
- _path=${_save_path##"$_mntpoint"}
+ _save_path=${_save_path##"$_mntpoint"}
#erase the old path line, then insert the parsed path
sed -i "/^path/d" ${initdir}/tmp/$$-kdump.conf
- echo "path $_path" >> ${initdir}/tmp/$$-kdump.conf
+ echo "path $_save_path" >> ${initdir}/tmp/$$-kdump.conf
fi
-
}
#install kdump.conf and what user specifies in kdump.conf
diff --git a/mkdumprd b/mkdumprd
index 4d251ba..7c572a7 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -13,6 +13,9 @@ conf_file="/etc/kdump.conf"
SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa"
SAVE_PATH=$(grep ^path $conf_file| cut -d' ' -f2)
[ -z "$SAVE_PATH" ] && SAVE_PATH=$DEFAULT_PATH
+# strip the duplicated "/"
+SAVE_PATH=$(echo $SAVE_PATH | tr -s /)
+
extra_modules=""
dracut_args=("--hostonly" "-o" "plymouth dash resume")
OVERRIDE_RESETTABLE=0
--
1.9.3
9 years
[PATCH] kdump-lib: Add new function to fix duplicated "/" in path
by Minfei Huang
Now kdump cannt parse the path correctly, if the path contains
duplicated "/". Following is an example to explain it detail.
path //mnt/var/crash
Then the warning will raise, as kdump cannt parse this path correctly.
Force rebuild /boot/initramfs-3.19.1kdump.img
Rebuilding /boot/initramfs-3.19.1kdump.img
df: ‘/mnt///mnt/var/crash’: No such file or directory
/sbin/mkdumprd: line 239: [: -lt: unary operator expected
kexec: loaded kdump kernel
Starting kdump: [OK]
Kdump fails to cut out the substring, if the string contains dumplicated
"/".
Add the new function which it will cut out the substring accurately.
Signed-off-by: Minfei Huang <mhuang(a)redhat.com>
---
dracut-module-setup.sh | 7 +++----
kdump-lib.sh | 8 ++++++++
mkdumprd | 2 +-
3 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 4641025..477ede1 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -311,9 +311,8 @@ kdump_install_net() {
default_dump_target_install_conf()
{
local _target _fstype
- local _s _t
local _mntpoint
- local _path _save_path
+ local _save_path
is_user_configured_dump_target && return
@@ -334,11 +333,11 @@ default_dump_target_install_conf()
echo "$_fstype $_target" >> ${initdir}/tmp/$$-kdump.conf
- _path=${_save_path##"$_mntpoint"}
+ _save_path=$(cut_out_substring $_save_path $_mntpoint)
#erase the old path line, then insert the parsed path
sed -i "/^path/d" ${initdir}/tmp/$$-kdump.conf
- echo "path $_path" >> ${initdir}/tmp/$$-kdump.conf
+ echo "path $_save_path" >> ${initdir}/tmp/$$-kdump.conf
fi
}
diff --git a/kdump-lib.sh b/kdump-lib.sh
index f24f08d..ab01d74 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -188,3 +188,11 @@ is_ipv6_target()
_server=${_server:-$_server_tmp}
echo $_server | grep -q ":"
}
+
+cut_out_substring()
+{
+ # filter out the duplicated "/"
+ local _main_str=$(echo $1|sed "s#/\{1,\}#/#g")
+ local _sub_str=$(echo $2|sed "s#/\{1,\}#/#g")
+ echo ${_main_str#*"$_sub_str"}
+}
diff --git a/mkdumprd b/mkdumprd
index 4d251ba..a8f9cbb 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -364,7 +364,7 @@ handle_default_dump_target()
_mntpoint=$(get_mntpoint_from_path $SAVE_PATH)
_target=$(get_target_from_path $SAVE_PATH)
if [ "$_mntpoint" != "/" ]; then
- SAVE_PATH=${SAVE_PATH##"$_mntpoint"}
+ SAVE_PATH=$(cut_out_substring $SAVE_PATH $_mntpoint)
_fstype=$(get_fs_type_from_target $_target)
if $(is_fs_type_nfs $_fstype); then
--
1.9.3
9 years
[PATCH 0/3 v2] Enhance kdump to support bind mounted feature in Atomic
by Minfei Huang
These patchset bases on the patch:
Author: Minfei Huang <mhuang(a)redhat.com>
Date: Tue Mar 3 20:54:54 2015 +0800
kdump-lib: Add new function to fix duplicated "/" in path
Enhance kdump to support bind mounted target in Atomic, since kdump
cann't parse the bind mounted path.
Following is the testcases which kdump can generate the core sucessfully.
1) rootfs, default path / specified path
2) rootfs with bind mounted path which is in the rootfs device
# cat /etc/kdump | grep ^path
path /var/crash
# mount -o bind /var/crash /mnt/crash
4) rootfs with bind mounted path which is not in the rootfs device
# cat /etc/kdump | grep ^path
path /var/crash
# mount /dev/vdb /mnt
# mount -o bind /var/crash /mnt/crash
5) no-rootfs
6) no-rootfs with bind mounted path which is in the same device
7) no-rootfs with bind mounted path which is not in the same device
8) nfs
9) nfs with bind mounted path which is under the nfs mount point path
# cat /etc/kdump | grep ^nfs
nfs 192.168.122.134:/opt/crash
# cat /etc/kdump | grep ^path
path /var/crash
# mount.nfs 192.168.122.134:/opt/crash /mnt/nfs
# mount -o bind /mnt/nfs/var/crash /mnt/nfs/dump
10) nfs with bind mounted path which is not under the nfs mount point path
# cat /etc/kdump | grep ^nfs
nfs 192.168.122.134:/opt/crash
# cat /etc/kdump | grep ^path
path /var/crash
# mount.nfs 192.168.122.134:/opt/crash /mnt/nfs
# mount -o bind /mnt/nfs/var/crash /mnt/dump
11) nfs which don't specify the nfs option in the /etc/kdump, with bind mounted path which is under the nfs mount point path
# cat /etc/kdump | grep ^nfs
# mount.nfs 192.168.122.134:/opt/crash /mnt/nfs
# cat /etc/kdump | grep ^path
path /mnt/nfs/var/crash
# mount -o bind /mnt/nfs/var/crash /mnt/nfs/dump
12) nfs which don't specify the nfs option in the /etc/kdump, with bind mounted path which is not under the nfs mount point path
# cat /etc/kdump | grep ^nfs
# mount.nfs 192.168.122.134:/opt/crash /mnt/nfs
# cat /etc/kdump | grep ^path
path /mnt/nfs/var/crash
# mount -o bind /mnt/nfs/var/crash /mnt/dump
13) ext4
14) ext4 with bind mounted path which is under the ext4 mount point path
15) ext4 with bind mounted path which is not under the ext4 mount point path
16) btrfs
17) btrfs with subvolume which mounts under mount point path
18) btrfs with subvolume which does not mount under mount point path
Minfei Huang (3):
kdump-lib: Add the new function to enhance bind mounted judgement
kdump-lib: Get the mount point correctly, if the device has several
mount point
dracut-module-setup: Enhance kdump to support the bind mounted feature
in Atomic
===
v1:
- add the judgment to make it work only in Atomic
===
dracut-module-setup.sh | 39 ++++++++++++++++++++++++++++++++++-----
kdump-lib.sh | 48 +++++++++++++++++++++++++++++++++++++++++++++++-
mkdumprd | 32 +++++++++++++++++++++++++-------
3 files changed, 106 insertions(+), 13 deletions(-)
--
1.9.3
9 years