Skip to content

Instantly share code, notes, and snippets.

@tonyhutter
Created November 22, 2023 22:12
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tonyhutter/d69f305508ae3b7ff6e9263b22031a84 to your computer and use it in GitHub Desktop.
Save tonyhutter/d69f305508ae3b7ff6e9263b22031a84 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# Run this script multiple times in parallel inside your pool's mount
# to reproduce https://github.com/openzfs/zfs/issues/15526. Like:
#
# ./reproducer.sh & ./reproducer.sh & ./reproducer.sh & /reproducer.sh & wait
#
if [ $(cat /sys/module/zfs/parameters/zfs_bclone_enabled) != "1" ] ; then
echo "please set /sys/module/zfs/parameters/zfs_bclone_enabled = 1"
exit
fi
prefix="reproducer_${BASHPID}_"
dd if=/dev/urandom of=${prefix}0 bs=1M count=1 status=none
echo "writing files"
end=1000
h=0
for i in `seq 1 2 $end` ; do
let "j=$i+1"
cp ${prefix}$h ${prefix}$i
cp --reflink=never ${prefix}$i ${prefix}$j
let "h++"
done
echo "checking files"
for i in `seq 1 $end` ; do
diff ${prefix}0 ${prefix}$i
done
@danmcd
Copy link

danmcd commented Nov 30, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment