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