1*c5832a53SAlek Pinchuk#! /usr/bin/ksh -p
2*c5832a53SAlek Pinchuk#
3*c5832a53SAlek Pinchuk#
4*c5832a53SAlek Pinchuk# This file and its contents are supplied under the terms of the
5*c5832a53SAlek Pinchuk# Common Development and Distribution License ("CDDL"), version 1.0.
6*c5832a53SAlek Pinchuk# You may only use this file in accordance with the terms of version
7*c5832a53SAlek Pinchuk# 1.0 of the CDDL.
8*c5832a53SAlek Pinchuk#
9*c5832a53SAlek Pinchuk# A full copy of the text of the CDDL should have accompanied this
10*c5832a53SAlek Pinchuk# source.  A copy of the CDDL is also available via the Internet at
11*c5832a53SAlek Pinchuk# http://www.illumos.org/license/CDDL.
12*c5832a53SAlek Pinchuk#
13*c5832a53SAlek Pinchuk
14*c5832a53SAlek Pinchuk#
15*c5832a53SAlek Pinchuk# Copyright 2016 Nexenta Systems, Inc. All rights reserved.
16*c5832a53SAlek Pinchuk#
17*c5832a53SAlek Pinchuk
18*c5832a53SAlek Pinchuk. $STF_SUITE/include/libtest.shlib
19*c5832a53SAlek Pinchuk
20*c5832a53SAlek Pinchuk#
21*c5832a53SAlek Pinchuk# DESCRIPTION:
22*c5832a53SAlek Pinchuk# zfs umount should not fail because flushing of DNLC
23*c5832a53SAlek Pinchuk# uses async implementation of zfs_inactive
24*c5832a53SAlek Pinchuk#
25*c5832a53SAlek Pinchuk# STRATEGY:
26*c5832a53SAlek Pinchuk# 1. Call zfs unmount/mount to be sure DNLC is empty
27*c5832a53SAlek Pinchuk# 2. Create a lot of files
28*c5832a53SAlek Pinchuk# 3. Call zfs unmount command
29*c5832a53SAlek Pinchuk# 4. Make sure the file systems were unmounted
30*c5832a53SAlek Pinchuk# 5. Mount them back
31*c5832a53SAlek Pinchuk#
32*c5832a53SAlek Pinchuk
33*c5832a53SAlek Pinchukfor fs in 1 2 3; do
34*c5832a53SAlek Pinchuk	log_must mounted $TESTDIR.$fs
35*c5832a53SAlek Pinchuk	log_must zfs umount $TESTPOOL/$TESTFS.$fs
36*c5832a53SAlek Pinchuk	log_must unmounted $TESTDIR.$fs
37*c5832a53SAlek Pinchuk	log_must zfs mount $TESTPOOL/$TESTFS.$fs
38*c5832a53SAlek Pinchuk	log_must mounted $TESTDIR.$fs
39*c5832a53SAlek Pinchuk
40*c5832a53SAlek Pinchuk	for fn in $(seq 1 8096); do
41*c5832a53SAlek Pinchuk		log_must dd if=/dev/urandom of=$TESTDIR.$fs/file$fn bs=1024 \
42*c5832a53SAlek Pinchuk		    count=1
43*c5832a53SAlek Pinchuk	done
44*c5832a53SAlek Pinchuk
45*c5832a53SAlek Pinchuk	log_must zfs umount $TESTPOOL/$TESTFS.$fs
46*c5832a53SAlek Pinchuk	log_must unmounted $TESTDIR.$fs
47*c5832a53SAlek Pinchuk	log_must zfs mount $TESTPOOL/$TESTFS.$fs
48*c5832a53SAlek Pinchuk	log_must mounted $TESTDIR.$fs
49*c5832a53SAlek Pinchuk	log_must rm -f $TESTDIR.$fs/file*
50*c5832a53SAlek Pinchukdone
51*c5832a53SAlek Pinchuk
52*c5832a53SAlek Pinchuklog_pass "All file systems are unmounted"
53