15cabbc6bSPrashanth Sreenivasa#! /bin/ksh -p
25cabbc6bSPrashanth Sreenivasa#
35cabbc6bSPrashanth Sreenivasa# CDDL HEADER START
45cabbc6bSPrashanth Sreenivasa#
55cabbc6bSPrashanth Sreenivasa# This file and its contents are supplied under the terms of the
65cabbc6bSPrashanth Sreenivasa# Common Development and Distribution License ("CDDL"), version 1.0.
75cabbc6bSPrashanth Sreenivasa# You may only use this file in accordance with the terms of version
85cabbc6bSPrashanth Sreenivasa# 1.0 of the CDDL.
95cabbc6bSPrashanth Sreenivasa#
105cabbc6bSPrashanth Sreenivasa# A full copy of the text of the CDDL should have accompanied this
115cabbc6bSPrashanth Sreenivasa# source.  A copy of the CDDL is also available via the Internet at
125cabbc6bSPrashanth Sreenivasa# http://www.illumos.org/license/CDDL.
135cabbc6bSPrashanth Sreenivasa#
145cabbc6bSPrashanth Sreenivasa# CDDL HEADER END
155cabbc6bSPrashanth Sreenivasa#
165cabbc6bSPrashanth Sreenivasa
175cabbc6bSPrashanth Sreenivasa#
18*243952c7SMatt Ahrens# Copyright (c) 2014, 2017 by Delphix. All rights reserved.
195cabbc6bSPrashanth Sreenivasa#
205cabbc6bSPrashanth Sreenivasa
215cabbc6bSPrashanth Sreenivasa. $STF_SUITE/include/libtest.shlib
225cabbc6bSPrashanth Sreenivasa. $STF_SUITE/tests/functional/removal/removal.kshlib
235cabbc6bSPrashanth Sreenivasa
24*243952c7SMatt Ahrensfunction set_metaslab_force_ganging # new_value
255cabbc6bSPrashanth Sreenivasa{
265cabbc6bSPrashanth Sreenivasa	typeset new_value=$1
27*243952c7SMatt Ahrens	echo "metaslab_force_ganging/W $new_value" | mdb -kw
285cabbc6bSPrashanth Sreenivasa}
295cabbc6bSPrashanth Sreenivasa
305cabbc6bSPrashanth Sreenivasafunction cleanup
315cabbc6bSPrashanth Sreenivasa{
32*243952c7SMatt Ahrens	log_must set_metaslab_force_ganging 0t$((2**17 + 1))
335cabbc6bSPrashanth Sreenivasa	default_cleanup_noexit
345cabbc6bSPrashanth Sreenivasa}
355cabbc6bSPrashanth Sreenivasa
365cabbc6bSPrashanth Sreenivasadefault_setup_noexit "$DISKS"
37*243952c7SMatt Ahrenslog_must set_metaslab_force_ganging 0t$((2**14))
385cabbc6bSPrashanth Sreenivasalog_onexit cleanup
395cabbc6bSPrashanth Sreenivasa
405cabbc6bSPrashanth SreenivasaFILE_CONTENTS="Leeloo Dallas mul-ti-pass."
415cabbc6bSPrashanth Sreenivasa
425cabbc6bSPrashanth Sreenivasaecho $FILE_CONTENTS  >$TESTDIR/$TESTFILE0
435cabbc6bSPrashanth Sreenivasalog_must [ "x$(cat $TESTDIR/$TESTFILE0)" = "x$FILE_CONTENTS" ]
445cabbc6bSPrashanth Sreenivasalog_must file_write -o create -f $TESTDIR/$TESTFILE1 -b $((2**20)) -c $((2**7))
455cabbc6bSPrashanth Sreenivasa
465cabbc6bSPrashanth Sreenivasalog_must zpool remove $TESTPOOL $REMOVEDISK
475cabbc6bSPrashanth Sreenivasalog_must wait_for_removal $TESTPOOL
485cabbc6bSPrashanth Sreenivasalog_mustnot vdevs_in_pool $TESTPOOL $REMOVEDISK
495cabbc6bSPrashanth Sreenivasa
505cabbc6bSPrashanth Sreenivasalog_must dd if=/$TESTDIR/$TESTFILE0 of=/dev/null
515cabbc6bSPrashanth Sreenivasalog_must [ "x$(cat $TESTDIR/$TESTFILE0)" = "x$FILE_CONTENTS" ]
525cabbc6bSPrashanth Sreenivasa
535cabbc6bSPrashanth Sreenivasalog_pass "Removed device not in use after removal."
54