Skip to content
Permalink
Browse files

some FreeBSD related fixes

  • Loading branch information...
phreaker0 committed Jun 14, 2019
1 parent d96f2d9 commit 979109481684b4dfd123131a5abb7ffb9d3ac744
Showing with 20 additions and 25 deletions.
  1. +2 −1 syncoid
  2. +9 −12 tests/syncoid/5_reset_resume_state/run.sh
  3. +9 −12 tests/syncoid/6_reset_resume_state2/run.sh
@@ -773,7 +773,8 @@ sub syncdataset {
};

$exit == 0 or do {
if (!$resume && $stdout =~ /\Qcontains partially-complete state\E/) {
# FreeBSD reports "dataset is busy" instead of "contains partially-complete state"
if (!$resume && ($stdout =~ /\Qcontains partially-complete state\E/ || $stdout =~ /\Qdataset is busy\E/)) {
if (!$quiet) { print "WARN: resetting partially receive state\n"; }
resetreceivestate($targethost,$targetfs,$targetisroot);
system("$synccmd") == 0 or do {
@@ -23,27 +23,24 @@ function cleanUp {
# export pool in any case
trap cleanUp EXIT

zfs create "${POOL_NAME}"/src -o mountpoint="${MOUNT_TARGET}"
zfs create -o mountpoint="${MOUNT_TARGET}" "${POOL_NAME}"/src
../../../syncoid --debug --compress=none "${POOL_NAME}"/src "${POOL_NAME}"/dst

dd if=/dev/urandom of="${MOUNT_TARGET}"/big_file bs=1M count=200

../../../syncoid --debug --compress=none --source-bwlimit=2m "${POOL_NAME}"/src "${POOL_NAME}"/dst &
syncoid_pid=$!
sleep 5
list_descendants ()
{
local children=$(ps -o pid= --ppid "$1")

for pid in $children
do
list_descendants "$pid"
done

echo "$children"
function getcpid() {
cpids=$(pgrep -P "$1"|xargs)
for cpid in $cpids;
do
echo "$cpid"
getcpid "$cpid"
done
}

kill $(list_descendants $$) || true
kill $(getcpid $$) || true
wait
sleep 1

@@ -23,7 +23,7 @@ function cleanUp {
# export pool in any case
trap cleanUp EXIT

zfs create "${POOL_NAME}"/src -o mountpoint="${MOUNT_TARGET}"
zfs create -o mountpoint="${MOUNT_TARGET}" "${POOL_NAME}"/src
../../../syncoid --debug --compress=none "${POOL_NAME}"/src "${POOL_NAME}"/dst

dd if=/dev/urandom of="${MOUNT_TARGET}"/big_file bs=1M count=200
@@ -32,19 +32,16 @@ zfs snapshot "${POOL_NAME}"/src@big
../../../syncoid --debug --no-sync-snap --compress=none --source-bwlimit=2m "${POOL_NAME}"/src "${POOL_NAME}"/dst &
syncoid_pid=$!
sleep 5
list_descendants ()
{
local children=$(ps -o pid= --ppid "$1")

for pid in $children
do
list_descendants "$pid"
done

echo "$children"
function getcpid() {
cpids=$(pgrep -P "$1"|xargs)
for cpid in $cpids;
do
echo "$cpid"
getcpid "$cpid"
done
}

kill $(list_descendants $$) || true
kill $(getcpid $$) || true
wait
sleep 1

0 comments on commit 9791094

Please sign in to comment.
You can’t perform that action at this time.