aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMirek Kratochvil <exa.exa@gmail.com>2014-10-12 16:47:37 +0200
committerMirek Kratochvil <exa.exa@gmail.com>2014-10-12 16:47:37 +0200
commit3ee8104210ce183379c04490cef00cca2fc1bddc (patch)
tree96556e737b0d11c6844336e585d1173b3cfdbf09
parent543f00bd3ae774389ba99959c8e2a29fd12b153f (diff)
downloadzfs-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-xzb-pull13
1 files changed, 11 insertions, 2 deletions
diff --git a/zb-pull b/zb-pull
index 8e856b5..ceb9906 100755
--- a/zb-pull
+++ b/zb-pull
@@ -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