From 760beb7e57408018819507c8fcf35b5cafedabdc Mon Sep 17 00:00:00 2001 From: Bhupesh Sharma Date: Mon, 9 Mar 2020 18:08:40 +0530 Subject: [PATCH] mkdumprd: Use DUMP_TARGET which printing error message during ssh When building kdump initramfs for a SSH dump target, mkdumprd would check whether it has the write permission on the SSH Server's $DUMP_TARGET. However $DUMP_TARGET is missing in the actual error message when the user doesn't not have the write permission. For example: # kdumpctl restart kexec: unloaded kdump kernel Stopping kdump: [OK] Could not create temporary directory on :/home/bhsharma/test. Make sure user has write permission on destination mkdumprd: failed to make kdump initrd Starting kdump: [FAILED] This patch using $1 value passed to mkdumprd, to print the $DUMP_TARGET inside mkdir_save_path_ssh() function to fix the issue. Signed-off-by: Bhupesh Sharma Acked-by: Kairui Song --- mkdumprd | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mkdumprd b/mkdumprd index b46fd32..f80304b 100644 --- a/mkdumprd +++ b/mkdumprd @@ -130,7 +130,7 @@ get_ssh_size() { #mkdir if save path does not exist on ssh dump target #$1=ssh dump target -#caller should ensure write permission on $DUMP_TARGET:$SAVE_PATH +#caller should ensure write permission on $1:$SAVE_PATH #called from while loop and shouldn't read from stdin, so we're using "ssh -n" mkdir_save_path_ssh() { @@ -139,14 +139,14 @@ mkdir_save_path_ssh() ssh -qn $_opt $1 mkdir -p $SAVE_PATH 2>&1 > /dev/null _ret=$? if [ $_ret -ne 0 ]; then - perror_exit "mkdir failed on $DUMP_TARGET:$SAVE_PATH" + perror_exit "mkdir failed on $1:$SAVE_PATH" fi - #check whether user has write permission on $SAVE_PATH/$DUMP_TARGET + #check whether user has write permission on $1:$SAVE_PATH _dir=$(ssh -qn $_opt $1 mktemp -dqp $SAVE_PATH 2>/dev/null) _ret=$? if [ $_ret -ne 0 ]; then - perror_exit "Could not create temporary directory on $DUMP_TARGET:$SAVE_PATH. Make sure user has write permission on destination" + perror_exit "Could not create temporary directory on $1:$SAVE_PATH. Make sure user has write permission on destination" fi ssh -qn $_opt $1 rmdir $_dir