The attached script successfully deadlocks 9228ac3a69c4.

DES
-- 
Dag-Erling Smørgrav - d...@freebsd.org

#!/bin/sh

: ${n:=$(nproc)}
: ${pool:=zroot}
basefs="${pool}/zfsdl"

set -eu

zfs destroy -r "${basefs}" >/dev/null 2>&1 || true
zfs create -o com.sun:auto-snapshot=false "${basefs}"
basedir="$(zfs get -H -o value mountpoint "${basefs}")"

echo "preparing tarball..." >&2
tarball="${basedir}/zfsdl.tar"
mkdir "${basedir}/src"
(cd /usr/src ; find * -type d) | (cd "${basedir}/src" ; xargs mkdir -p)
(cd /usr/src ; find * -type f) | (cd "${basedir}/src" ; xargs touch)
tar cf "${tarball}" -C "${basedir}" src

zfs_deadlock() {
        local fs=$1 dir
        zfs create "${fs}"
        dir="$(zfs get -H -o value mountpoint "${fs}")"
        zfs snapshot "${fs}@empty"
        while ! [ -f "${basedir}/stop" ] ; do
                echo "fill ${fs}..." >&2
                tar xf "${tarball}" -C "${dir}"
                echo "rollback ${fs}..." >&2
                zfs rollback -rR "${fs}@empty"
        done
}

for i in $(seq -w "${n}") ; do
        zfs_deadlock "${basefs}/${i}" &
        sleep 1
done

wait

echo "stop" >&2

zfs destroy -r "${basefs}"

Reply via email to