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