The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d6bc31f92991b6d67da54868f3563278015389ca
commit d6bc31f92991b6d67da54868f3563278015389ca Author: Mark Johnston <[email protected]> AuthorDate: 2026-01-25 15:12:19 +0000 Commit: Mark Johnston <[email protected]> CommitDate: 2026-01-25 22:41:10 +0000 makefs/zfs/tests: Force-destroy md devices Most of these tests create a md(4) device backed by a makefs-generated image, then import the pool, using the md device as a pool vdev. When a test finishes, it destroys the pool, then destroys the md device. Once in a while md device destruction fails with EBUSY. This happens when a GEOM consumer is holding the device open; kern_mddetach_locked() simply fails if any consumers are present. zpool destruction is synchronous so ZFS is innocent, rather, the problem seems to be that GEOM re-tastes the device after the zpool reference goes away. This operation creates a transient reference that causes the spurious failure. Use "mdconfig -o force" to work around this. MFC after: 2 weeks --- usr.sbin/makefs/tests/makefs_zfs_tests.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.sbin/makefs/tests/makefs_zfs_tests.sh b/usr.sbin/makefs/tests/makefs_zfs_tests.sh index 9d5ce300843e..7f0187be054f 100644 --- a/usr.sbin/makefs/tests/makefs_zfs_tests.sh +++ b/usr.sbin/makefs/tests/makefs_zfs_tests.sh @@ -51,7 +51,7 @@ common_cleanup() if [ -f "$TEST_MD_DEVICE_FILE" ]; then md=$(cat $TEST_MD_DEVICE_FILE) if [ -c /dev/"$md" ]; then - mdconfig -d -u "$md" + mdconfig -o force -d -u "$md" fi fi } @@ -210,7 +210,7 @@ compression_body() atf_check zpool destroy ${ZFS_POOL_NAME} atf_check rm -f ${TEST_ZFS_POOL_NAME} - atf_check mdconfig -d -u $(cat ${TEST_MD_DEVICE_FILE}) + atf_check mdconfig -o force -d -u $(cat ${TEST_MD_DEVICE_FILE}) atf_check rm -f ${TEST_MD_DEVICE_FILE} done }
