[PATCH v2] kdumpctl: display message while waiting for the single instance lock
by WANG Chao
Vivek suggested we should display message while waiting for the lock,
because the waiting could be long and user will have no idea what's
going on.
So we will repeat the following message every 5 seconds while waiting:
"Another app is currently holding the kdump lock; waiting for it to exit..."
Thanks Vivek for providing a more comprehensive message.
Signed-off-by: WANG Chao <chaowang(a)redhat.com>
---
kdumpctl | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/kdumpctl b/kdumpctl
index 9cae0c4..0025620 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -20,8 +20,18 @@ fi
single_instance_lock()
{
+ local rc timeout=5
+
exec 9>/var/lock/kdump
- flock 9
+
+ flock -n 9
+ rc=$?
+
+ while [ $rc -ne 0 ]; do
+ echo "Another app is currently holding the kdump lock; waiting for it to exit..."
+ flock -w $timeout 9
+ rc=$?
+ done
}
# remove_cmdline_param <kernel cmdline> <param1> [<param2>] ... [<paramN>]
--
1.9.3
9 years, 8 months
[PATCH] kdumpctl: display message while waiting for the single instance lock
by WANG Chao
Vivek suggested we should display message while waiting for the lock,
because the waiting could be long and user will have no idea what's
going on.
So we will repeat the following message every 5 seconds while waiting:
Another kdump instance is hoding the lock;
Waiting for it to exit...
Signed-off-by: WANG Chao <chaowang(a)redhat.com>
---
kdumpctl | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/kdumpctl b/kdumpctl
index 9cae0c4..5b5bb83 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -20,8 +20,20 @@ fi
single_instance_lock()
{
+ local rc timeout=5
+
exec 9>/var/lock/kdump
- flock 9
+
+ flock -n 9
+ rc=$?
+
+ while [ $rc -ne 0 ]; do
+ echo "Another kdump instance is hoding the lock;"
+ echo "Waiting for it to exit..."
+ echo
+ flock -w $timeout 9
+ rc=$?
+ done
}
# remove_cmdline_param <kernel cmdline> <param1> [<param2>] ... [<paramN>]
--
1.9.3
9 years, 8 months
[PATCH 1/5] Introduce the mdf_pfn_t type.
by Baoquan He
This is a backport of the following upstream commit. Late back ported
commit depends on it.
commit 9dc6440c63320066bc6344c6e3ca3c3af88bcc42
Author: Petr Tesarik <ptesarik(a)suse.cz>
Date: Thu Apr 24 10:58:43 2014 +0900
[PATCH v3] Introduce the mdf_pfn_t type.
Replace unsigned long long with mdf_pfn_t where:
a. the variable denotes a PFN
b. the variable is a number of pages
The number of pages is converted to a mdf_pfn_t, because it is a result
of subtracting two PFNs or incremented in a loop over a range of PFNs,
so it can get as large as a PFN.
Note: The mdf_ (i.e. makedumpfile) prefix is used to prevent possible
conflicts with other software that defines a pfn_t type.
Signed-off-by: Petr Tesarik <ptesarik(a)suse.cz>
Signed-off-by: Baoquan He <bhe(a)redhat.com>
---
...makedumpfile-Introduce-the-mdf_pfn_t-type.patch | 738 +++++++++++++++++++++
kexec-tools.spec | 2 +
2 files changed, 740 insertions(+)
create mode 100644 kexec-tools-2.0.4-makedumpfile-Introduce-the-mdf_pfn_t-type.patch
diff --git a/kexec-tools-2.0.4-makedumpfile-Introduce-the-mdf_pfn_t-type.patch b/kexec-tools-2.0.4-makedumpfile-Introduce-the-mdf_pfn_t-type.patch
new file mode 100644
index 0000000..14fad22
--- /dev/null
+++ b/kexec-tools-2.0.4-makedumpfile-Introduce-the-mdf_pfn_t-type.patch
@@ -0,0 +1,738 @@
+From 9dc6440c63320066bc6344c6e3ca3c3af88bcc42 Mon Sep 17 00:00:00 2001
+From: Petr Tesarik <ptesarik(a)suse.cz>
+Date: Thu, 24 Apr 2014 10:58:43 +0900
+Subject: [PATCH] [PATCH v3] Introduce the mdf_pfn_t type.
+
+Replace unsigned long long with mdf_pfn_t where:
+
+ a. the variable denotes a PFN
+ b. the variable is a number of pages
+
+The number of pages is converted to a mdf_pfn_t, because it is a result
+of subtracting two PFNs or incremented in a loop over a range of PFNs,
+so it can get as large as a PFN.
+
+Note: The mdf_ (i.e. makedumpfile) prefix is used to prevent possible
+conflicts with other software that defines a pfn_t type.
+
+Signed-off-by: Petr Tesarik <ptesarik(a)suse.cz>
+Signed-off-by: Baoquan He <bhe(a)redhat.com>
+---
+ makedumpfile.c | 152 ++++++++++++++++++++++++++++++---------------------------
+ makedumpfile.h | 48 +++++++++---------
+ sadump_info.c | 15 +++---
+ sadump_info.h | 4 +-
+ 4 files changed, 115 insertions(+), 104 deletions(-)
+
+diff --git a/makedumpfile.c b/makedumpfile.c
+index ce4a866..0b31932 100644
+--- a/makedumpfile-1.5.6/makedumpfile.c
++++ b/makedumpfile-1.5.6/makedumpfile.c
+@@ -37,7 +37,7 @@ struct DumpInfo *info = NULL;
+
+ char filename_stdout[] = FILENAME_STDOUT;
+
+-static void first_cycle(unsigned long long start, unsigned long long max, struct cycle *cycle)
++static void first_cycle(mdf_pfn_t start, mdf_pfn_t max, struct cycle *cycle)
+ {
+ cycle->start_pfn = round(start, info->pfn_cyclic);
+ cycle->end_pfn = cycle->start_pfn + info->pfn_cyclic;
+@@ -46,7 +46,7 @@ static void first_cycle(unsigned long long start, unsigned long long max, struct
+ cycle->end_pfn = max;
+ }
+
+-static void update_cycle(unsigned long long max, struct cycle *cycle)
++static void update_cycle(mdf_pfn_t max, struct cycle *cycle)
+ {
+ cycle->start_pfn= cycle->end_pfn;
+ cycle->end_pfn= cycle->start_pfn + info->pfn_cyclic;
+@@ -55,7 +55,7 @@ static void update_cycle(unsigned long long max, struct cycle *cycle)
+ cycle->end_pfn = max;
+ }
+
+-static int end_cycle(unsigned long long max, struct cycle *cycle)
++static int end_cycle(mdf_pfn_t max, struct cycle *cycle)
+ {
+ return (cycle->start_pfn >= max)?TRUE:FALSE;
+ }
+@@ -67,15 +67,15 @@ static int end_cycle(unsigned long long max, struct cycle *cycle)
+ /*
+ * The numbers of the excluded pages
+ */
+-unsigned long long pfn_zero;
+-unsigned long long pfn_memhole;
+-unsigned long long pfn_cache;
+-unsigned long long pfn_cache_private;
+-unsigned long long pfn_user;
+-unsigned long long pfn_free;
+-unsigned long long pfn_hwpoison;
++mdf_pfn_t pfn_zero;
++mdf_pfn_t pfn_memhole;
++mdf_pfn_t pfn_cache;
++mdf_pfn_t pfn_cache_private;
++mdf_pfn_t pfn_user;
++mdf_pfn_t pfn_free;
++mdf_pfn_t pfn_hwpoison;
+
+-unsigned long long num_dumped;
++mdf_pfn_t num_dumped;
+
+ int retcd = FAILED; /* return code */
+
+@@ -122,7 +122,9 @@ unsigned long long
+ ptom_xen(unsigned long long paddr)
+ {
+ unsigned long mfn;
+- unsigned long long maddr, pfn, mfn_idx, frame_idx;
++ unsigned long long maddr;
++ mdf_pfn_t pfn;
++ unsigned long long mfn_idx, frame_idx;
+
+ pfn = paddr_to_pfn(paddr);
+ mfn_idx = pfn / MFNS_PER_FRAME;
+@@ -226,12 +228,13 @@ is_in_same_page(unsigned long vaddr1, unsigned long vaddr2)
+ }
+
+ #define BITMAP_SECT_LEN 4096
+-static inline int is_dumpable(struct dump_bitmap *, unsigned long long);
+-static inline int is_dumpable_cyclic(char *bitmap, unsigned long long, struct cycle *cycle);
++static inline int is_dumpable(struct dump_bitmap *, mdf_pfn_t);
++static inline int is_dumpable_cyclic(char *bitmap, mdf_pfn_t, struct cycle *cycle);
+ unsigned long
+-pfn_to_pos(unsigned long long pfn)
++pfn_to_pos(mdf_pfn_t pfn)
+ {
+- unsigned long desc_pos, i;
++ unsigned long desc_pos;
++ mdf_pfn_t i;
+
+ desc_pos = info->valid_pages[pfn / BITMAP_SECT_LEN];
+ for (i = round(pfn, BITMAP_SECT_LEN); i < pfn; i++)
+@@ -246,7 +249,7 @@ read_page_desc(unsigned long long paddr, page_desc_t *pd)
+ {
+ struct disk_dump_header *dh;
+ unsigned long desc_pos;
+- unsigned long long pfn;
++ mdf_pfn_t pfn;
+ off_t offset;
+
+ /*
+@@ -2375,8 +2378,8 @@ pgdat4:
+ }
+
+ void
+-dump_mem_map(unsigned long long pfn_start,
+- unsigned long long pfn_end, unsigned long mem_map, int num_mm)
++dump_mem_map(mdf_pfn_t pfn_start, mdf_pfn_t pfn_end,
++ unsigned long mem_map, int num_mm)
+ {
+ struct mem_map_data *mmd;
+
+@@ -2802,7 +2805,7 @@ int
+ get_mm_sparsemem(void)
+ {
+ unsigned int section_nr, mem_section_size, num_section;
+- unsigned long long pfn_start, pfn_end;
++ mdf_pfn_t pfn_start, pfn_end;
+ unsigned long section, mem_map;
+ unsigned long *mem_sec = NULL;
+
+@@ -2886,7 +2889,7 @@ get_mem_map_without_mm(void)
+ int
+ get_mem_map(void)
+ {
+- unsigned long long max_pfn = 0;
++ mdf_pfn_t max_pfn = 0;
+ unsigned int i;
+ int ret;
+
+@@ -2944,7 +2947,7 @@ initialize_bitmap_memory(void)
+ struct dump_bitmap *bmp;
+ off_t bitmap_offset;
+ off_t bitmap_len, max_sect_len;
+- unsigned long pfn;
++ mdf_pfn_t pfn;
+ int i, j;
+ long block_size;
+
+@@ -3309,8 +3312,7 @@ initialize_2nd_bitmap(struct dump_bitmap *bitmap)
+ }
+
+ int
+-set_bitmap(struct dump_bitmap *bitmap, unsigned long long pfn,
+- int val)
++set_bitmap(struct dump_bitmap *bitmap, mdf_pfn_t pfn, int val)
+ {
+ int byte, bit;
+ off_t old_offset, new_offset;
+@@ -3358,7 +3360,7 @@ set_bitmap(struct dump_bitmap *bitmap, unsigned long long pfn,
+ }
+
+ int
+-set_bitmap_cyclic(char *bitmap, unsigned long long pfn, int val, struct cycle *cycle)
++set_bitmap_cyclic(char *bitmap, mdf_pfn_t pfn, int val, struct cycle *cycle)
+ {
+ int byte, bit;
+ static int warning = 0;
+@@ -3425,7 +3427,7 @@ sync_2nd_bitmap(void)
+ }
+
+ int
+-set_bit_on_1st_bitmap(unsigned long long pfn, struct cycle *cycle)
++set_bit_on_1st_bitmap(mdf_pfn_t pfn, struct cycle *cycle)
+ {
+ if (info->flag_cyclic) {
+ return set_bitmap_cyclic(info->partial_bitmap1, pfn, 1, cycle);
+@@ -3435,7 +3437,7 @@ set_bit_on_1st_bitmap(unsigned long long pfn, struct cycle *cycle)
+ }
+
+ int
+-clear_bit_on_1st_bitmap(unsigned long long pfn, struct cycle *cycle)
++clear_bit_on_1st_bitmap(mdf_pfn_t pfn, struct cycle *cycle)
+ {
+ if (info->flag_cyclic) {
+ return set_bitmap_cyclic(info->partial_bitmap1, pfn, 0, cycle);
+@@ -3445,7 +3447,7 @@ clear_bit_on_1st_bitmap(unsigned long long pfn, struct cycle *cycle)
+ }
+
+ int
+-clear_bit_on_2nd_bitmap(unsigned long long pfn, struct cycle *cycle)
++clear_bit_on_2nd_bitmap(mdf_pfn_t pfn, struct cycle *cycle)
+ {
+ if (info->flag_cyclic) {
+ return set_bitmap_cyclic(info->partial_bitmap2, pfn, 0, cycle);
+@@ -3455,7 +3457,7 @@ clear_bit_on_2nd_bitmap(unsigned long long pfn, struct cycle *cycle)
+ }
+
+ int
+-clear_bit_on_2nd_bitmap_for_kernel(unsigned long long pfn, struct cycle *cycle)
++clear_bit_on_2nd_bitmap_for_kernel(mdf_pfn_t pfn, struct cycle *cycle)
+ {
+ unsigned long long maddr;
+
+@@ -3472,7 +3474,7 @@ clear_bit_on_2nd_bitmap_for_kernel(unsigned long long pfn, struct cycle *cycle)
+ }
+
+ int
+-set_bit_on_2nd_bitmap(unsigned long long pfn, struct cycle *cycle)
++set_bit_on_2nd_bitmap(mdf_pfn_t pfn, struct cycle *cycle)
+ {
+ if (info->flag_cyclic) {
+ return set_bitmap_cyclic(info->partial_bitmap2, pfn, 1, cycle);
+@@ -3482,7 +3484,7 @@ set_bit_on_2nd_bitmap(unsigned long long pfn, struct cycle *cycle)
+ }
+
+ int
+-set_bit_on_2nd_bitmap_for_kernel(unsigned long long pfn, struct cycle *cycle)
++set_bit_on_2nd_bitmap_for_kernel(mdf_pfn_t pfn, struct cycle *cycle)
+ {
+ unsigned long long maddr;
+
+@@ -3793,11 +3795,11 @@ rearrange_dumpdata(void)
+ return TRUE;
+ }
+
+-unsigned long long
++mdf_pfn_t
+ page_to_pfn(unsigned long page)
+ {
+ unsigned int num;
+- unsigned long long pfn = ULONGLONG_MAX;
++ mdf_pfn_t pfn = ULONGLONG_MAX;
+ unsigned long long index = 0;
+ struct mem_map_data *mmd;
+
+@@ -3827,7 +3829,7 @@ reset_bitmap_of_free_pages(unsigned long node_zones, struct cycle *cycle)
+ int order, i, migrate_type, migrate_types;
+ unsigned long curr, previous, head, curr_page, curr_prev;
+ unsigned long addr_free_pages, free_pages = 0, found_free_pages = 0;
+- unsigned long long pfn, start_pfn;
++ mdf_pfn_t pfn, start_pfn;
+
+ /*
+ * On linux-2.6.24 or later, free_list is divided into the array.
+@@ -4430,7 +4432,7 @@ create_1st_bitmap(void)
+ int i;
+ unsigned int num_pt_loads = get_num_pt_loads();
+ char buf[info->page_size];
+- unsigned long long pfn, pfn_start, pfn_end, pfn_bitmap1;
++ mdf_pfn_t pfn, pfn_start, pfn_end, pfn_bitmap1;
+ unsigned long long phys_start, phys_end;
+ struct timeval tv_start;
+ off_t offset_page;
+@@ -4502,10 +4504,10 @@ int
+ create_1st_bitmap_cyclic(struct cycle *cycle)
+ {
+ int i;
+- unsigned long long pfn, pfn_bitmap1;
++ mdf_pfn_t pfn, pfn_bitmap1;
+ unsigned long long phys_start, phys_end;
+- unsigned long long pfn_start, pfn_end;
+- unsigned long long pfn_start_roundup, pfn_end_round;
++ mdf_pfn_t pfn_start, pfn_end;
++ mdf_pfn_t pfn_start_roundup, pfn_end_round;
+ unsigned long pfn_start_byte, pfn_end_byte;
+
+ /*
+@@ -4563,7 +4565,8 @@ create_1st_bitmap_cyclic(struct cycle *cycle)
+ int
+ exclude_zero_pages(void)
+ {
+- unsigned long long pfn, paddr;
++ mdf_pfn_t pfn;
++ unsigned long long paddr;
+ struct dump_bitmap bitmap2;
+ struct timeval tv_start;
+ unsigned char buf[info->page_size];
+@@ -4615,10 +4618,10 @@ static int
+ initialize_2nd_bitmap_cyclic(struct cycle *cycle)
+ {
+ int i;
+- unsigned long long pfn;
++ mdf_pfn_t pfn;
+ unsigned long long phys_start, phys_end;
+- unsigned long long pfn_start, pfn_end;
+- unsigned long long pfn_start_roundup, pfn_end_round;
++ mdf_pfn_t pfn_start, pfn_end;
++ mdf_pfn_t pfn_start_roundup, pfn_end_round;
+ unsigned long pfn_start_byte, pfn_end_byte;
+
+ /*
+@@ -4666,10 +4669,12 @@ initialize_2nd_bitmap_cyclic(struct cycle *cycle)
+
+ int
+ __exclude_unnecessary_pages(unsigned long mem_map,
+- unsigned long long pfn_start, unsigned long long pfn_end, struct cycle *cycle)
++ mdf_pfn_t pfn_start, mdf_pfn_t pfn_end, struct cycle *cycle)
+ {
+- unsigned long long pfn, pfn_mm, maddr;
+- unsigned long long pfn_read_start, pfn_read_end, index_pg;
++ mdf_pfn_t pfn;
++ unsigned long index_pg, pfn_mm;
++ unsigned long long maddr;
++ mdf_pfn_t pfn_read_start, pfn_read_end;
+ unsigned char page_cache[SIZE(page) * PGMM_CACHED];
+ unsigned char *pcache;
+ unsigned int _count, _mapcount = 0;
+@@ -5169,7 +5174,7 @@ get_loads_dumpfile(void)
+ {
+ int i, phnum, num_new_load = 0;
+ long page_size = info->page_size;
+- unsigned long long pfn, pfn_start, pfn_end, num_excluded;
++ mdf_pfn_t pfn, pfn_start, pfn_end, num_excluded;
+ unsigned long frac_head, frac_tail;
+ Elf64_Phdr load;
+ struct dump_bitmap bitmap2;
+@@ -5619,10 +5624,10 @@ out:
+ return ret;
+ }
+
+-unsigned long long
++mdf_pfn_t
+ get_num_dumpable(void)
+ {
+- unsigned long long pfn, num_dumpable;
++ mdf_pfn_t pfn, num_dumpable;
+ struct dump_bitmap bitmap2;
+
+ initialize_2nd_bitmap(&bitmap2);
+@@ -5634,10 +5639,10 @@ get_num_dumpable(void)
+ return num_dumpable;
+ }
+
+-unsigned long long
++mdf_pfn_t
+ get_num_dumpable_cyclic(void)
+ {
+- unsigned long long pfn, num_dumpable=0;
++ mdf_pfn_t pfn, num_dumpable=0;
+ struct cycle cycle = {0};
+
+ for_each_cycle(0, info->max_mapnr, &cycle)
+@@ -5699,8 +5704,9 @@ write_elf_pages(struct cache_data *cd_header, struct cache_data *cd_page)
+ {
+ int i, phnum;
+ long page_size = info->page_size;
+- unsigned long long pfn, pfn_start, pfn_end, paddr, num_excluded;
+- unsigned long long num_dumpable, per;
++ mdf_pfn_t pfn, pfn_start, pfn_end, num_excluded;
++ unsigned long long paddr;
++ mdf_pfn_t num_dumpable, per;
+ unsigned long long memsz, filesz;
+ unsigned long frac_head, frac_tail;
+ off_t off_seg_load, off_memory;
+@@ -5885,7 +5891,7 @@ write_elf_pages(struct cache_data *cd_header, struct cache_data *cd_page)
+ }
+
+ int
+-read_pfn(unsigned long long pfn, unsigned char *buf)
++read_pfn(mdf_pfn_t pfn, unsigned char *buf)
+ {
+ unsigned long long paddr;
+
+@@ -5904,7 +5910,7 @@ get_loads_dumpfile_cyclic(void)
+ int i, phnum, num_new_load = 0;
+ long page_size = info->page_size;
+ unsigned char buf[info->page_size];
+- unsigned long long pfn, pfn_start, pfn_end, num_excluded;
++ mdf_pfn_t pfn, pfn_start, pfn_end, num_excluded;
+ unsigned long frac_head, frac_tail;
+ Elf64_Phdr load;
+ struct cycle cycle = {0};
+@@ -5976,8 +5982,8 @@ write_elf_pages_cyclic(struct cache_data *cd_header, struct cache_data *cd_page)
+ int i, phnum;
+ long page_size = info->page_size;
+ unsigned char buf[info->page_size];
+- unsigned long long pfn, pfn_start, pfn_end, paddr, num_excluded;
+- unsigned long long num_dumpable, per;
++ mdf_pfn_t pfn, pfn_start, pfn_end, num_excluded, num_dumpable, per;
++ unsigned long long paddr;
+ unsigned long long memsz, filesz;
+ unsigned long frac_head, frac_tail;
+ off_t off_seg_load, off_memory;
+@@ -6197,8 +6203,8 @@ write_elf_pages_cyclic(struct cache_data *cd_header, struct cache_data *cd_page)
+ int
+ write_kdump_pages(struct cache_data *cd_header, struct cache_data *cd_page)
+ {
+- unsigned long long pfn, per, num_dumpable;
+- unsigned long long start_pfn, end_pfn;
++ mdf_pfn_t pfn, per, num_dumpable;
++ mdf_pfn_t start_pfn, end_pfn;
+ unsigned long size_out;
+ struct page_desc pd, pd_zero;
+ off_t offset_data = 0;
+@@ -6404,8 +6410,8 @@ int
+ write_kdump_pages_cyclic(struct cache_data *cd_header, struct cache_data *cd_page,
+ struct page_desc *pd_zero, off_t *offset_data, struct cycle *cycle)
+ {
+- unsigned long long pfn, per;
+- unsigned long long start_pfn, end_pfn;
++ mdf_pfn_t pfn, per;
++ mdf_pfn_t start_pfn, end_pfn;
+ unsigned long size_out;
+ struct page_desc pd;
+ unsigned char buf[info->page_size], *buf_out = NULL;
+@@ -7511,7 +7517,7 @@ read_vmcoreinfo_xen(void)
+ }
+
+ int
+-allocated_in_map(unsigned long long pfn)
++allocated_in_map(mdf_pfn_t pfn)
+ {
+ static unsigned long long cur_idx = -1;
+ static unsigned long cur_word;
+@@ -7557,8 +7563,8 @@ exclude_xen3_user_domain(void)
+ unsigned int num_pt_loads = get_num_pt_loads();
+ unsigned long page_info_addr;
+ unsigned long long phys_start, phys_end;
+- unsigned long long pfn, pfn_end;
+- unsigned long long j, size;
++ mdf_pfn_t pfn, pfn_end;
++ mdf_pfn_t j, size;
+
+ /*
+ * NOTE: the first half of bitmap is not used for Xen extraction
+@@ -7621,8 +7627,8 @@ exclude_xen4_user_domain(void)
+ unsigned int num_pt_loads = get_num_pt_loads();
+ unsigned long page_info_addr;
+ unsigned long long phys_start, phys_end;
+- unsigned long long pfn, pfn_end;
+- unsigned long long j, size;
++ mdf_pfn_t pfn, pfn_end;
++ mdf_pfn_t j, size;
+
+ /*
+ * NOTE: the first half of bitmap is not used for Xen extraction
+@@ -7847,7 +7853,7 @@ print_vtop(void)
+ void
+ print_report(void)
+ {
+- unsigned long long pfn_original, pfn_excluded, shrinking;
++ mdf_pfn_t pfn_original, pfn_excluded, shrinking;
+
+ /*
+ * /proc/vmcore doesn't contain the memory hole area.
+@@ -7952,9 +7958,9 @@ int
+ setup_splitting(void)
+ {
+ int i;
+- unsigned long long j, pfn_per_dumpfile;
+- unsigned long long start_pfn, end_pfn;
+- unsigned long long num_dumpable = get_num_dumpable();
++ mdf_pfn_t j, pfn_per_dumpfile;
++ mdf_pfn_t start_pfn, end_pfn;
++ mdf_pfn_t num_dumpable = get_num_dumpable();
+ struct dump_bitmap bitmap2;
+
+ if (info->num_dumpfile <= 1)
+@@ -8281,7 +8287,7 @@ void
+ sort_splitting_info(void)
+ {
+ int i, j;
+- unsigned long long start_pfn, end_pfn;
++ mdf_pfn_t start_pfn, end_pfn;
+ char *name_dumpfile;
+
+ /*
+@@ -8317,7 +8323,7 @@ int
+ check_splitting_info(void)
+ {
+ int i;
+- unsigned long long end_pfn;
++ mdf_pfn_t end_pfn;
+
+ /*
+ * Check whether there are not lack of /proc/vmcore.
+@@ -8544,8 +8550,8 @@ reassemble_kdump_pages(void)
+ int i, fd = 0, ret = FALSE;
+ off_t offset_first_ph, offset_ph_org, offset_eraseinfo;
+ off_t offset_data_new, offset_zero_page = 0;
+- unsigned long long pfn, start_pfn, end_pfn;
+- unsigned long long num_dumpable;
++ mdf_pfn_t pfn, start_pfn, end_pfn;
++ mdf_pfn_t num_dumpable;
+ unsigned long size_eraseinfo;
+ struct dump_bitmap bitmap2;
+ struct disk_dump_header dh;
+diff --git a/makedumpfile.h b/makedumpfile.h
+index ad064a4..eb03688 100644
+--- a/makedumpfile-1.5.6/makedumpfile.h
++++ b/makedumpfile-1.5.6/makedumpfile.h
+@@ -767,13 +767,15 @@ unsigned long long vaddr_to_paddr_ia64(unsigned long vaddr);
+ #define VADDR_REGION(X) (((unsigned long)(X)) >> REGION_SHIFT)
+ #endif /* ia64 */
+
++typedef unsigned long long mdf_pfn_t;
++
+ #ifndef ARCH_PFN_OFFSET
+ #define ARCH_PFN_OFFSET 0
+ #endif
+ #define paddr_to_pfn(X) \
+ (((unsigned long long)(X) >> PAGESHIFT()) - ARCH_PFN_OFFSET)
+ #define pfn_to_paddr(X) \
+- (((unsigned long long)(X) + ARCH_PFN_OFFSET) << PAGESHIFT())
++ (((mdf_pfn_t)(X) + ARCH_PFN_OFFSET) << PAGESHIFT())
+
+ /* Format of Xen crash info ELF note */
+ typedef struct {
+@@ -813,8 +815,8 @@ typedef struct {
+ } xen_crash_info_v2_t;
+
+ struct mem_map_data {
+- unsigned long long pfn_start;
+- unsigned long long pfn_end;
++ mdf_pfn_t pfn_start;
++ mdf_pfn_t pfn_end;
+ unsigned long mem_map;
+ };
+
+@@ -866,8 +868,8 @@ struct makedumpfile_data_header {
+ struct splitting_info {
+ char *name_dumpfile;
+ int fd_bitmap;
+- unsigned long long start_pfn;
+- unsigned long long end_pfn;
++ mdf_pfn_t start_pfn;
++ mdf_pfn_t end_pfn;
+ off_t offset_eraseinfo;
+ unsigned long size_eraseinfo;
+ } splitting_info_t;
+@@ -914,7 +916,7 @@ struct DumpInfo {
+ unsigned long vaddr_for_vtop; /* virtual address for debugging */
+ long page_size; /* size of page */
+ long page_shift;
+- unsigned long long max_mapnr; /* number of page descriptor */
++ mdf_pfn_t max_mapnr; /* number of page descriptor */
+ unsigned long page_offset;
+ unsigned long section_size_bits;
+ unsigned long max_physmem_bits;
+@@ -1025,10 +1027,10 @@ struct DumpInfo {
+ * 1 .. xen_crash_info_t
+ * 2 .. xen_crash_info_v2_t */
+
+- unsigned long long dom0_mapnr; /* The number of page in domain-0.
+- * Different from max_mapnr.
+- * max_mapnr is the number of page
+- * in system. */
++ mdf_pfn_t dom0_mapnr; /* The number of page in domain-0.
++ * Different from max_mapnr.
++ * max_mapnr is the number of page
++ * in system. */
+ unsigned long xen_phys_start;
+ unsigned long xen_heap_start; /* start mfn of xen heap area */
+ unsigned long xen_heap_end; /* end mfn(+1) of xen heap area */
+@@ -1048,15 +1050,15 @@ struct DumpInfo {
+ /*
+ * for splitting
+ */
+- unsigned long long split_start_pfn;
+- unsigned long long split_end_pfn;
++ mdf_pfn_t split_start_pfn;
++ mdf_pfn_t split_end_pfn;
+
+ /*
+ * for cyclic processing
+ */
+ char *partial_bitmap1;
+ char *partial_bitmap2;
+- unsigned long long num_dumpable;
++ mdf_pfn_t num_dumpable;
+ unsigned long bufsize_cyclic;
+ unsigned long pfn_cyclic;
+
+@@ -1453,7 +1455,7 @@ int readmem(int type_addr, unsigned long long addr, void *bufptr, size_t size);
+ int get_str_osrelease_from_vmlinux(void);
+ int read_vmcoreinfo_xen(void);
+ int exclude_xen_user_domain(void);
+-unsigned long long get_num_dumpable(void);
++mdf_pfn_t get_num_dumpable(void);
+ int __read_disk_dump_header(struct disk_dump_header *dh, char *filename);
+ int read_disk_dump_header(struct disk_dump_header *dh, char *filename);
+ int read_kdump_sub_header(struct kdump_sub_header *kh, char *filename);
+@@ -1589,18 +1591,18 @@ int get_xen_info_ia64(void);
+ #endif /* s390x */
+
+ struct cycle {
+- unsigned long long start_pfn;
+- unsigned long long end_pfn;
++ mdf_pfn_t start_pfn;
++ mdf_pfn_t end_pfn;
+ };
+
+ static inline int
+-is_on(char *bitmap, unsigned long long i)
++is_on(char *bitmap, mdf_pfn_t i)
+ {
+ return bitmap[i>>3] & (1 << (i & 7));
+ }
+
+ static inline int
+-is_dumpable(struct dump_bitmap *bitmap, unsigned long long pfn)
++is_dumpable(struct dump_bitmap *bitmap, mdf_pfn_t pfn)
+ {
+ off_t offset;
+ if (pfn == 0 || bitmap->no_block != pfn/PFN_BUFBITMAP) {
+@@ -1616,7 +1618,7 @@ is_dumpable(struct dump_bitmap *bitmap, unsigned long long pfn)
+ }
+
+ static inline int
+-is_dumpable_cyclic(char *bitmap, unsigned long long pfn, struct cycle *cycle)
++is_dumpable_cyclic(char *bitmap, mdf_pfn_t pfn, struct cycle *cycle)
+ {
+ if (pfn < cycle->start_pfn || cycle->end_pfn <= pfn)
+ return FALSE;
+@@ -1625,7 +1627,7 @@ is_dumpable_cyclic(char *bitmap, unsigned long long pfn, struct cycle *cycle)
+ }
+
+ static inline int
+-is_cyclic_region(unsigned long long pfn, struct cycle *cycle)
++is_cyclic_region(mdf_pfn_t pfn, struct cycle *cycle)
+ {
+ if (pfn < cycle->start_pfn || cycle->end_pfn <= pfn)
+ return FALSE;
+@@ -1647,8 +1649,8 @@ is_zero_page(unsigned char *buf, long page_size)
+ }
+
+ void write_vmcoreinfo_data(void);
+-int set_bit_on_1st_bitmap(unsigned long long pfn, struct cycle *cycle);
+-int clear_bit_on_1st_bitmap(unsigned long long pfn, struct cycle *cycle);
++int set_bit_on_1st_bitmap(mdf_pfn_t pfn, struct cycle *cycle);
++int clear_bit_on_1st_bitmap(mdf_pfn_t pfn, struct cycle *cycle);
+
+ #ifdef __x86__
+
+@@ -1759,7 +1761,7 @@ struct elf_prstatus {
+ /*
+ * Function Prototype.
+ */
+-unsigned long long get_num_dumpable_cyclic(void);
++mdf_pfn_t get_num_dumpable_cyclic(void);
+ int get_loads_dumpfile_cyclic(void);
+ int initial_xen(void);
+ unsigned long long get_free_memory_size(void);
+diff --git a/sadump_info.c b/sadump_info.c
+index f14ffc9..9434ff7 100644
+--- a/makedumpfile-1.5.6/sadump_info.c
++++ b/makedumpfile-1.5.6/sadump_info.c
+@@ -94,7 +94,7 @@ static int read_device_diskset(struct sadump_diskset_info *sdi, void *buf,
+ size_t bytes, ulong *offset);
+ static int read_sadump_header(char *filename);
+ static int read_sadump_header_diskset(int diskid, struct sadump_diskset_info *sdi);
+-static unsigned long long pfn_to_block(unsigned long long pfn);
++static unsigned long long pfn_to_block(mdf_pfn_t pfn);
+ static int lookup_diskset(unsigned long long whole_offset, int *diskid,
+ unsigned long long *disk_offset);
+ static int max_mask_cpu(void);
+@@ -202,7 +202,8 @@ sadump_copy_1st_bitmap_from_memory(void)
+ * modify bitmap accordingly.
+ */
+ if (si->kdump_backed_up) {
+- unsigned long long paddr, pfn, backup_src_pfn;
++ unsigned long long paddr;
++ mdf_pfn_t pfn, backup_src_pfn;
+
+ for (paddr = si->backup_src_start;
+ paddr < si->backup_src_start + si->backup_src_size;
+@@ -754,7 +755,8 @@ sadump_initialize_bitmap_memory(void)
+ struct sadump_header *sh = si->sh_memory;
+ struct dump_bitmap *bmp;
+ unsigned long dumpable_bitmap_offset;
+- unsigned long long section, max_section, pfn;
++ unsigned long long section, max_section;
++ mdf_pfn_t pfn;
+ unsigned long long *block_table;
+
+ dumpable_bitmap_offset =
+@@ -901,7 +903,7 @@ sadump_set_timestamp(struct timeval *ts)
+ return TRUE;
+ }
+
+-unsigned long long
++mdf_pfn_t
+ sadump_get_max_mapnr(void)
+ {
+ return si->sh_memory->max_mapnr;
+@@ -951,7 +953,8 @@ failed:
+ int
+ readpage_sadump(unsigned long long paddr, void *bufptr)
+ {
+- unsigned long long pfn, block, whole_offset, perdisk_offset;
++ mdf_pfn_t pfn;
++ unsigned long long block, whole_offset, perdisk_offset;
+ int fd_memory;
+
+ if (si->kdump_backed_up &&
+@@ -1117,7 +1120,7 @@ sadump_check_debug_info(void)
+ }
+
+ static unsigned long long
+-pfn_to_block(unsigned long long pfn)
++pfn_to_block(mdf_pfn_t pfn)
+ {
+ unsigned long long block, section, p;
+
+diff --git a/sadump_info.h b/sadump_info.h
+index c0175dd..131687a 100644
+--- a/makedumpfile-1.5.6/sadump_info.h
++++ b/makedumpfile-1.5.6/sadump_info.h
+@@ -42,7 +42,7 @@ int sadump_copy_1st_bitmap_from_memory(void);
+ int sadump_initialize_bitmap_memory(void);
+ int sadump_num_online_cpus(void);
+ int sadump_set_timestamp(struct timeval *ts);
+-unsigned long long sadump_get_max_mapnr(void);
++mdf_pfn_t sadump_get_max_mapnr(void);
+ int readpage_sadump(unsigned long long paddr, void *bufptr);
+ int sadump_check_debug_info(void);
+ int sadump_generate_vmcoreinfo_from_vmlinux(size_t *vmcoreinfo_size);
+@@ -92,7 +92,7 @@ static inline int sadump_set_timestamp(struct timeval *ts)
+ return FALSE;
+ }
+
+-static inline unsigned long long sadump_get_max_mapnr(void)
++static inline mdf_pfn_t sadump_get_max_mapnr(void)
+ {
+ return 0;
+ }
+--
+1.8.5.3
+
diff --git a/kexec-tools.spec b/kexec-tools.spec
index 9230ccf..55a1bdb 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -76,6 +76,7 @@ ExcludeArch: aarch64
#
Patch601: kexec-tools-2.0.3-disable-kexec-test.patch
Patch602: kexec-tools-2.0.4-makedumpfile-Fix-Makefile-for-eppic_makedumpfile.so-build.patch
+Patch603: kexec-tools-2.0.4-makedumpfile-Introduce-the-mdf_pfn_t-type.patch
%description
kexec-tools provides /sbin/kexec binary that facilitates a new
@@ -113,6 +114,7 @@ tar -z -x -v -f %{SOURCE23}
%patch601 -p1
%patch602 -p1
+%patch603 -p1
tar -z -x -v -f %{SOURCE13}
--
1.8.5.3
9 years, 8 months
[PATCH v2 0/6] Kdump error handling service
by WANG Chao
Hi, All
This patchset introduce a new kdump emergency service. It will override the
existing emergency.service. When fatal error occurs, this emergency service
will be triggered and systemd will isolate to emergency path.
This kdump emergency service can will read kdump.conf and act according to the
configired "default action" (reboot/poweroff/halt/shell/dump_to_rootfs).
Along with this patchset, kdump-capture.service is introduced as a service unit
to run kdump.sh. When kdump-capture.service fails, systemd will isolate to
kdump emergency service. I copied all the dependencies from
dracut-pre-pivot.service to kdump-capture.service so that kdump.sh will be
called at the correct time window.
v2:
Address several comments from Vivek:
- split [patch 1] into 1/6 and 2/6
- remove several unnecessary lines in service unit.
- modify the description of kdump-capture.service
- introduce another kdump lib kdump-lib-2.sh used in 2nd kernel.
WANG Chao (6):
mkdumprd: mount dump target under /sysroot in 2nd kernel
mkdumprd: append "x-initrd.mount" to the mount options.
cleanup: extract functions from kdump.sh to kdump-lib-2.sh
Introduce kdump error handling service
Introduce kdump capture service
disable dracut-emergency.service the whole time
dracut-kdump-capture.service | 23 ++++++
dracut-kdump-emergency.service | 23 ++++++
dracut-kdump-error-handler.sh | 10 +++
dracut-kdump-lib-2.sh | 160 ++++++++++++++++++++++++++++++++++++++++
dracut-kdump.sh | 161 +----------------------------------------
dracut-module-setup.sh | 8 +-
kdump-lib.sh | 6 +-
kexec-tools.spec | 9 ++-
mkdumprd | 25 ++++---
9 files changed, 253 insertions(+), 172 deletions(-)
create mode 100644 dracut-kdump-capture.service
create mode 100644 dracut-kdump-emergency.service
create mode 100755 dracut-kdump-error-handler.sh
create mode 100755 dracut-kdump-lib-2.sh
--
1.9.3
9 years, 8 months
[Patch v2] Add static route into cmdline if target address is not local
by Baoquan He
If one target address is not local and its route is different than
default gateway, the specific route to this target address need be
added.
In this patch, get the route to the specific target address and store
it as cmdline, here is /etc/cmdline.d/45-route-static.conf. And the
route options are separated by underscore like below. Then the sotred
route can be parsed when kdump kernel boot up.
192.168.200.0/24_via_192.168.100.222_dev_ens10
---
dracut-module-setup.sh | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 87ad072..f1d0d28 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -79,6 +79,11 @@ kdump_static_ip() {
_gateway=$(ip route list dev $_netdev | awk '/^default /{print $3}')
echo -n "${_srcaddr}::${_gateway}:${_netmask}::"
fi
+
+ /sbin/ip route show | grep -v default | grep "^[[:digit:]].*via.* $_netdev " |\
+ while read line; do
+ echo $line | awk '{printf("rd.route=%s_%s_%s_%s_%s\n", $1, $2, $3, $4, $5)}'
+ done >> ${initdir}/etc/cmdline.d/45route-static.conf
}
kdump_get_mac_addr() {
--
1.9.0
9 years, 9 months
[PATCH v6] Enhance kdump to support ipv6
by Arthur Zou
Resolves: bz821620
Description:
Currently kdump doesn't support ipv6 nfs/ssh dump. Ipv6 is the latest version
of the Internet Protocal. so it is a significant feture for kdump to enhance
to support ipv6.
Solutions:
Since dracut has supported ipv6 now, it is easy to change the kdump code to
support ipv6. Just need pass the right _ip_opts to the second kernle. What is
the main difference in userspace bettwen ipv4 and ipv6 is the ip address format.
For ipv6 nfs dump:
if ipv6 address type is link scope, /etc/kdump.conf should be edited like
"nfs [fe80::5054:ff:fe48:ca80%eth0]:/mnt"
else /etc/kdump.conf should be edited like "nfs [2001:db8:0:f101::2]:/mnt"
For ipv6 ssh dump
if ipv6 address type is link scope, /etc/kdump.conf should be edited like
"ssh root@fe80::5054:ff:fe48:ca80%eth0"
else /etc/kdump.conf should be edited like "ssh root@2001:db8:0:f101::2"
What this patch do is:
a): Add a function is_ipv6_target to tell what version of Internet Protocal
(ipv4/ipv6) kdump will use to dump to remote target.
b): Modify kdump_install_net to handle ipv6 configuration in /etc/kdump.conf
correctly. Get the ipv6 address from /etc/kdump.conf is more complicated
than ipv4 because the difference configuration format mentioned above.
c): Based on the ip address type, using corresponding ip address as HOST_IP
in second kernel.
It was tested for IPV6 and IPV4 address in beaker machine and passed.
Note:
1): Currntly only f19 support remount a nfs target in ipv6. detail in https:
//bugzilla.redhat.com/show_bug.cgi?id=1099761. If using in f20, you can
comment out "mount -o remount,rw $_mp || return 1" in kdump.sh line 105.
2): If Using static ipv6 address and configuring nfs/ssh with hostname of
remote target, MUST add a ipv6 DNS in ifcfg-devname.
How to create a ipv6 enviromnet.
1): Reserving two beaker machine with family fedora19.
2): Choosing a beaker machine as a nfs/ssh server and delete it's ipv4 address
by "ip address del ipv4-address dev nicname"
3): Configuring the /etc/kdump.conf like mentioned above.
Signed-off-by: Arthur Zou <zzou(a)redhat.com>
---
dracut-kdump.sh | 9 ++++--
dracut-module-setup.sh | 74 ++++++++++++++++++++++++++++++++++++++------------
kdump-lib.sh | 25 +++++++++++++++++
3 files changed, 89 insertions(+), 19 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh
index cb13d92..5dcd8a4 100755
--- a/dracut-kdump.sh
+++ b/dracut-kdump.sh
@@ -206,9 +206,14 @@ get_host_ip()
then
kdumpnic=$(getarg kdumpnic=)
[ -z "$kdumpnic" ] && echo "kdump: failed to get kdumpnic!" && return 1
- _host=`ip addr show dev $kdumpnic|grep 'inet '`
+ if is_ipv6_target
+ then
+ _host=`ip addr show dev $kdumpnic|grep 'inet6'`
+ else
+ _host=`ip addr show dev $kdumpnic|grep 'inet '`
+ fi
[ $? -ne 0 ] && echo "kdump: wrong kdumpnic: $kdumpnic" && return 1
- _host="${_host##*inet }"
+ _host=`echo $_host | cut -d' ' -f2`
_host="${_host%%/*}"
[ -z "$_host" ] && echo "kdump: wrong kdumpnic: $kdumpnic" && return 1
HOST_IP=$_host
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 87ad072..93ff259 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -70,14 +70,25 @@ kdump_setup_dns() {
#$2: srcaddr
#if it use static ip echo it, or echo null
kdump_static_ip() {
- local _netmask _gateway
+ local _netmask _gateway _ipaddr
local _netdev="$1" _srcaddr="$2"
- local _ipaddr=$(ip addr show dev $_netdev permanent | \
+
+ if is_ipv6_target
+ then
+ _ipaddr=$(ip addr show dev $_netdev permanent | \
+ awk "/ $_srcaddr\/.* /{print \$2}")
+ if [ -n "$_ipaddr" ]; then
+ _gateway=$(ip -6 route list dev $_netdev | awk '/^default /{print $3}')
+ echo -n "[${_srcaddr}]::[${_gateway}]:64::"
+ fi
+ else
+ _ipaddr=$(ip addr show dev $_netdev permanent | \
awk "/ $_srcaddr\/.* $_netdev\$/{print \$2}")
- if [ -n "$_ipaddr" ]; then
- _netmask=$(ipcalc -m $_ipaddr | cut -d'=' -f2)
- _gateway=$(ip route list dev $_netdev | awk '/^default /{print $3}')
- echo -n "${_srcaddr}::${_gateway}:${_netmask}::"
+ if [ -n "$_ipaddr" ]; then
+ _netmask=$(ipcalc -m $_ipaddr | cut -d'=' -f2)
+ _gateway=$(ip route list dev $_netdev | awk '/^default /{print $3}')
+ echo -n "${_srcaddr}::${_gateway}:${_netmask}::"
+ fi
fi
}
@@ -231,24 +242,51 @@ kdump_install_net() {
local _server _netdev _srcaddr
local config_val="$1"
- _server=`echo $config_val | sed 's/.*@//' | cut -d':' -f1`
+ # ipv6 config_val is like mnt [xxxx:xxxx::xxxx%eth0]:/mnt/nfs or
+ # ssh username@xxxx:xxxx::xxxx%eth0, what we need is xxxx:xxxx::xxxx
+ _server=`echo $config_val | sed 's/.*@//'`
+ _server=${_server%:/*}
+ _server=${_server#[}
+ _server=${_server%]}
+ _server=${_server%\%*} #strip the zone_ID if exist, like %eth0 above
- _need_dns=`echo $_server|grep "[a-zA-Z]"`
- [ -n "$_need_dns" ] && _server=`getent hosts $_server|cut -d' ' -f1`
+ if is_ipv6_target
+ then
+ _need_dns=`echo $_server|grep "[:]"`
+ [ -z "$_need_dns" ] && _server=`getent hosts $_server| head -n 1 | cut -d' ' -f1`
+ else
+ _need_dns=`echo $_server|grep "[a-zA-Z]"`
+ [ -n "$_need_dns" ] && _server=`getent hosts $_server| head -n 1 | cut -d' ' -f1`
+ fi
_netdev=`/sbin/ip route get to $_server 2>&1`
[ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1
- #the field in the ip output changes if we go to another subnet
- if [ -n "`echo $_netdev | grep via`" ]
+ if is_ipv6_target
then
- # we are going to a different subnet
- _srcaddr=`echo $_netdev|awk '{print $7}'|head -n 1`
- _netdev=`echo $_netdev|awk '{print $5;}'|head -n 1`
+ #the field in the ip output changes if we go to another subnet
+ if [ -n "`echo $_netdev | grep via`" ]
+ then
+ # we are going to a different subnet
+ _srcaddr=`echo $_netdev|awk '{print $9}'|head -n 1`
+ _netdev=`echo $_netdev|awk '{print $7;}'|head -n 1`
+ else
+ # we are on the same subnet
+ _srcaddr=`echo $_netdev|awk '{print $7}'|head -n 1`
+ _netdev=`echo $_netdev|awk '{print $5}'|head -n 1`
+ fi
else
- # we are on the same subnet
- _srcaddr=`echo $_netdev|awk '{print $5}'|head -n 1`
- _netdev=`echo $_netdev|awk '{print $3}'|head -n 1`
+ #the field in the ip output changes if we go to another subnet
+ if [ -n "`echo $_netdev | grep via`" ]
+ then
+ # we are going to a different subnet
+ _srcaddr=`echo $_netdev|awk '{print $7}'|head -n 1`
+ _netdev=`echo $_netdev|awk '{print $5;}'|head -n 1`
+ else
+ # we are on the same subnet
+ _srcaddr=`echo $_netdev|awk '{print $5}'|head -n 1`
+ _netdev=`echo $_netdev|awk '{print $3}'|head -n 1`
+ fi
fi
kdump_setup_netdev "${_netdev}" "${_srcaddr}"
@@ -551,6 +589,8 @@ install() {
inst "/bin/date" "/bin/date"
inst "/bin/sync" "/bin/sync"
inst "/bin/cut" "/bin/cut"
+ inst "/bin/getent" "/bin/getent"
+ inst "/bin/head" "/bin/head"
inst "/sbin/makedumpfile" "/sbin/makedumpfile"
inst "/sbin/vmcore-dmesg" "/sbin/vmcore-dmesg"
inst_hook pre-pivot 9999 "$moddir/kdump.sh"
diff --git a/kdump-lib.sh b/kdump-lib.sh
index a20c6e8..8f68d31 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -138,3 +138,28 @@ check_save_path_fs()
fi
}
+# check the remote server ip address tpye
+is_ipv6_target()
+{
+ local _server _server_tmp
+
+ if is_ssh_dump_target; then
+ _server=`get_option_value ssh`
+ elif is_nfs_dump_target; then
+ _server=`get_option_value nfs`
+ fi
+
+ [ -z "$_server" ] && return 1
+ # in ipv6, the _server format is [xxxx:xxxx::xxxx%eth0]:/mnt/nfs or
+ # username@xxxx:xxxx::xxxx%eth0. what we need is just xxxx:xxxx::xxxx
+ _server=${_server#*@}
+ _server=${_server%:/*}
+ _server=${_server#[}
+ _server=${_server%]}
+ _server=${_server%\%*}
+
+ _server_tmp=$_server
+ _server=`getent hosts $_server | head -n 1 | cut -d' ' -f1`
+ _server=${_server:-$_server_tmp}
+ echo $_server | grep -q ":"
+}
--
1.8.4.2
9 years, 9 months