diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index c00392b..0779224 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -935,7 +935,7 @@ get_generic_fence_kdump_nodes() {
     local filtered
     local nodes
 
-    nodes=$(get_option_value "fence_kdump_nodes")
+    nodes=$(kdump_get_conf_val "fence_kdump_nodes")
     for node in ${nodes}; do
         # Skip its own node name
         if is_localhost $node; then
@@ -996,7 +996,7 @@ kdump_install_random_seed() {
 }
 
 kdump_install_systemd_conf() {
-    local failure_action=$(get_option_value "failure_action")
+    local failure_action=$(kdump_get_conf_val "failure_action")
 
     # Kdump turns out to require longer default systemd mount timeout
     # than 1st kernel(90s by default), we use default 300s for kdump.
diff --git a/kdump-lib.sh b/kdump-lib.sh
index ce6a38d..8244fd0 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -76,11 +76,6 @@ is_fs_dump_target()
     egrep -q "^ext[234]|^xfs|^btrfs|^minix" /etc/kdump.conf
 }
 
-strip_comments()
-{
-    echo $@ | sed -e 's/\(.*\)#.*/\1/'
-}
-
 # Read kdump config in well formatted style
 kdump_read_conf()
 {
@@ -89,6 +84,15 @@ kdump_read_conf()
     [ -f "$KDUMP_CONFIG_FILE" ] && sed -n -e "s/#.*//;s/\s*$//;s/^\s*//;s/\(\S\+\)\s*\(.*\)/\1 \2/p" $KDUMP_CONFIG_FILE
 }
 
+# Retrieves config value defined in kdump.conf
+# $1: config name, sed regexp compatible
+kdump_get_conf_val() {
+    # For lines matching "^\s*$1\s+", remove matched part (config name including space),
+    # remove tailing comment, space, then store in hold space. Print out the hold buffer on last line.
+    [ -f "$KDUMP_CONFIG_FILE" ] && \
+        sed -n -e "/^\s*\($1\)\s\+/{s/^\s*\($1\)\s\+//;s/#.*//;s/\s*$//;h};\${x;p}" $KDUMP_CONFIG_FILE
+}
+
 # Check if fence kdump is configured in Pacemaker cluster
 is_pcs_fence_kdump()
 {
@@ -322,12 +326,6 @@ get_kdump_mntpoint_from_target()
     echo $_mntpoint | tr -s "/"
 }
 
-# get_option_value <option_name>
-# retrieves value of option defined in kdump.conf
-get_option_value() {
-    strip_comments `grep "^$1[[:space:]]\+" /etc/kdump.conf | tail -1 | cut -d\  -f2-`
-}
-
 kdump_get_persistent_dev() {
     local dev="${1//\"/}"
 
diff --git a/kdumpctl b/kdumpctl
index 8f70503..ef937bd 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -929,7 +929,7 @@ check_fence_kdump_config()
 {
 	local hostname=`hostname`
 	local ipaddrs=`hostname -I`
-	local nodes=$(get_option_value "fence_kdump_nodes")
+	local nodes=$(kdump_get_conf_val "fence_kdump_nodes")
 
 	for node in $nodes; do
 		if [ "$node" = "$hostname" ]; then