commit 75b107f2dc2bc7d90814e7d08fe2dbd5cebb6245
Author: Andrii Nikitin <andrii.nikitin@mariadb.com>
Date:   Fri Jul 21 15:02:52 2017 +0200

    MDEV-9554 Donor rsync may hang on transport issue

diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh
index 10d6896acc..30ad3ab3ac 100644
--- a/scripts/wsrep_sst_rsync.sh
+++ b/scripts/wsrep_sst_rsync.sh
@@ -18,6 +18,8 @@
 
 # This is a reference script for rsync-based state snapshot tansfer
 
+DONOR_IO_TIMEOUT=60
+
 RSYNC_PID=                                      # rsync pid file
 RSYNC_CONF=                                     # rsync configuration file
 RSYNC_REAL_PID=                                 # rsync process id
@@ -184,6 +186,7 @@ then
         RC=0
         rsync --owner --group --perms --links --specials \
               --ignore-times --inplace --dirs --delete --quiet \
+              --timeout=$DONOR_IO_TIMEOUT \
               $WHOLE_FILE_OPT "${FILTER[@]}" "$WSREP_SST_OPT_DATA/" \
               rsync://$WSREP_SST_OPT_ADDR >&2 || RC=$?
 
@@ -207,6 +210,7 @@ then
         # second, we transfer InnoDB log files
         rsync --owner --group --perms --links --specials \
               --ignore-times --inplace --dirs --delete --quiet \
+              --timeout=$DONOR_IO_TIMEOUT \
               $WHOLE_FILE_OPT -f '+ /ib_logfile[0-9]*' -f '- **' "$WSREP_LOG_DIR/" \
               rsync://$WSREP_SST_OPT_ADDR-log_dir >&2 || RC=$?
 
@@ -226,6 +230,7 @@ then
              xargs -I{} -0 -P $count \
              rsync --owner --group --perms --links --specials \
              --ignore-times --inplace --recursive --delete --quiet \
+             --timeout=$DONOR_IO_TIMEOUT \
              $WHOLE_FILE_OPT --exclude '*/ib_logfile*' "$WSREP_SST_OPT_DATA"/{}/ \
              rsync://$WSREP_SST_OPT_ADDR/{} >&2 || RC=$?
 
@@ -247,7 +252,8 @@ then
     echo "continue" # now server can resume updating data
 
     echo "$STATE" > "$MAGIC_FILE"
-    rsync --archive --quiet --checksum "$MAGIC_FILE" rsync://$WSREP_SST_OPT_ADDR
+    rsync --archive --quiet --checksum --timeout=$DONOR_IO_TIMEOUT "$MAGIC_FILE" \
+             rsync://$WSREP_SST_OPT_ADDR
 
     echo "done $STATE"
 
