diff -Nru makedumpfile-1.6.5/debian/changelog makedumpfile-1.6.5/debian/changelog --- makedumpfile-1.6.5/debian/changelog 2019-06-14 10:58:40.000000000 -0300 +++ makedumpfile-1.6.5/debian/changelog 2019-07-04 15:31:51.000000000 -0300 @@ -1,3 +1,9 @@ +makedumpfile (1:1.6.5-1ubuntu3) eoan; urgency=medium + + * Add kdump retry/delay mechanism when dumping over network (LP: #1681909) + + -- Guilherme G. Piccoli Thu, 04 Jul 2019 15:20:53 -0300 + makedumpfile (1:1.6.5-1ubuntu2) eoan; urgency=medium [ Thadeu Lima de Souza Cascardo ] diff -Nru makedumpfile-1.6.5/debian/kdump-config.in makedumpfile-1.6.5/debian/kdump-config.in --- makedumpfile-1.6.5/debian/kdump-config.in 2019-01-05 09:01:02.000000000 -0200 +++ makedumpfile-1.6.5/debian/kdump-config.in 2019-07-04 15:31:48.000000000 -0300 @@ -50,6 +50,8 @@ KDUMP_NUM_DUMPS=${KDUMP_NUM_DUMPS:=0} NFS_TIMEO=${NFS_TIMEO:=600} NFS_RETRANS=${NFS_RETRANS:=3} +NFS_MOUNT_RETRY=${NFS_MOUNT_RETRY:=4} +SSH_KDUMP_RETRY=${SSH_KDUMP_RETRY:=16} MAKEDUMP_ARGS=${MAKEDUMP_ARGS:="-c -d 31"} KDUMP_CMDLINE_APPEND=${KDUMP_CMDLINE_APPEND:="@KDUMP_CMDLINE_APPEND@"} KDUMP_KERNEL_HOOK="/etc/kernel/postinst.d/kdump-tools" @@ -647,8 +649,21 @@ # if [ -n "$NFS" ];then log_action_msg "Mounting NFS mountpoint $NFS ..." - mount -t nfs -o nolock -o tcp -o soft -o timeo=${NFS_TIMEO} -o retrans=${NFS_RETRANS} $NFS $KDUMP_COREDIR - ERROR=$? + MOUNTOPTS="-o nolock -o tcp -o soft -o timeo=${NFS_TIMEO} -o retrans=${NFS_RETRANS}" + + CNT=${NFS_MOUNT_RETRY} + while [ $CNT -ne 0 ];do + mount -t nfs $MOUNTOPTS $NFS $KDUMP_COREDIR + ERROR=$? + if [ $ERROR -eq 0 ];then + CNT=0 + else + ((CNT--)) + log_action_msg "Network not reachable; will try $CNT more times" + sleep 3 + fi + done + if [ $ERROR -ne 0 ];then log_failure_msg "$NAME: Unable to mount remote NFS directory $NFS. Cannot save core" logger -t $NAME "Unable to mount remote NFS directory $NFS. Cannot save core" @@ -759,14 +774,23 @@ KDUMP_COREFILE="$KDUMP_STAMPDIR/dump.$KDUMP_STAMP" KDUMP_TMPDMESG="/tmp/dmesg.$KDUMP_STAMP" KDUMP_DMESGFILE="$KDUMP_STAMPDIR/dmesg.$KDUMP_STAMP" - ERROR=0 - ssh -i $KDUMP_SSH_KEY $KDUMP_REMOTE_HOST mkdir -p $KDUMP_STAMPDIR - ERROR=$? - # If remote connections fails, no need to continue - if [ $ERROR -ne 0 ] ; then - log_failure_msg "$NAME: Unable to reach remote server $KDUMP_REMOTE_HOST. No reason to continue" - logger -t $NAME "Unable to reach remote server $KDUMP_REMOTE_HOST. No reason to continue" + CNT=${SSH_KDUMP_RETRY} + while [ $CNT -ne 0 ];do + ssh -i $KDUMP_SSH_KEY $KDUMP_REMOTE_HOST mkdir -p $KDUMP_STAMPDIR + ERROR=$? + if [ $ERROR -eq 0 ];then + CNT=0 + else + ((CNT--)) + log_action_msg "Network not reachable; will try $CNT more times" + sleep 3 + fi + done + + if [ $ERROR -ne 0 ]; then + log_failure_msg "$NAME: Unable to reach remote server $KDUMP_REMOTE_HOST; can't continue" + logger -t $NAME "Unable to reach remote server $KDUMP_REMOTE_HOST; can't continue" return 1 fi