1# vim: filetype=sh 2# 3# CDDL HEADER START 4# 5# The contents of this file are subject to the terms of the 6# Common Development and Distribution License (the "License"). 7# You may not use this file except in compliance with the License. 8# 9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10# or http://www.opensolaris.org/os/licensing. 11# See the License for the specific language governing permissions 12# and limitations under the License. 13# 14# When distributing Covered Code, include this CDDL HEADER in each 15# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16# If applicable, add the following below this CDDL HEADER, with the 17# fields enclosed by brackets "[]" replaced with your own identifying 18# information: Portions Copyright [yyyy] [name of copyright owner] 19# 20# CDDL HEADER END 21# 22 23# $FreeBSD$ 24 25# 26# Copyright 2012 Spectra Logic Corporation. All rights reserved. 27# Use is subject to license terms. 28# 29 30# Every test must restart the frozen pool state. 31function zil_setup 32{ 33 log_must $ZPOOL list $TESTPOOL 34 35 # In order for a frozen zpool to have a ZIL, it is necessary to 36 # sync it first. If a sync is not done first, no ZIL will exist, 37 # and consequently no post-freeze log records will be created. 38 log_must $TOUCH $TESTDIR/initial_data 39 log_must $FSYNC $TESTDIR/initial_data 40 log_must $ZPOOL freeze $TESTPOOL 41 log_must filesys_has_zil $TESTPOOL 42 return 0 43} 44 45function zil_reimport_pool 46{ 47 typeset pool="$1" 48 log_must filesys_has_zil $pool 49 log_must pool_maps_intact $pool 50 log_must $ZPOOL export $pool 51 log_must $ZPOOL import $pool 52 log_must pool_maps_intact $pool 53 log_mustnot filesys_has_zil $pool 54 return 0 55} 56