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 --- changes since v1: - renamed get_kdump_persistent_dev() to kdump_get_persistent_dev()
kdump-lib.sh | 2 +- kdumpctl | 2 +- mkdumprd | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index 66f2f0d77401..141a5614f1d5 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -86,7 +86,7 @@ to_dev_name() { echo $dev }
-get_persistent_dev() { +kdump_get_persistent_dev() { local i _tmp _dev _lookup_dirs
_dev=$(udevadm info --query=name --name="$1" 2>/dev/null) diff --git a/kdumpctl b/kdumpctl index fcc9ad081437..c8fc54fc7677 100755 --- a/kdumpctl +++ b/kdumpctl @@ -390,7 +390,7 @@ check_dump_fs_modified() if [[ $(expr substr $_new_fstype 1 3) = "nfs" ]];then _new_dev=$_target else - _new_dev=$(get_persistent_dev $_target $_new_fstype) + _new_dev=$(kdump_get_persistent_dev $_target $_new_fstype) if ! findmnt $_target >/dev/null; then echo "Dump target $_target is probably not mounted." return 2 diff --git a/mkdumprd b/mkdumprd index 78afb1a9425d..eb0d5e06fac9 100644 --- a/mkdumprd +++ b/mkdumprd @@ -109,7 +109,7 @@ to_mount() { _mntopts="$_target $_fstype $_options" #for non-nfs _dev converting to use udev persistent name if [ -b "$_source" ]; then - _pdev="$(get_persistent_dev $_source $_fstype)" + _pdev="$(kdump_get_persistent_dev $_source $_fstype)" if [ $? -ne 0 ]; then return 1 fi @@ -522,7 +522,7 @@ do dd if=$config_val count=1 of=/dev/null > /dev/null 2>&1 || { 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 exit 1 fi
On 2016/06/23 at 10:57, Pratyush Anand wrote:
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
changes since v1:
- renamed get_kdump_persistent_dev() to kdump_get_persistent_dev()
kdump-lib.sh | 2 +- kdumpctl | 2 +- mkdumprd | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index 66f2f0d77401..141a5614f1d5 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -86,7 +86,7 @@ to_dev_name() { echo $dev }
-get_persistent_dev() { +kdump_get_persistent_dev() { local i _tmp _dev _lookup_dirs
_dev=$(udevadm info --query=name --name="$1" 2>/dev/null)
diff --git a/kdumpctl b/kdumpctl index fcc9ad081437..c8fc54fc7677 100755 --- a/kdumpctl +++ b/kdumpctl @@ -390,7 +390,7 @@ check_dump_fs_modified() if [[ $(expr substr $_new_fstype 1 3) = "nfs" ]];then _new_dev=$_target else
_new_dev=$(get_persistent_dev $_target $_new_fstype)
if ! findmnt $_target >/dev/null; then echo "Dump target $_target is probably not mounted." return 2_new_dev=$(kdump_get_persistent_dev $_target $_new_fstype)
diff --git a/mkdumprd b/mkdumprd index 78afb1a9425d..eb0d5e06fac9 100644 --- a/mkdumprd +++ b/mkdumprd @@ -109,7 +109,7 @@ to_mount() { _mntopts="$_target $_fstype $_options" #for non-nfs _dev converting to use udev persistent name if [ -b "$_source" ]; then
_pdev="$(get_persistent_dev $_source $_fstype)"
_pdev="$(kdump_get_persistent_dev $_source $_fstype)" if [ $? -ne 0 ]; then return 1 fi
@@ -522,7 +522,7 @@ do dd if=$config_val count=1 of=/dev/null > /dev/null 2>&1 || { 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 exit 1 fi
Acked-by: Xunlei Pang xlpang@redhat.com