]>
git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blob - zfs/tests/zfs-tests/tests/functional/cli_root/zfs_unmount/zfs_unmount_008_neg.ksh
5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
24 # Copyright 2007 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
28 .
$STF_SUITE/include
/libtest.shlib
32 # Verify that zfs unmount should fail with bad parameters or scenarios:
34 # 2. too many arguments;
36 # 4. invalid datasets;
37 # 5. invalid mountpoint;
38 # 6. already unmounted zfs filesystem;
39 # 7. legacy mounted zfs filesystem
42 # 1. Make an array of bad parameters
43 # 2. Use zfs unmount to unmount the filesystem
44 # 3. Verify that zfs unmount returns error
47 verify_runnable
"both"
51 for ds
in $vol $fs1; do
52 if datasetexists
$ds; then
53 log_must
$ZFS destroy
-f $ds
57 if snapexists
$snap; then
58 log_must
$ZFS destroy
$snap
61 if [[ -e /tmp
/$file ]]; then
64 if [[ -d /tmp
/$dir ]]; then
70 log_assert
"zfs unmount fails with bad parameters or scenarios"
75 snap
=$TESTPOOL/$TESTFS@snap.$$
76 set -A badargs
"A" "-A" "F" "-F" "-" "-x" "-?"
78 if ! ismounted
$fs; then
79 log_must
$ZFS mount
$fs
82 log_must
$ZFS snapshot
$snap
83 if is_global_zone
; then
84 log_must
$ZFS create
-V 10m
$vol
90 for arg
in ${badargs[@]}; do
91 log_mustnot
eval "$ZFS unmount $arg $fs >/dev/null 2>&1"
95 #Testing invalid datasets
96 for ds
in $snap $vol "blah"; do
97 for opt
in "" "-f"; do
98 log_mustnot
eval "$ZFS unmount $opt $ds >/dev/null 2>&1"
102 #Testing invalid mountpoint
108 log_must
$ZFS create
-o mountpoint
=/tmp
/$dir $fs1
109 curpath
=`$DIRNAME $0`
111 for mpt
in "./$dir" "./$file" "/tmp"; do
112 for opt
in "" "-f"; do
113 log_mustnot
eval "$ZFS unmount $opt $mpt >/dev/null 2>&1"
118 #Testing null argument and too many arguments
119 for opt
in "" "-f"; do
120 log_mustnot
eval "$ZFS unmount $opt >/dev/null 2>&1"
121 log_mustnot
eval "$ZFS unmount $opt $fs $fs1 >/dev/null 2>&1"
124 #Testing already unmounted filesystem
125 log_must
$ZFS unmount
$fs1
126 for opt
in "" "-f"; do
127 log_mustnot
eval "$ZFS unmount $opt $fs1 >/dev/null 2>&1"
128 log_mustnot
eval "$ZFS unmount /tmp/$dir >/dev/null 2>&1"
131 #Testing legacy mounted filesystem
132 log_must
$ZFS set mountpoint
=legacy
$fs1
134 log_must
$MOUNT -t zfs
$fs1 /tmp
/$dir
136 log_must
$MOUNT -F zfs
$fs1 /tmp
/$dir
138 for opt
in "" "-f"; do
139 log_mustnot
eval "$ZFS unmount $opt $fs1 >/dev/null 2>&1"
143 log_pass
"zfs unmount fails with bad parameters or scenarios as expected."