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