]>
git.proxmox.com Git - mirror_zfs-debian.git/blob - tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_007_pos.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/tests
/functional
/cli_root
/zfs_mount
/zfs_mount.kshlib
36 # The following options can be set on a temporary basis using the -o option
37 # without affecting the on-disk property. The original on-disk value will be
38 # restored when the file system is unmounted and mounted.
40 # PROPERTY MOUNT OPTION
42 # devices devices/nodevices
45 # setuid setuid/nosetuid
48 # 1. Create filesystem and get origianl property value.
49 # 2. Using 'zfs mount -o' to set filesystem property.
50 # 3. Verify the property was set temporarily.
51 # 4. Verify it will not affect the property that is stored on disk.
56 if ! ismounted
$TESTPOOL/$TESTFS; then
57 log_must zfs mount
$TESTPOOL/$TESTFS
61 log_assert
"Verify '-o' will set filesystem property temporarily, " \
62 "without affecting the property that is stored on disk."
65 set -A properties
"atime" "devices" "exec" "readonly" "setuid"
68 # Get the specified filesystem property reverse mount option.
73 function get_reverse_option
78 # Define property value: "reverse if value=on" "reverse if value=off"
80 set -A values
"noatime" "atime" \
86 set -A values
"noatime" "atime" \
87 "nodevices" "devices" \
94 while (( i
< ${#properties[@]} )); do
95 if [[ $prop == ${properties[$i]} ]]; then
101 if (( i
>= ${#properties[@]} )); then
102 log_fail
"Incorrect option: $prop"
107 val
=$
(get_prop
$prop $fs) || log_fail
"get_prop $prop $fs"
108 if [[ $val == "on" ]]; then
111 (( ind
= i
* 2 + 1 ))
120 for property
in ${properties[@]}; do
121 orig_val
=$
(get_prop
$property $fs)
122 (($?
!= 0)) && log_fail
"get_prop $property $fs"
124 # Set filesystem property temporarily
125 reverse_opt
=$
(get_reverse_option
$fs $property)
126 log_must zfs mount
-o remount
,$reverse_opt $fs
128 cur_val
=$
(get_prop
$property $fs)
129 (($?
!= 0)) && log_fail
"get_prop $property $fs"
131 # In LZ, a user with all zone privileges can never with "devices"
132 if ! is_global_zone
&& [[ $property == devices
]] ; then
133 if [[ $cur_val != off ||
$orig_val != off
]]; then
134 log_fail
"'devices' property shouldn't " \
137 elif [[ $orig_val == $cur_val ]]; then
138 log_fail
"zfs mount -o remount,$reverse_opt " \
139 "doesn't change property."
142 # unmount & mount will revert property to the original value
143 log_must zfs unmount
$fs
144 log_must zfs mount
$fs
146 cur_val
=$
(get_prop
$property $fs)
147 (($?
!= 0)) && log_fail
"get_prop $property $fs"
148 if [[ $orig_val != $cur_val ]]; then
149 log_fail
"zfs mount -o remount,$reverse_opt " \
150 "change the property that is stored on disks"
154 log_pass
"Verify '-o' set filesystem property temporarily passed."