[RFC PATCH v2] kdump.conf: Support passing special mount information via "dracut_args"
by Xunlei Pang
There are some complaints about nfs kdump that users must mount
nfs beforehand, which may cause some overhead to nfs server.
For example, there're thounsands of clients deployed with kdump
diskless boot, each time the client is boot up, it will trigger
kdump rebuilding so will mount nfs, thus resulting in thousands
of nfs request concurrently imposed on the same nfs server.
We introduce a new way of specifying mount information via the
already-existent "dracut_args" directive, we will skip all the
filesystem mounting and checking things for it. So it can be used
in the above-mentioned nfs scenario and avoid creating severe nfs
server overhead.
Specifically, if there is any "--mount" information specifed via
"dracut_args" in /etc/kdump.conf, always use it as the final mount
without any check(users are expected to ensure its correctness),
it overrides any target specified in /etc/kdump.conf.
As an example:
dracut_args --mount "192.168.1.1:/test test nfs defaults,x-initrd.mount"
NOTE:
1)Only one mount information can be specified via "dracut_args".
2)Dracut will create <mountpoint> if it doesn't exist in kdump kernel.
Suggested-by: Dave Young <dyoung(a)redhat.com>
Signed-off-by: Xunlei Pang <xlpang(a)redhat.com>
---
v1->v2:
-Consider "dracut_args" in is_user_configured_dump_target().
-Add dracut "nfs" module properly.
-Prohibit specifying multiple mount information via "dracut_args".
kdump-lib.sh | 25 ++++++++++++++++++++++++-
kdumpctl | 8 +++++++-
mkdumprd | 9 +++++++++
3 files changed, 40 insertions(+), 2 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh
index fc2c036..e90fe4c 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -45,7 +45,8 @@ is_fs_dump_target()
is_user_configured_dump_target()
{
- return $(is_ssh_dump_target || is_nfs_dump_target || is_raw_dump_target || is_fs_dump_target)
+ return $(is_ssh_dump_target || is_nfs_dump_target || is_raw_dump_target \
+ || is_fs_dump_target || dracut_args_contains_mount)
}
strip_comments()
@@ -279,3 +280,25 @@ is_hostname()
fi
echo $1 | grep -q "[a-zA-Z]"
}
+
+# If "dracut_args" contains "--mount" information, use it
+# directly without any check(users are expected to ensure
+# its correctness). It overrides any target specified in
+# /etc/kdump.conf.
+dracut_args_contains_mount()
+{
+ return $(grep ^dracut_args /etc/kdump.conf | grep -q "\-\-mount")
+}
+
+get_fstype_from_dracut_args()
+{
+ local user_dracut_args fstype
+
+ user_dracut_args=$(grep ^dracut_args /etc/kdump.conf | grep "\-\-mount | head -1")
+ if [[ -n "$user_dracut_args" ]]; then
+ fstype=$(echo $user_dracut_args | awk -F "--mount \"" '{print $2}' | cut -d' ' -f3)
+ fi
+
+ echo $fstype
+}
+
diff --git a/kdumpctl b/kdumpctl
index fcc9ad0..4e9d6a4 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -236,7 +236,8 @@ check_config()
{
local nr
- nr=$(awk 'BEGIN{cnt=0} /^raw|^ssh[[:blank:]]|^nfs|^ext[234]|^xfs|^btrfs|^minix/{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE)
+ nr=$(awk 'BEGIN{cnt=0} /^raw|^ssh[[:blank:]]|^nfs|^ext[234]|^xfs|^btrfs|^minix| \
+ ^dracut_args .*\-\-mount/{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE)
[ $nr -gt 1 ] && {
echo "More than one dump targets specified."
return 1
@@ -365,6 +366,11 @@ check_dump_fs_modified()
local _new_dev _new_mntpoint _new_fstype
local _target _path _dracut_args
+ # No need to check in case of mount target specified via "dracut_args".
+ if dracut_args_contains_mount; then
+ return 0
+ fi
+
# No need to check in case of raw target.
# Currently we do not check also if ssh/nfs target is specified
if is_ssh_dump_target || is_nfs_dump_target || is_raw_dump_target; then
diff --git a/mkdumprd b/mkdumprd
index 78afb1a..2156be6 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -497,6 +497,12 @@ do
extra_modules="$extra_modules $config_val"
;;
ext[234]|xfs|btrfs|minix|nfs)
+ # Use the mount information in "dracut_args" specifed by users
+ # in /etc/kdump.conf, skip further parsing.
+ if dracut_args_contains_mount; then
+ continue
+ fi
+
if ! findmnt $config_val >/dev/null; then
perror_exit "Dump target $config_val is probably not mounted."
fi
@@ -544,6 +550,9 @@ do
verify_core_collector "$config_val"
;;
dracut_args)
+ if [[ $(get_fstype_from_dracut_args) = nfs* ]]; then
+ add_dracut_module "nfs"
+ fi
add_dracut_arg $config_val
;;
*)
--
1.8.3.1
7 years, 11 months
[RFC PATCH] kdump.conf: Support passing special mount information via "dracut_args"
by Xunlei Pang
There are some complaints about nfs kdump that users must mount
nfs beforehand, which may cause some overhead to nfs server.
For example, there're thounsands of clients deployed with kdump
diskless boot, each time the client is boot up, it will trigger
kdump rebuilding so will mount nfs, thus resulting in thousands
of nfs request concurrently imposed on the same nfs server.
We introduce a new way of specifying mount information via the
already-existent "dracut_args" directive, we will skip all the
filesystem mounting and checking things for it. So it can be used
in the above-mentioned nfs scenario and avoid creating severe nfs
server overhead.
Specifically, if there is any "--mount" information specifed via
"dracut_args" in /etc/kdump.conf, always use it as the final mount
without any check(users are expected to ensure its correctness),
it overrides any target specified in /etc/kdump.conf, as an example:
dracut_args --mount '/dev/mapper/test /tmp/test ext2 defaults,x-initrd.mount'
(dracut will create <mountpoint> if not existent in kdump kernel)
Suggested-by: Dave Young <dyoung(a)redhat.com>
Signed-off-by: Xunlei Pang <xlpang(a)redhat.com>
---
kdump-lib.sh | 9 +++++++++
kdumpctl | 5 +++++
mkdumprd | 8 ++++++++
3 files changed, 22 insertions(+)
diff --git a/kdump-lib.sh b/kdump-lib.sh
index fc2c036..b930e1c 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -279,3 +279,12 @@ is_hostname()
fi
echo $1 | grep -q "[a-zA-Z]"
}
+
+# If "dracut_args" contains "--mount" information, use it
+# directly without any check(users are expected to ensure
+# its correctness). It overrides any target specified in
+# /etc/kdump.conf.
+dracut_args_contains_mount()
+{
+ return $(grep ^dracut_args /etc/kdump.conf | grep -q "\-\-mount")
+}
diff --git a/kdumpctl b/kdumpctl
index fcc9ad0..4ed6282 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -365,6 +365,11 @@ check_dump_fs_modified()
local _new_dev _new_mntpoint _new_fstype
local _target _path _dracut_args
+ # No need to check in case of mount target specified via "dracut_args".
+ if dracut_args_contains_mount; then
+ return 0
+ fi
+
# No need to check in case of raw target.
# Currently we do not check also if ssh/nfs target is specified
if is_ssh_dump_target || is_nfs_dump_target || is_raw_dump_target; then
diff --git a/mkdumprd b/mkdumprd
index 78afb1a..8110f24 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -497,6 +497,14 @@ do
extra_modules="$extra_modules $config_val"
;;
ext[234]|xfs|btrfs|minix|nfs)
+ # Use the mount information in "dracut_args", skip further parsing.
+ if dracut_args_contains_mount; then
+ if [ "$config_opt" = "nfs" ]; then
+ add_dracut_module "nfs"
+ fi
+ continue
+ fi
+
if ! findmnt $config_val >/dev/null; then
perror_exit "Dump target $config_val is probably not mounted."
fi
--
1.8.3.1
7 years, 11 months
[PATCH] module-setup: Use proper ip address to setup network in kdump kernel
by Minfei Huang
Now kdump are supporting network dumping via both ipv4 and ipv6. And
ipv4 is the fisrt choice for kdump to setup network, if both ipv4 and
ipv6 are avaiable. There is a long time for kdump to support network
dumping via ipv4, so it is more stable, since a lot of practices have
been took.
From my test, if hostname is used as NFS sever address, the first ip
address from "getent ahosta $hostname" will be chosen during mounting.
There is an option "proto=" to determine whether ipv4 or ipv6 is used in
this NFS session. And it fails to mount NFS device in ipv4 mode, if this
option is "proto=tcp6".
To make ip address be consistent with kdump and mount, kdump will use
the first ip address from "getent ahosta $hostname" as well.
Signed-off-by: Minfei Huang <mhuang(a)redhat.com>
---
NOTE:
It fails to mount NFS device, if hostname is parsed to ipv6 address.
Following is a workaround patch to be used to test it.
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh
index 4c0e2e2..d57d90c 100755
--- a/kdump-lib-initramfs.sh
+++ b/kdump-lib-initramfs.sh
@@ -100,7 +100,7 @@ dump_fs()
echo "kdump: saving to $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/"
- mount -o remount,rw $_mp || return 1
+ mount -o remount,rw,port=0 $_mp || return 1
mkdir -p $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR || return 1
save_vmcore_dmesg_fs ${DMESG_COLLECTOR} "$_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/"
diff --git a/mkdumprd b/mkdumprd
index 78afb1a..4fa36ed 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -92,6 +92,7 @@ to_mount() {
# kernel, filter it out here.
_options=$(echo $_options | sed 's/noauto//')
_options=${_options/#ro/rw} #mount fs target as rw in 2nd kernel
+ _options=$(echo $_options | sed 's/port=0//')
# "x-initrd.mount" mount failure will trigger isolate emergency service
# W/o this, systemd won't isolate, thus we won't get to emergency.
# This is not applicable to remote fs mount, because if we use
---
dracut-module-setup.sh | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 4cd7107..7e2d4ad 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -313,10 +313,7 @@ kdump_install_net() {
_server=$(get_remote_host $config_val)
if is_hostname $_server; then
- _serv_tmp=`getent ahosts $_server | grep -v : | head -n 1`
- if [ -z "$_serv_tmp" ]; then
- _serv_tmp=`getent ahosts $_server | head -n 1`
- fi
+ _serv_tmp=`getent ahosts $_server | head -n 1`
_server=`echo $_serv_tmp | cut -d' ' -f1`
fi
--
2.1.0
7 years, 11 months
[PATCH V2] .gitignore: Update to make it more generic
by Pratyush Anand
We do not have *.xz, *.gz as part of repositiry, so ignore them. They are
annoying during development period, specially when we want to modify all
changes using `git add -A`.
Also ignore *.swp, and *.rpm because many of such temporary files are
created during development and such files would not be the part of
repository.
Signed-off-by: Pratyush Anand <panand(a)redhat.com>
---
Changes since V1:
* Now we do not delete any previously added files, as they are
* automatically updated by fedpkg
.gitignore | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/.gitignore b/.gitignore
index c13b1aed05ce..7a38a3915bf9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,7 @@
+*.gz
+*.xz
+*.swp
+*.rpm
/eppic_030413.tar.gz
/makedumpfile-1.5.7.tar.gz
/kexec-tools-2.0.8.tar.xz
--
2.5.5
7 years, 11 months
[PATCH V2] kdumpctrl: kdump feasibility should fail if no crash memory
by Pratyush Anand
Currently initramfs is rebuilt even when crash kernel memory is not
available and then latter on kdump service is failed.
Its better to fail during feasibility itself when crash memory is not
reserved.
Signed-off-by: Pratyush Anand <panand(a)redhat.com>
---
Changes since V1:
* return 1 is false and 0 is true
* crash memory availability is checked in check_kdump_feasibility now
kdumpctl | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/kdumpctl b/kdumpctl
index 34b64f33ac40..fcc9ad081437 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -559,13 +559,6 @@ need_64bit_headers()
# as the currently running kernel.
load_kdump()
{
- MEM_RESERVED=$(cat /sys/kernel/kexec_crash_size)
- if [ $MEM_RESERVED -eq 0 ]
- then
- echo "No memory reserved for crash kernel." >&2
- return 1
- fi
-
ARCH=`uname -m`
if [ "$ARCH" == "i686" -o "$ARCH" == "i386" ]
then
@@ -867,12 +860,26 @@ is_secure_boot_enforced()
return 1
}
+check_crash_mem_reserved()
+{
+ MEM_RESERVED=$(cat /sys/kernel/kexec_crash_size)
+ if [ $MEM_RESERVED -eq 0 ]
+ then
+ echo "No memory reserved for crash kernel." >&2
+ return 1
+ fi
+
+ return 0
+}
+
check_kdump_feasibility()
{
if [ ! -e /sys/kernel/kexec_crash_loaded ]; then
echo "Kdump is not supported on this kernel"
return 1
fi
+ check_crash_mem_reserved
+ return $?
}
check_fence_kdump_config()
--
2.5.5
7 years, 11 months
[PATCH V7 0/5] kdumpctl: force rebuild when dump target is modified
by Pratyush Anand
Kexec-tools should be able to recognize if a dump target is reformatted, or
dump path mounts another device.
Changes since v5:
- Commit log improved
- is_xxxx_modified() has been renamed as check_xxxx_modified(), because it
is returning non-boolean values.
- check_dump_fs_modified() logic has been simplified.
Changes since v5:
- Couple of spellcheck in comments
- name convert for $_target while discovering $_fstype
- an extra "grep $_id" when dracut argument has "by-uuid"
- No need to check if ssh/nfs/raw target is specified. We will fix such
cases latter by introducing separate checks for them
Changes since v4:
- patch 4/5 is a new change
- patch 4/4 of V3 is now 4/5. There has been many modifications in this
patch. It includes feedback from Baoquan and Xunlei. Have also done some
modification to recognize changes related to minix and NFS filesystem as
well. Infact, whole structure of function is_fs_uuid_changed() has been
modified. Now it has been renamed as is_dump_fs_modified() to suit it
better. Although I have tested it rigorously, but still a careful review
of is_dump_fs_modified() will be helpful.
Changes since v3:
- "$ret" unquoted
- No message for "$system_modified" != "0"
- image_time is now global
- is_dump_target_modified has been renamed as is_fs_uuid_changed
Changes since v2:
-- now is_system_modified returns 2 in case of invalid modification, 1 in
case of valid modification and 0 in case of no modification.
-- file modification check has been moved to is_system_modified now
-- variables have been put under "" in if condition check
Changes since v1:
-- Local variable is defined in shell function now
-- raw target does not take persistent names "by-uuid" now
-- dracut arguments grep is more robust
-- When no UUID then warn and return
Pratyush Anand (5):
mkdumprd: do not lookup in by-uuid dirs for raw device's persistent
name
kdumpctl: force rebuild in case of dynamic system modification
kdumpctl: Move file modification check logic in
check_system_modified()
mkdumprd: move to_dev_name() & get_persistent_dev() to kdump-lib.sh
kdumpctl: force rebuild in case of file system is modified
kdump-lib.sh | 49 ++++++++++++++++++++
kdumpctl | 144 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
mkdumprd | 47 +------------------
3 files changed, 188 insertions(+), 52 deletions(-)
--
2.5.5
7 years, 12 months
[PATCH] kdump.conf: introduce new "nfs_mntopts" in "/etc/kdump.conf"
by Xunlei Pang
There are some complaints about nfs kdump that users must mount
nfs beforehand, which can also cause some overhead to NFS server.
To solve it, we added a new "nfs_mntopts" in "/etc/kdump.conf" to
allow users to specify the nfs options instead of mounting it. The
general rule about "nfs_mntopts" is:
1) "nfs_mntopts" has the highest priority, if it is specified, we
always use it as the final mount option even if it is invalid
(kdump will fail to start).
2) When no nfs mounted beforehand:
a) If "nfs_mntopts" is specifed, do a temporary mount using it
as the mount options.
b) If "nfs_mntopts" is not specifed, do a temporary mount using
no options(default option).
If the temporary mount fails, kdump restart fails.
3) When nfs was mounted beforehand, parsing mounted nfs as before,
but with the following extra logic:
a) If "nfs_mntopts" is specified, validate it by doing a temporary
mount: If it is valid, make it as the options passed to dracut
instead of the mounted nfs(overridding it); If it is invalid,
kdump restart fails.
b) If "nfs_mntopts" is not specified, parsing mounted nfs as before.
4) After kdump is finished(started or failed), umount the temporary nfs
mount immediately if any.
The patch introduced three new functions to do the implementation:
nfs_mount_prepare(), nfs_mount_finish(), and nfs_mount_cleanup().
Signed-off-by: Xunlei Pang <xlpang(a)redhat.com>
---
kdump.conf | 4 ++++
kdumpctl | 4 ++--
mkdumprd | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
3 files changed, 81 insertions(+), 7 deletions(-)
diff --git a/kdump.conf b/kdump.conf
index 54b581d..f56556b 100644
--- a/kdump.conf
+++ b/kdump.conf
@@ -18,6 +18,9 @@
# nfs <nfs mount> - Will mount fs and copy /proc/vmcore to
# <mnt>/var/crash/%HOST-%DATE/, supports DNS.
#
+# nfs_mntopts <mount options> - Will mount nfs using this options
+# even if there's a mounted nfs with different options.
+#
# ssh <user@server> - Will scp /proc/vmcore to
# <user@server>:/var/crash/%HOST-%DATE/, supports DNS
# NOTE: make sure user has necessary write
@@ -147,6 +150,7 @@
#ext4 LABEL=/boot
#ext4 UUID=03138356-5e61-4ab3-b58e-27507ac41937
#nfs my.server.com:/export/tmp
+#nfs_mntopts rw,relatime,vers=3,rsize=1048576,wsize=1048576,namlen=255,timeo=500
#ssh user(a)my.server.com
#sshkey /root/.ssh/kdump_id_rsa
path /var/crash
diff --git a/kdumpctl b/kdumpctl
index ef18a2d..8be82c7 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -235,7 +235,7 @@ check_config()
{
local nr
- nr=$(awk 'BEGIN{cnt=0} /^raw|^ssh[[:blank:]]|^nfs|^ext[234]|^xfs|^btrfs|^minix/{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE)
+ nr=$(awk 'BEGIN{cnt=0} /^raw|^ssh[[:blank:]]|^nfs[[:blank:]]|^ext[234]|^xfs|^btrfs|^minix/{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE)
[ $nr -gt 1 ] && {
echo "More than one dump targets specified."
return 1
@@ -247,7 +247,7 @@ check_config()
case "$config_opt" in
\#* | "")
;;
- raw|ext2|ext3|ext4|minix|btrfs|xfs|nfs|ssh|sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|default|force_rebuild|dracut_args|fence_kdump_args|fence_kdump_nodes)
+ raw|ext2|ext3|ext4|minix|btrfs|xfs|nfs|nfs_mntopts|ssh|sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|default|force_rebuild|dracut_args|fence_kdump_args|fence_kdump_nodes)
[ -z "$config_val" ] && {
echo "Invalid kdump config value for option $config_opt."
return 1;
diff --git a/mkdumprd b/mkdumprd
index 6e3d975..aca8573 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -13,6 +13,8 @@ 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
+NFS_MNTOPTS=$(grep ^nfs_mntopts $conf_file| cut -d' ' -f2 | head -1)
+mntopts_override=""
# strip the duplicated "/"
SAVE_PATH=$(echo $SAVE_PATH | tr -s /)
@@ -21,6 +23,7 @@ dracut_args=("--hostonly" "-o" "plymouth dash resume ifcfg")
OVERRIDE_RESETTABLE=0
perror_exit() {
+ nfs_mount_cleanup
echo $@ >&2
exit 1
}
@@ -135,7 +138,15 @@ to_mount() {
if ! is_nfs_dump_target; then
_options="$_options,x-initrd.mount"
fi
- _mntopts="$_target $_fstype $_options"
+
+ # use $mntopts_override instead, if non-empty
+ if [ -n "$mntopts_override" ]; then
+ mntopts_override=${mntopts_override/#ro/rw} #mount fs target as rw in 2nd kernel
+ _mntopts="$_target $_fstype $mntopts_override"
+ else
+ _mntopts="$_target $_fstype $_options"
+ fi
+
#for non-nfs _dev converting to use udev persistent name
if [ -b "$_source" ]; then
_pdev="$(get_persistent_dev $_source)"
@@ -352,6 +363,61 @@ get_block_dump_target()
[ -b "$_target" ] && echo $(to_dev_name $_target)
}
+# handle "nfs_mntopts"
+# 1) if no nfs mounted: temporarily mount it using "nfs_mntopts" if specifed, else do a default mount.
+# 2) if nfs is mounted: if "nfs_mntopts" is specified and valid, use it as the options passed to dracut.
+nfs_mount_prepare()
+{
+ local config_val=$1
+
+ NFS_MNTPOINT=$(mktemp -d /tmp/nfs_MPXXXXXX)
+ if ! findmnt $config_val >/dev/null; then
+ # nfs needn't to be mounted beforehand, mount it temporarily
+ if [ -z "$NFS_MNTOPTS" ]; then
+ # Empty implies to use default mount option
+ echo "default nfs mount option used."
+ else
+ echo "nfs_mntopts mount option used."
+ NFS_MNTOPTS="-o $NFS_MNTOPTS"
+ fi
+
+ if ! mount $config_val $NFS_MNTOPTS $NFS_MNTPOINT; then
+ perror_exit "Mount nfs $config_val failed. Please specify proper nfs_mntopts in /etc/kdump.conf"
+ fi
+ elif [ -n "$NFS_MNTOPTS" ]; then
+ echo "nfs_mntopts mount option used."
+ # Validate $NFS_MNTOPTS
+ if ! mount $config_val -o $NFS_MNTOPTS $NFS_MNTPOINT; then
+ perror_exit "Validate nfs $config_val failed. Please check nfs_mntopts in /etc/kdump.conf"
+ fi
+ # if nfs_mntopts is specified and valid, also there is a mounted nfs by users with
+ # different options, nfs_mntopts has the priority to be used by dracut.
+ mntopts_override=$(findmnt -f -n -r -o OPTIONS $NFS_MNTPOINT)
+
+ # after validation, umount it so as not to conflict with the previously mounted one.
+ umount $NFS_MNTPOINT
+ else
+ echo "Mounted nfs mount option used."
+ fi
+
+ add_dracut_module "nfs"
+}
+
+# umount temporary nfs mount if there is
+nfs_mount_finish()
+{
+ if [ -d "$NFS_MNTPOINT" ]; then
+ umount $NFS_MNTPOINT 2>/dev/null
+ rmdir $NFS_MNTPOINT
+ fi
+}
+
+# if error happens, we check to clean up temporary nfs mount.
+nfs_mount_cleanup()
+{
+ nfs_mount_finish
+}
+
#handle the case user does not specify the dump target explicitly
handle_default_dump_target()
{
@@ -540,12 +606,12 @@ do
extra_modules="$extra_modules $config_val"
;;
ext[234]|xfs|btrfs|minix|nfs)
- if ! findmnt $config_val >/dev/null; then
- perror_exit "Dump target $config_val is probably not mounted."
+ if [ "$config_opt" = "nfs" ]; then
+ nfs_mount_prepare $config_val
fi
- if [ "$config_opt" = "nfs" ]; then
- add_dracut_module "nfs"
+ if ! findmnt $config_val >/dev/null; then
+ perror_exit "Dump target $config_val is probably not mounted."
fi
_absolute_save_path=$(make_absolute_save_path $config_val)
@@ -559,6 +625,10 @@ do
add_mount "$config_val"
check_save_path_fs $_absolute_save_path
check_size fs $config_val
+
+ if [ "$config_opt" = "nfs" ]; then
+ nfs_mount_finish
+ fi
;;
raw)
#checking raw disk writable
--
1.8.3.1
7 years, 12 months
[PATCH Resend] kdumpctl: Do not rebuild initramfs when $KDUMP_BOOTDIR is read only
by Pratyush Anand
When $KDUMP_BOOTDIR is RO then kexec-tools should not try rebuild initramfs
even when conditions for rebuild is met.
Signed-off-by: Pratyush Anand <panand(a)redhat.com>
Acked-by: Baoquan He <bhe(a)redhat.com>
Acked-by: Dave Young <dyoung(a)redhat.com>
---
kdumpctl | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/kdumpctl b/kdumpctl
index ef18a2d4f6ce..8ec6b2de914b 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -406,6 +406,11 @@ check_rebuild()
return 0
fi
+ if [[ ! -w "$KDUMP_BOOTDIR" ]];then
+ echo "$KDUMP_BOOTDIR does not have write permission. Can not rebuild $TARGET_INITRD"
+ return 1
+ fi
+
echo "Rebuilding $TARGET_INITRD"
rebuild_initrd
return $?
--
2.5.5
7 years, 12 months
[PATCH] kdumpctrl: kdump feasibility should fail if no crash memory
by Pratyush Anand
Currently initramfs is rebuilt even when crash kernel memory is not
available and then latter on kdump service is failed.
Its better to fail during feasibility itself when crash memory is not
reserved.
Signed-off-by: Pratyush Anand <panand(a)redhat.com>
---
kdumpctl | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)
diff --git a/kdumpctl b/kdumpctl
index c7abaafdda27..38f29d2a305d 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -545,13 +545,6 @@ need_64bit_headers()
# as the currently running kernel.
load_kdump()
{
- MEM_RESERVED=$(cat /sys/kernel/kexec_crash_size)
- if [ $MEM_RESERVED -eq 0 ]
- then
- echo "No memory reserved for crash kernel." >&2
- return 1
- fi
-
ARCH=`uname -m`
if [ "$ARCH" == "i686" -o "$ARCH" == "i386" ]
then
@@ -876,8 +869,26 @@ check_fence_kdump_config()
return 0
}
+is_crash_mem_reserved()
+{
+ MEM_RESERVED=$(cat /sys/kernel/kexec_crash_size)
+ if [ $MEM_RESERVED -eq 0 ]
+ then
+ echo "No memory reserved for crash kernel." >&2
+ return 0
+ fi
+
+ return 1
+}
+
+
check_dump_feasibility()
{
+ is_crash_mem_reserved
+ if [ $? -eq 0 ];then
+ return 1
+ fi
+
if [ $DEFAULT_DUMP_MODE == "fadump" ]; then
return 0
fi
--
2.5.5
7 years, 12 months
[PATCH] .gitignore: Update to make it more generic
by Pratyush Anand
We do not have *.tar.xz, *.tar.gz as part of repositiry, so ignore them
all.
Also ignore *.swp, and *.rpm because many of such temporary files are
created during development and such files would not be the part of
repository.
Signed-off-by: Pratyush Anand <panand(a)redhat.com>
---
.gitignore | 23 ++++-------------------
1 file changed, 4 insertions(+), 19 deletions(-)
diff --git a/.gitignore b/.gitignore
index c13b1aed05ce..3c087dafc049 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,19 +1,4 @@
-/eppic_030413.tar.gz
-/makedumpfile-1.5.7.tar.gz
-/kexec-tools-2.0.8.tar.xz
-/kdump-anaconda-addon-005-2-g86366ae.tar.gz
-/kdump-anaconda-addon-005-5-gbf53665.tar.gz
-/kdump-anaconda-addon-005-8-ge6ea581.tar.gz
-/kdump-anaconda-addon-005-9-g6115ca7.tar.gz
-/kexec-tools-2.0.9.tar.xz
-/makedumpfile-1.5.8.tar.gz
-/eppic_050615.tar.gz
-/kexec-tools-2.0.10.tar.xz
-/kdump-anaconda-addon-005-10-gd16915f.tar.gz
-/kdump-anaconda-addon-005-11-g59f9b73.tar.gz
-/kdump-anaconda-addon-005-12-g60fa4c1.tar.gz
-/kdump-anaconda-addon-005-14-g563e904.tar.gz
-/kdump-anaconda-addon-005-16-g586cc82.tar.gz
-/kexec-tools-2.0.11.tar.xz
-/makedumpfile-1.5.9.tar.gz
-/kexec-tools-2.0.12.tar.xz
+*.gz
+*.xz
+*.swp
+*.rpm
--
2.5.5
7 years, 12 months