#!/bin/sh ## Reproduce zdb core dump on: # FreeBSD 15.0-CURRENT #0 main-n266452-070d9e3540e6: Thu Nov 16 17:53:15 CET 2023 # This include "zfs: merge openzfs/zfs@887a3c533" set -eu rm -f zdb.core # Create 4 virtual disks (Need 4GB available in /tmp) for i in {1..4}; do truncate -s 1G /tmp/disk$i.img done # Reproduce a simpler version of cddl/zfs/tests/replacement/replacement_002_pos.ksh zpool create -f testpool raidz1 /tmp/disk1.img /tmp/disk2.img /tmp/disk3.img zpool status zfs create testpool/testfs zfs set mountpoint=/testdir testpool/testfs echo "Convert /dev/md1 into a mirror by attaching a new disk to it...This should be prevented" # Previous version "cannot attach /dev/md4 to /dev/md1: can only attach to mirrors and top-level disks" # works on: 15.0-CURRENT FreeBSD 15.0-CURRENT #11 main-n265732-166a655fcf1: Thu Oct 5 03:22:24 PDT 2023 zpool attach testpool /tmp/disk1.img /tmp/disk4.img && echo "First bug triggered: attach worked" || echo "First bug not triggered!" zpool status zpool export testpool zpool import testpool -d /tmp zfs umount testpool/testfs echo "zdb verifying checksum... should not panic" zdb -cdui testpool/testfs && echo "Second bug not triggered (zdb didn't fails)" || echo "Second bug triggered (zdb fails)" if [ -f zdb.core ]; then echo "Second bug triggered: Core file found" else echo "Second bug not triggered: No core file found" fi # Cleanup zpool export testpool for i in {1..4}; do rm /tmp/disk$i.img done