Last active
November 25, 2023 05:54
-
-
Save masonmark/03c7cb08e22968b1f2feb1a6ac3c9701 to your computer and use it in GitHub Desktop.
zfs_bug_15526_reproducer.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# masonmark 2023-11-25 | |
# | |
# This is my modified reproducer.sh for https://github.com/openzfs/zfs/issues/15526 | |
# Original: https://gist.github.com/tonyhutter/d69f305508ae3b7ff6e9263b22031a84#file-reproducer-sh | |
# | |
# This is my modified reproducer script, which just fixes the typo in | |
# the example command and comments out the initial if block. I did | |
# not need zfs_bclone_enabled to be set (the orginial script got a | |
# "file not found" on my system, which is a physical machine running | |
# TrueNAS-SCALE-23.10.0.1 from a consumer SATA SSD. The machine is | |
# based on my kids' old gaming PC and has Intel Core i9 9900K CPU | |
# and a 3 NVMe SSDs, 5 SATA SSDs, and 7 spinning magnetic disks. | |
# | |
# This script reproduced the bug first try, and every try so far, | |
# within a few seconds, when run from the home director of the | |
# admin user, which is located on the default boot ZFS filesystem | |
# created by the TrueNAS SCALE installer. | |
# 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 | |
# | |
# I commented the above out because this TrueNAS SCALE system is unmodified | |
# from what the installed configured, and I want to keep it that way for | |
# my testing. However, the reproducer apparently reproduces regardless of | |
# whether block-cloning is enabled; because I could reproduce this within the | |
# home directory of the admin user which is on boot-pool. | |
# | |
# root@truenas:/mnt/slow# zpool get all | grep clon | |
# big bcloneused 0 - | |
# big bclonesaved 0 - | |
# big bcloneratio 1.00x - | |
# big feature@block_cloning enabled local | |
# boot-pool bcloneused 0 - | |
# boot-pool bclonesaved 0 - | |
# boot-pool bcloneratio 1.00x - | |
# boot-pool feature@block_cloning disabled local | |
# fast bcloneused 1.71G - | |
# fast bclonesaved 3.41G - | |
# fast bcloneratio 2.99x - | |
# fast feature@block_cloning active local | |
# medium bcloneused 0 - | |
# medium bclonesaved 0 - | |
# medium bcloneratio 1.00x - | |
# medium feature@block_cloning enabled local | |
# slow bcloneused 1.46G - | |
# slow bclonesaved 2.92G - | |
# slow bcloneratio 2.99x - | |
# slow feature@block_cloning active local | |
# root@truenas:/mnt/slow# | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is how easy it was to trigger for me. Notes:
fast
is a single-device fast NVMe SSD,slow
is a 6-spinning-disk RAIDZ2, and the home directory ofadmin
is on the boot device (a single-device SATA SSD).