4 # The contents of this file are subject to the terms of the
5 # Common Development and Distribution License (the "License").
6 # You may not use this file except in compliance with the License.
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
23 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 # Use is subject to license terms.
28 # Copyright (c) 2016 by Delphix. All rights reserved.
31 . $STF_SUITE/include/libtest.shlib
32 . $STF_SUITE/tests/functional/cli_root/zfs_mount/zfs_mount.cfg
34 function force_unmount #dev
39 if (( $? == 0 )); then
40 log_must zfs $unmountforce $dev
45 # Create pool and ( fs | container | vol ) with the given parameters,
46 # it'll destroy prior exist one that has the same name.
48 function setup_filesystem #disklist #pool #fs #mntpoint #type #vdev
57 if [[ -z $pool || -z $fs || -z $mntpoint ]]; then
58 log_note "Missing parameter: (\"$pool\", \"$fs\", \"$mntpoint\")"
62 if is_global_zone && [[ -z $disklist ]] ; then
63 log_note "Missing disklist."
67 if [[ $vdev != "" && \
68 $vdev != "mirror" && \
69 $vdev != "raidz" ]] ; then
71 log_note "Wrong vdev: (\"$vdev\")"
76 create_pool $pool $vdev $disklist
78 datasetexists $pool/$fs && \
79 log_must cleanup_filesystem $pool $fs
81 rmdir $mntpoint > /dev/null 2>&1
82 if [[ ! -d $mntpoint ]]; then
83 log_must mkdir -p $mntpoint
87 'ctr') log_must zfs create $pool/$fs
88 log_must zfs set mountpoint=$mntpoint $pool/$fs
90 'vol') log_must zfs create -V $VOLSIZE $pool/$fs
92 *) log_must zfs create $pool/$fs
93 log_must zfs set mountpoint=$mntpoint $pool/$fs
100 # Destroy ( fs | container | vol ) with the given parameters.
101 function cleanup_filesystem #pool #fs
107 if [[ -z $pool || -z $fs ]]; then
108 log_note "Missing parameter: (\"$pool\", \"$fs\")"
112 if datasetexists "$pool/$fs" ; then
113 mtpt=$(get_prop mountpoint "$pool/$fs")
114 log_must zfs destroy -r $pool/$fs
117 log_must rm -rf $mtpt
125 # Make sure 'zfs mount' should display all ZFS filesystems currently mounted.
126 # The results of 'zfs mount' and 'df -F zfs' should be identical.
127 function verify_mount_display
131 for fs in $(zfs $mountcmd | awk '{print $1}') ; do