]>
git.proxmox.com Git - mirror_zfs-debian.git/blob - 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.
29 # Copyright (c) 2016 by Delphix. All rights reserved.
32 .
$STF_SUITE/include
/libtest.shlib
36 # Verify that zfs unmount should fail with bad parameters or scenarios:
38 # 2. too many arguments;
40 # 4. invalid datasets;
41 # 5. invalid mountpoint;
42 # 6. already unmounted zfs filesystem;
43 # 7. legacy mounted zfs filesystem
46 # 1. Make an array of bad parameters
47 # 2. Use zfs unmount to unmount the filesystem
48 # 3. Verify that zfs unmount returns error
51 verify_runnable
"both"
55 for ds
in $vol $fs1; do
56 if datasetexists
$ds; then
57 log_must zfs destroy
-f $ds
61 if snapexists
$snap; then
62 log_must zfs destroy
$snap
65 if [[ -e /tmp
/$file ]]; then
68 if [[ -d /tmp
/$dir ]]; then
74 log_assert
"zfs unmount fails with bad parameters or scenarios"
79 snap
=$TESTPOOL/$TESTFS@snap.$$
80 set -A badargs
"A" "-A" "F" "-F" "-" "-x" "-?"
82 if ! ismounted
$fs; then
83 log_must zfs mount
$fs
86 log_must zfs snapshot
$snap
87 if is_global_zone
; then
88 log_must zfs create
-V 10m
$vol
94 for arg
in ${badargs[@]}; do
95 log_mustnot
eval "zfs unmount $arg $fs >/dev/null 2>&1"
99 #Testing invalid datasets
100 for ds
in $snap $vol "blah"; do
101 for opt
in "" "-f"; do
102 log_mustnot
eval "zfs unmount $opt $ds >/dev/null 2>&1"
106 #Testing invalid mountpoint
112 log_must zfs create
-o mountpoint
=/tmp
/$dir $fs1
115 for mpt
in "./$dir" "./$file" "/tmp"; do
116 for opt
in "" "-f"; do
117 log_mustnot
eval "zfs unmount $opt $mpt >/dev/null 2>&1"
122 #Testing null argument and too many arguments
123 for opt
in "" "-f"; do
124 log_mustnot
eval "zfs unmount $opt >/dev/null 2>&1"
125 log_mustnot
eval "zfs unmount $opt $fs $fs1 >/dev/null 2>&1"
128 #Testing already unmounted filesystem
129 log_must zfs unmount
$fs1
130 for opt
in "" "-f"; do
131 log_mustnot
eval "zfs unmount $opt $fs1 >/dev/null 2>&1"
132 log_mustnot
eval "zfs unmount /tmp/$dir >/dev/null 2>&1"
135 #Testing legacy mounted filesystem
136 log_must zfs
set mountpoint
=legacy
$fs1
138 log_must mount
-t zfs
$fs1 /tmp
/$dir
140 log_must mount
-F zfs
$fs1 /tmp
/$dir
142 for opt
in "" "-f"; do
143 log_mustnot
eval "zfs unmount $opt $fs1 >/dev/null 2>&1"
147 log_pass
"zfs unmount fails with bad parameters or scenarios as expected."