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 2009 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 FSType-specific option works well with legacy mount.
39 # 1. Set up FSType-specific options and expected keywords array.
40 # 2. Create a test ZFS file system and set mountpoint=legacy.
41 # 3. Mount ZFS test filesystem with specific options.
42 # 4. Verify the filesystem was mounted with specific option.
43 # 5. Loop check all the options.
46 verify_runnable "both"
50 ismounted $tmpmnt && log_must umount $tmpmnt
51 [[ -d $tmpmnt ]] && log_must rm -rf $tmpmnt
52 [[ -n $oldmpt ]] && log_must zfs set mountpoint=$oldmpt $testfs
53 ! ismounted $oldmpt && log_must zfs mount $testfs
56 log_assert "With legacy mount, FSType-specific option works well."
60 # /mnt on pool/fs read/write/setuid/devices/noexec/xattr/atime/dev=2d9009e
63 # specific Keyword specific Keyword
75 # Only older kernels support non-blocking mandatory locks
76 if [[ $(linux_version) -lt $(linux_version "4.4") ]]; then
77 args+=("mand" "nomand")
80 # 'xattr' and 'devices' are not supported on FreeBSD
81 # Perhaps more options need to be added.
89 "devices" "/devices/" "nodevices" "/nodevices/" \
90 "exec" "/exec/" "noexec" "/noexec/" \
91 "nbmand" "/nbmand/" "nonbmand" "/nonbmand/" \
92 "ro" "read only" "rw" "read/write" \
93 "setuid" "/setuid/" "nosetuid" "/nosetuid/" \
94 "xattr" "/xattr/" "noxattr" "/noxattr/" \
95 "atime" "/atime/" "noatime" "/noatime/"
99 [[ -d $tmpmnt ]] && rm -rf $tmpmnt
100 testfs=$TESTPOOL/$TESTFS
101 log_must mkdir $tmpmnt
102 oldmpt=$(get_prop mountpoint $testfs)
103 log_must zfs set mountpoint=legacy $testfs
106 while ((i < ${#args[@]})); do
107 if is_linux || is_freebsd; then
108 log_must mount -t zfs -o ${args[$i]} $testfs $tmpmnt
110 msg=$(mount | grep "$tmpmnt ")
112 echo $msg | grep "${args[((i))]}" > /dev/null 2>&1
113 if (($? != 0)) ; then
114 echo $msg | grep "${args[((i-1))]}" > /dev/null 2>&1
115 if (($? == 0)) ; then
116 log_fail "Expected option: ${args[((i))]} \n" \
121 log_must umount $tmpmnt
124 log_must mount -F zfs -o ${args[$i]} $testfs $tmpmnt
126 msg=$(mount | grep "^$tmpmnt ")
128 # In LZ, a user with all zone privileges can never "devices"
129 if ! is_global_zone && [[ ${args[$i]} == devices ]] ; then
130 args[((i+1))]="/nodevices/"
133 echo $msg | grep "${args[((i+1))]}" > /dev/null 2>&1
134 if (($? != 0)) ; then
135 log_fail "Expected option: ${args[((i+1))]} \n" \
140 log_must umount $tmpmnt
145 log_pass "With legacy mount, FSType-specific option works well passed."