diff options
| author | Mirek Kratochvil <exa.exa@gmail.com> | 2014-10-12 16:47:37 +0200 |
|---|---|---|
| committer | Mirek Kratochvil <exa.exa@gmail.com> | 2014-10-12 16:47:37 +0200 |
| commit | 3ee8104210ce183379c04490cef00cca2fc1bddc (patch) | |
| tree | 96556e737b0d11c6844336e585d1173b3cfdbf09 | |
| parent | 543f00bd3ae774389ba99959c8e2a29fd12b153f (diff) | |
| download | zfs-backup-3ee8104210ce183379c04490cef00cca2fc1bddc.tar.gz zfs-backup-3ee8104210ce183379c04490cef00cca2fc1bddc.tar.bz2 | |
workaround for Sun_SSH
Sun_SSH doesn't close correctly on sigpipe. Kill it manually.
| -rwxr-xr-x | zb-pull | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -51,12 +51,21 @@ if [ "$newest" = "$newest_common" ] ; then exit 0 fi +ret=0 + if [ "$newest_common" = "N/A" ] ; then #do a full send ssh $ssh_remote "zfs send -R \"${remote_zfs}@zb-${newest}\"" | zfs recv -F "${local_zfs}" - exit $? + ret=$? else #do incremental send ssh $ssh_remote "zfs send -R -I \"${remote_zfs}@zb-${newest_common}\" \"${remote_zfs}@zb-${newest}\"" | zfs recv -F "${local_zfs}" - exit $? + ret=$? fi + +#in some cases and on some setups (Sun_SSH) when `zfs recv` fails, ssh ignores +#the SIGPIPE and the connection hangs there forever, somehow. This fixes the +#issue by killing all children that were possibly spawned by this shell. +[ "$ZB_WORKAROUND_SSH_SIGPIPE" = "yes" ] && pkill -P $$ + +exit $ret |
