[PATCH] kdump-module-setup.sh: do not handle ibft in kdump module
by WANG Chao
1st kernel uses ip=ibft and rd.iscsi.firmware to log in ibft lun. In 2nd
kernel, ibft lun can be logged in automatically, because 2nd kernel
inherit 1st kernel cmdline.
Currently kdump will configure netroot=iscsi:xxx if we find iscsi lun
being used. In case of ibft, ip=ibft and rd.iscsi.firmware is enough for
dracut to be aware of, otherwise netroot=iscsi:xxx will only confuse
dracut and fail to log in ibft lun.
So in kdump module, we should avoid handling iscsi lun if ibft.
Signed-off-by: WANG Chao <chaowang(a)redhat.com>
---
dracut-module-setup.sh | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 517099c..252d17a 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -268,6 +268,16 @@ kdump_install_conf() {
rm -f /tmp/$$-kdump.conf
}
+kdump_is_ibft() {
+ local path=$1
+ local tgt_name fw_tgt_name
+
+ tgt_name=$(kdump_iscsi_get_rec_val "$path" "node.name")
+ fw_tgt_name=$(/sbin/iscsiadm -m fw 2>/dev/null | awk '$1 == "node.name" {print $3}')
+
+ [ -n "$fw_tgt_name" ] && strstr "$fw_tgt_name" "$tgt_name"
+}
+
kdump_iscsi_get_rec_val() {
local result
@@ -323,6 +333,11 @@ kdump_setup_iscsi_device() {
return 1
fi
+ if kdump_is_ibft ${path}; then
+ dinfo "${path} is ibft, skip"
+ return 0
+ fi
+
tgt_name=$(kdump_iscsi_get_rec_val ${path} "node.name")
tgt_ipaddr=$(kdump_iscsi_get_rec_val ${path} "node.conn\[0\].address")
--
1.8.3.1
10 years
[PATCH 1/2] kdump-lib.sh: add common function strip_comments
by Baoquan He
Add function strip_comments into kdump-lib.sh, since it's used by
several files.
Signed-off-by: Wade Mealing <wmealing(a)redhat.com>
Signed-off-by: Baoquan He <bhe(a)redhat.com>
---
kdump-lib.sh | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/kdump-lib.sh b/kdump-lib.sh
index 1d00f67..4df5315 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -17,3 +17,8 @@ is_raw_dump_target()
{
grep -q "^raw" /etc/kdump.conf
}
+
+strip_comments()
+{
+ echo $1 | sed -e 's/\(.*\)#.*/\1/'
+}
--
1.8.3.1
10 years
[PATCH] kdump.service: Start kdump after network is online and remote fs is mounted
by WANG Chao
Now kdump.service runs "After" network.target. But network.target
doesn't mean network is setup and online[1]. We should use
network-online.target instead for ssh/nfs dump.
And also because nfs dump requires a mounted nfs when rebuilding kdump
initrd, kdump.service should also run "After" remote-fs.target (this
means all remote fs configured in /etc/fstab is mounted).
1. http://www.freedesktop.org/wiki/Software/systemd/NetworkTarget
Signed-off-by: WANG Chao <chaowang(a)redhat.com>
---
I tested local/nfs/ssh dump. Local and nfs dump works ok. But ssh dump has a
problem (not related to kdump).
I opend a bz to NetworkManager:
https://bugzilla.redhat.com/show_bug.cgi?id=997318
kdump.service | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kdump.service b/kdump.service
index 07e97fa..55b7ca2 100644
--- a/kdump.service
+++ b/kdump.service
@@ -1,6 +1,6 @@
[Unit]
Description=Crash recovery kernel arming
-After=network.target
+After=network.target network-online.target remote-fs.target
[Service]
Type=oneshot
--
1.8.3.1
10 years
[PATCH v2] kdump.service: Start kdump after network is online and remote fs is mounted
by WANG Chao
Now kdump.service runs "After" network.target. But network.target
doesn't mean network is setup and online[1]. We should use
network-online.target instead for ssh/nfs dump.
And also because nfs dump requires a mounted nfs when rebuilding kdump
initrd, kdump.service should also run "After" remote-fs.target (this
means all remote fs configured in /etc/fstab is mounted).
The downside of this patch is we always need to wait for network-online.target
even when dump target is a local disk. If network fails to come up,
kdump.service have to be stuck until network-online.target timeout (90
seconds by default).
Signed-off-by: WANG Chao <chaowang(a)redhat.com>
---
kdump.service | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kdump.service b/kdump.service
index 07e97fa..55b7ca2 100644
--- a/kdump.service
+++ b/kdump.service
@@ -1,6 +1,6 @@
[Unit]
Description=Crash recovery kernel arming
-After=network.target
+After=network.target network-online.target remote-fs.target
[Service]
Type=oneshot
--
1.8.3.1
10 years
[PATCH] dracut-module-setup: _dev to be a local variable
by WANG Chao
In kdump_setup_bridge/bond/team(), we use _dev as a global variable.
That causes following issues when network is br0 over bond0:
-> kdump_setup_bridge br0: _dev to be "bond0" as a brif
-> kdump_setup_bond bond0: _dev is modified to be eth0 as a bond slave
-> (jump back) kdump_setup_bridge br0: we really need _dev is
"bond0" not "eth0".
_dev must be a local variable because it has been used multiple places.
Signed-off-by: WANG Chao <chaowang(a)redhat.com>
---
dracut-module-setup.sh | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 517099c..f49f7fe 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -96,7 +96,7 @@ kdump_get_perm_addr() {
kdump_setup_bridge() {
local _netdev=$1
- local _brif=""
+ local _brif _dev
for _dev in `ls /sys/class/net/$_netdev/brif/`; do
if kdump_is_bond "$_dev"; then
kdump_setup_bond "$_dev"
@@ -114,6 +114,7 @@ kdump_setup_bridge() {
kdump_setup_bond() {
local _netdev=$1
+ local _dev
for _dev in `cat /sys/class/net/$_netdev/bonding/slaves`; do
echo -n " ifname=$_dev:$(kdump_get_perm_addr $_dev)" >> ${initdir}/etc/cmdline.d/42bond.conf
done
@@ -126,7 +127,7 @@ kdump_setup_bond() {
kdump_setup_team() {
local _netdev=$1
- local slaves=""
+ local slaves _dev
for _dev in `teamnl $_netdev ports | awk -F':' '{print $2}'`; do
echo -n " ifname=$_dev:$(kdump_get_perm_addr $_dev)" >> ${initdir}/etc/cmdline.d/44team.conf
slaves+="$_dev,"
--
1.8.3.1
10 years
[RFC PATCH] Introduce kdump-lib.sh for kdump shared functions
by WANG Chao
Currently in the whole kdump framework, we have some common functions
used across not only mkdumprd context and dracut context, but also 1st
kernel and 2nd kernel. We defined these functions at each script, which
is obviously not decent.
So let's introduce kdump-lib.sh for the shared functions and put it
to /lib/kdump/kdump-lib.sh.
It starts small, as you can see, only 3 functions are extracted. But in
the future more and more common functions can be added.
Signed-off-by: WANG Chao <chaowang(a)redhat.com>
---
dracut-kdump.sh | 16 +---------------
dracut-module-setup.sh | 7 ++-----
kdump-lib.sh | 19 +++++++++++++++++++
kexec-tools.spec | 4 ++++
mkdumprd | 16 +---------------
5 files changed, 27 insertions(+), 35 deletions(-)
create mode 100755 kdump-lib.sh
diff --git a/dracut-kdump.sh b/dracut-kdump.sh
index 7baa673..84dd72e 100755
--- a/dracut-kdump.sh
+++ b/dracut-kdump.sh
@@ -2,6 +2,7 @@
exec &> /dev/console
. /lib/dracut-lib.sh
+. /lib/kdump-lib.sh
if [ -f "$initdir/lib/dracut/no-emergency-shell" ]; then
rm -f -- $initdir/lib/dracut/no-emergency-shell
@@ -198,21 +199,6 @@ save_vmcore_dmesg_ssh() {
}
-is_ssh_dump_target()
-{
- grep -q "^ssh[[:blank:]].*@" $conf_file
-}
-
-is_nfs_dump_target()
-{
- grep -q "^nfs.*:" $conf_file
-}
-
-is_raw_dump_target()
-{
- grep -q "^raw" $conf_file
-}
-
get_host_ip()
{
local _host
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index f49f7fe..10ecec6 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -1,6 +1,7 @@
#!/bin/bash
. $dracutfunctions
+. /lib/kdump/kdump-lib.sh
check() {
[[ $debug ]] && set -x
@@ -23,11 +24,6 @@ depends() {
return 0
}
-is_ssh_dump_target()
-{
- grep -q "^ssh[[:blank:]].*@" /etc/kdump.conf
-}
-
kdump_to_udev_name() {
local dev="${1//\"/}"
@@ -413,6 +409,7 @@ install() {
inst "/sbin/makedumpfile" "/sbin/makedumpfile"
inst "/sbin/vmcore-dmesg" "/sbin/vmcore-dmesg"
inst_hook pre-pivot 9999 "$moddir/kdump.sh"
+ inst "/lib/kdump/kdump-lib.sh" "/lib/kdump-lib.sh"
# Check for all the devices and if any device is iscsi, bring up iscsi
# target. Ideally all this should be pushed into dracut iscsi module
diff --git a/kdump-lib.sh b/kdump-lib.sh
new file mode 100755
index 0000000..1d00f67
--- /dev/null
+++ b/kdump-lib.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+#
+# Kdump common functions
+#
+
+is_ssh_dump_target()
+{
+ grep -q "^ssh[[:blank:]].*@" /etc/kdump.conf
+}
+
+is_nfs_dump_target()
+{
+ grep -q "^nfs" /etc/kdump.conf
+}
+
+is_raw_dump_target()
+{
+ grep -q "^raw" /etc/kdump.conf
+}
diff --git a/kexec-tools.spec b/kexec-tools.spec
index efbb09e..c375f78 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -24,6 +24,7 @@ Source16: kdump.service
Source17: rhcrashkernel-param
Source18: kdump.sysconfig.s390x
Source19: eppic_030413.tar.gz
+Source20: kdump-lib.sh
#######################################
# These are sources for mkdumpramfs
@@ -154,6 +155,7 @@ mkdir -p -m755 $RPM_BUILD_ROOT%{_sysconfdir}/udev/rules.d
mkdir -p $RPM_BUILD_ROOT%{_unitdir}
mkdir -p -m755 $RPM_BUILD_ROOT%{_bindir}
mkdir -p -m755 $RPM_BUILD_ROOT%{_libdir}
+mkdir -p -m755 $RPM_BUILD_ROOT%{_prefix}/lib/kdump
install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_bindir}/kdumpctl
SYSCONFIG=$RPM_SOURCE_DIR/kdump.sysconfig.%{_target_cpu}
@@ -166,6 +168,7 @@ install -m 644 %{SOURCE8} $RPM_BUILD_ROOT%{_sysconfdir}/kdump.conf
install -m 644 kexec/kexec.8 $RPM_BUILD_ROOT%{_mandir}/man8/kexec.8
install -m 755 %{SOURCE11} $RPM_BUILD_ROOT%{_datadir}/kdump/firstboot_kdump.py
install -m 644 %{SOURCE12} $RPM_BUILD_ROOT%{_mandir}/man8/mkdumprd.8
+install -m 755 %{SOURCE20} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-lib.sh
%ifnarch s390x
# For s390x the ELF header is created in the kdump kernel and therefore kexec
# udev rules are not required
@@ -296,6 +299,7 @@ done
/usr/sbin/*
%{_bindir}/*
%{_datadir}/kdump
+%{_prefix}/lib/kdump
%config(noreplace,missingok) %{_sysconfdir}/sysconfig/kdump
%config(noreplace,missingok) %{_sysconfdir}/kdump.conf
%ifnarch s390x
diff --git a/mkdumprd b/mkdumprd
index 67f8f29..4f1170c 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -6,6 +6,7 @@
# Written by Cong Wang <amwang(a)redhat.com>
#
+. /lib/kdump/kdump-lib.sh
export IN_KDUMP=1
conf_file="/etc/kdump.conf"
@@ -244,21 +245,6 @@ check_size() {
fi
}
-is_nfs_dump_target()
-{
- grep -q "^nfs" $conf_file
-}
-
-is_ssh_dump_target()
-{
- grep -q "^ssh.*@" $conf_file
-}
-
-is_raw_dump_target()
-{
- grep -q "^raw" $conf_file
-}
-
# $1: core_collector config value
verify_core_collector() {
if grep -q "^raw" $conf_file && [ "${1%% *}" != "makedumpfile" ]; then
--
1.8.3.1
10 years
[Patch] Rawhide - Allow inline comments in config file.
by Wade Mealing
The RHEL 5 release of mkdumprd allowed for comments in the kdump config file
as shown below:
net 192.168.1.1 # this is the comment part
The Fedora 18/19/Rawhide release would fail when inline comments were used
at runtime and when building the initrd.
This patch introduces a function which is repeated a few times, but
could be broken out at a later date into its an existing or new shell
library which could be source.
This patch does not introduce any new functionality.
This patch includes the suggestions by David Young to fix my whitespace
errors.
I have not tested this patch as I do not yet have build permissions on koji.
10 years
[PATCH] kdumpctl: Run multiple kdumpctl instances one by one in serial order
by WANG Chao
There will be a race condition if multiple kdumpctl instances are
running at the same time.
By introducing a global mutex lock, only one instance can acquire this
lock and run, others will be waiting for the lock in queue. Now each
kdump instance will be run in serial order and there won't any race
condition.
This is a patch backported from RHEL6.
Signed-off-by: WANG Chao <chaowang(a)redhat.com>
---
kdumpctl | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/kdumpctl b/kdumpctl
index aba1e3c..d62b4b4 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -16,6 +16,12 @@ if [ -f /etc/sysconfig/kdump ]; then
. /etc/sysconfig/kdump
fi
+single_instance_lock()
+{
+ exec 9>/var/lock/kdump
+ flock 9
+}
+
# remove_cmdline_param <kernel cmdline> <param1> [<param2>] ... [<paramN>]
# Remove a list of kernel parameters from a given kernel cmdline and print the result.
# For each "arg" in the removing params list, "arg" and "arg=xxx" will be removed if exists.
@@ -531,6 +537,9 @@ if [ ! -f "$KDUMP_CONFIG_FILE" ]; then
exit 1
fi
+# Other kdumpctl instances will block in queue, until this one exits
+single_instance_lock
+
case "$1" in
start)
if [ -s /proc/vmcore ]; then
--
1.8.3.1
10 years
[PATCH v2] kdump.sysconfig: default to "nofail" mount
by WANG Chao
Currently we have two issues against mounting filesystems by systemd.
1. If any failure in sysroot.mount, initrd.target won't be reached.
2. If any failure in mounting /etc/fstab, initrd.target won't be reached
Our kdump.sh is in dracut-pre-pivot hook which is ordered after
initrd.target. That means if systemd doesn't reach initrd.target,
pre-pivot service will not run.
Based on above, we can conclude that in order to run kdump.sh,
initrd.target must be reached.
To fix issue 1), we can add rootflags=nofail to 2nd kernel cmdline, so
that initrd.target will not require sysroot.mount. initrd.target
wouldn't care about the failures in sysroot.mount. That means
initrd.target can always be reached whether or not sysroot.mount fails.
So when initrd.target is reached, kdump.sh can be run.
To fix issue 2), we can append "nofail" mount options to every entry in
/etc/fstab. It has almost the same affects as to sysroot.mount.
initrd.target can be reached whether or not mount /etc/fstab fails. So
when initrd.target is reached, kdump.sh can be run.
If the mount failures block kdump from working properly (for example,
the dump target isn't mounted), the error handling will be done by
"default" action specified in /etc/kdump.conf. Otherwise kdump will
ignore the mount failures and dump as expected.
Signed-off-by: WANG Chao <chaowang(a)redhat.com>
---
kdump.sysconfig.i386 | 2 +-
kdump.sysconfig.ppc64 | 2 +-
kdump.sysconfig.s390x | 2 +-
kdump.sysconfig.x86_64 | 2 +-
mkdumprd | 1 +
5 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/kdump.sysconfig.i386 b/kdump.sysconfig.i386
index 1425ce1..0d26a66 100644
--- a/kdump.sysconfig.i386
+++ b/kdump.sysconfig.i386
@@ -16,7 +16,7 @@ KDUMP_COMMANDLINE=""
# This variable lets us append arguments to the current kdump commandline
# As taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
-KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices numa=off udev.children-max=2 panic=10"
+KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices numa=off udev.children-max=2 panic=10 rootflags=nofail"
# Any additional kexec arguments required. In most situations, this should
# be left empty
diff --git a/kdump.sysconfig.ppc64 b/kdump.sysconfig.ppc64
index 22e7bd5..ca7e1d8 100644
--- a/kdump.sysconfig.ppc64
+++ b/kdump.sysconfig.ppc64
@@ -16,7 +16,7 @@ KDUMP_COMMANDLINE=""
# This variable lets us append arguments to the current kdump commandline
# As taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
-KDUMP_COMMANDLINE_APPEND="irqpoll maxcpus=1 noirqdistrib reset_devices cgroup_disable=memory numa=off udev.children-max=2 ehea.use_mcs=0 panic=10"
+KDUMP_COMMANDLINE_APPEND="irqpoll maxcpus=1 noirqdistrib reset_devices cgroup_disable=memory numa=off udev.children-max=2 ehea.use_mcs=0 panic=10 rootflags=nofail"
# Any additional kexec arguments required. In most situations, this should
# be left empty
diff --git a/kdump.sysconfig.s390x b/kdump.sysconfig.s390x
index 129b205..b55515a 100644
--- a/kdump.sysconfig.s390x
+++ b/kdump.sysconfig.s390x
@@ -16,7 +16,7 @@ KDUMP_COMMANDLINE=""
# This variable lets us append arguments to the current kdump commandline
# As taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
-KDUMP_COMMANDLINE_APPEND="maxcpus=1 cgroup_disable=memory numa=off udev.children-max=2 panic=10"
+KDUMP_COMMANDLINE_APPEND="maxcpus=1 cgroup_disable=memory numa=off udev.children-max=2 panic=10 rootflags=nofail"
# Any additional /sbin/mkdumprd arguments required.
MKDUMPRD_ARGS=""
diff --git a/kdump.sysconfig.x86_64 b/kdump.sysconfig.x86_64
index a143b5c..7e4d611 100644
--- a/kdump.sysconfig.x86_64
+++ b/kdump.sysconfig.x86_64
@@ -16,7 +16,7 @@ KDUMP_COMMANDLINE=""
# This variable lets us append arguments to the current kdump commandline
# As taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
-KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off udev.children-max=2 panic=10"
+KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off udev.children-max=2 panic=10 rootflags=nofail"
# Any additional kexec arguments required. In most situations, this should
# be left empty
diff --git a/mkdumprd b/mkdumprd
index 26fe5af..02521bf 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -102,6 +102,7 @@ to_mount() {
_t=$(findmnt -k -f -n -r -o TARGET,FSTYPE $_dev)
_o=$(findmnt -k -f -n -r -o OPTIONS $_dev)
_o=${_o/#ro/rw} #mount fs target as rw in 2nd kernel
+ _o="${_o},nofail" #with nofail set, systemd won't block for mount failure
_mntopts="$_t $_o"
#for non-nfs _dev converting to use udev persistent name
if [ -b "$_s" ]; then
--
1.8.3.1
10 years
Can we update the supported kernel to 3.10?
by Baoquan He
Hi Atsushi,
I noticed in Makedumpfile 1.5.4 the supported kernel is upgrade to
3.9.6. Now in our fedora distro, it's tracking linux kernel 3.10+. Then
makedumpfile will always give a warning like below:
"The kernel version is not supported."
"The created dumpfile may be incomplete."
Since currently it's in 3.11-rc6, can we upgrade the "LATEST_VERSION" to
"3.10"?
Baoquan
Thanks a lot
10 years