get_persistent_dev(): fix name contention with dracut's similar function

Resolves: BZ1348898

dracut-functions.sh defines a get_persistent_dev(). Earlier, we had another
local get_persistent_dev() in mkdumprd, however that was moved to
kdump-lib.sh, so that it can be reused in kdumpctl.

Since, dracut-module-setup.sh (which is dracut's
99kdumpbase/module-setup.sh) sources kdump-lib.sh. Therefore, once dracut
will execute 99kdumpbase module, it's own get_persistent_dev() function is
overwritten by kdump's version. If any other dracut module calls
get_persistent_dev() thereafter then, kdump's version is executed, which was
not expected.

Therefore rename kdump's get_persistent_dev() as kdump_get_persistent_dev()
to avoid any name contention.

Signed-off-by: Pratyush Anand <panand@redhat.com>
Acked-by: Xunlei Pang <xlpang@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
This commit is contained in:
Pratyush Anand 2016-06-23 08:27:41 +05:30 committed by Dave Young
parent 59c0a16dc6
commit 81f2c9ea6f
3 changed files with 4 additions and 4 deletions

View File

@ -86,7 +86,7 @@ to_dev_name() {
echo $dev echo $dev
} }
get_persistent_dev() { kdump_get_persistent_dev() {
local i _tmp _dev _lookup_dirs local i _tmp _dev _lookup_dirs
_dev=$(udevadm info --query=name --name="$1" 2>/dev/null) _dev=$(udevadm info --query=name --name="$1" 2>/dev/null)

View File

@ -390,7 +390,7 @@ check_dump_fs_modified()
if [[ $(expr substr $_new_fstype 1 3) = "nfs" ]];then if [[ $(expr substr $_new_fstype 1 3) = "nfs" ]];then
_new_dev=$_target _new_dev=$_target
else else
_new_dev=$(get_persistent_dev $_target $_new_fstype) _new_dev=$(kdump_get_persistent_dev $_target $_new_fstype)
if ! findmnt $_target >/dev/null; then if ! findmnt $_target >/dev/null; then
echo "Dump target $_target is probably not mounted." echo "Dump target $_target is probably not mounted."
return 2 return 2

View File

@ -109,7 +109,7 @@ to_mount() {
_mntopts="$_target $_fstype $_options" _mntopts="$_target $_fstype $_options"
#for non-nfs _dev converting to use udev persistent name #for non-nfs _dev converting to use udev persistent name
if [ -b "$_source" ]; then if [ -b "$_source" ]; then
_pdev="$(get_persistent_dev $_source $_fstype)" _pdev="$(kdump_get_persistent_dev $_source $_fstype)"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
return 1 return 1
fi fi
@ -522,7 +522,7 @@ do
dd if=$config_val count=1 of=/dev/null > /dev/null 2>&1 || { dd if=$config_val count=1 of=/dev/null > /dev/null 2>&1 || {
perror_exit "Bad raw disk $config_val" perror_exit "Bad raw disk $config_val"
} }
_praw=$(get_persistent_dev $config_val "raw") _praw=$(kdump_get_persistent_dev $config_val "raw")
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
exit 1 exit 1
fi fi