1#!/bin/sh 2# $FreeBSD$ 3 4# Regression test for r317712. 5 6. `dirname $0`/conf.sh 7 8echo 1..1 9 10ddbs=2048 11m1=`mktemp $base.XXXXXX` || exit 1 12m2=`mktemp $base.XXXXXX` || exit 1 13 14dd if=/dev/zero of=$m1 bs=$ddbs count=1024 >/dev/null 2>&1 15dd if=/dev/zero of=$m2 bs=$ddbs count=1024 >/dev/null 2>&1 16 17us0=$(mdconfig -t vnode -f $m1) || exit 1 18us1=$(mdconfig -t vnode -f $m2) || exit 1 19 20gmirror label $name /dev/$us0 /dev/$us1 || exit 1 21devwait 22 23# Ensure that the mirrors are marked dirty, and then disconnect them. 24# We need to have the gmirror provider open when destroying the MDs since 25# gmirror will automatically mark the mirrors clean when the provider is closed. 26exec 9>/dev/mirror/$name 27dd if=/dev/zero bs=$ddbs count=1 >&9 2>/dev/null 28mdconfig -d -u ${us0#md} -o force || exit 1 29mdconfig -d -u ${us1#md} -o force || exit 1 30exec 9>&- 31 32dd if=/dev/random of=$m1 bs=$ddbs count=1 conv=notrunc >/dev/null 2>&1 33us0=$(attach_md -t vnode -f $m1) || exit 1 34devwait # This will take kern.geom.mirror.timeout seconds. 35 36# Re-attach the second mirror and wait for it to synchronize. 37us1=$(attach_md -t vnode -f $m2) || exit 1 38syncwait 39 40# Verify the two mirrors are identical. Destroy the gmirror first so that 41# the mirror metadata is wiped; otherwise the metadata blocks will fail 42# the comparison. It would be nice to do this with a "gmirror verify" 43# command instead. 44gmirror destroy $name 45if cmp -s ${m1} ${m2}; then 46 echo "ok 1" 47else 48 echo "not ok 1" 49fi 50 51rm -f $m1 $m2 52