1#! /bin/ksh -p
2#
3# CDDL HEADER START
4#
5# This file and its contents are supplied under the terms of the
6# Common Development and Distribution License ("CDDL"), version 1.0.
7# You may only use this file in accordance with the terms of version
8# 1.0 of the CDDL.
9#
10# A full copy of the text of the CDDL should have accompanied this
11# source.  A copy of the CDDL is also available via the Internet at
12# http://www.illumos.org/license/CDDL.
13#
14# CDDL HEADER END
15#
16
17#
18# Copyright (c) 2020, George Amanakis. All rights reserved.
19#
20
21. $STF_SUITE/include/libtest.shlib
22. $STF_SUITE/tests/functional/removal/removal.kshlib
23
24#
25# DESCRIPTION:
26#	Resilvering results in no CKSUM errors in pools with indirect vdevs.
27#
28# STRATEGY:
29#	1. Create a pool with two top-vdevs
30#	2. Write some files
31#	3. Remove one of the top-vdevs
32#	4. Reattach it to make a mirror
33#
34
35TMPDIR=${TMPDIR:-$TEST_BASE_DIR}
36
37DISK1="$TMPDIR/dsk1"
38DISK2="$TMPDIR/dsk2"
39DISKS="$DISK1 $DISK2"
40
41# fio options
42export DIRECTORY=/$TESTPOOL
43export NUMJOBS=16
44export RUNTIME=10
45export PERF_RANDSEED=1234
46export PERF_COMPPERCENT=66
47export PERF_COMPCHUNK=0
48export BLOCKSIZE=4K
49export SYNC_TYPE=0
50export DIRECT=1
51export FILE_SIZE=128M
52
53log_must mkfile 4g $DISK1
54log_must mkfile 4g $DISK2
55
56function cleanup
57{
58	default_cleanup_noexit
59	log_must rm -f $DISKS
60}
61
62log_must zpool create -O recordsize=4k $TESTPOOL $DISK1 $DISK2
63log_onexit cleanup
64
65log_must fio $FIO_SCRIPTS/mkfiles.fio
66log_must fio $FIO_SCRIPTS/sequential_reads.fio
67
68log_must zpool remove -w $TESTPOOL $DISK2
69log_must zpool attach -w $TESTPOOL $DISK1 $DISK2
70
71verify_pool $TESTPOOL
72
73log_pass "Resilvering results in no CKSUM errors with indirect vdevs"
74