1#!/bin/ksh -p 2# 3# CDDL HEADER START 4# 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. 8# 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. 13# 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] 19# 20# CDDL HEADER END 21# 22 23. $STF_SUITE/include/libtest.shlib 24 25# 26# DESCRIPTION: 27# Verify that ACLs survive remount. 28# Regression test for https://github.com/zfsonlinux/zfs/issues/4520 29# 30# STRATEGY: 31# 1. Test presence of default and regular ACLs after remount 32# a. Can set and list ACL before remount 33# b. Can list ACL after remount 34# 35 36verify_runnable "both" 37log_assert "Verify regular and default POSIX ACLs survive remount" 38 39typeset acl_str1="^group:$ZFS_ACL_STAFF_GROUP:-wx$" 40typeset acl_str2="^default:group:$ZFS_ACL_STAFF_GROUP:-wx$" 41typeset ACLDIR="$TESTDIR/dir.1" 42 43log_note "Testing access to DIRECTORY" 44log_must mkdir $ACLDIR 45log_must setfacl -m g:$ZFS_ACL_STAFF_GROUP:wx $ACLDIR 46log_must setfacl -d -m g:$ZFS_ACL_STAFF_GROUP:wx $ACLDIR 47getfacl $ACLDIR 2> /dev/null | egrep -q "$acl_str1" 48if [ "$?" -eq "0" ]; then 49 getfacl $ACLDIR 2> /dev/null | egrep -q "$acl_str2" 50fi 51 52if [ "$?" -eq "0" ]; then 53 log_must zfs unmount $TESTPOOL/$TESTFS 54 log_must zfs mount $TESTPOOL/$TESTFS 55 log_must eval "getfacl $ACLDIR 2> /dev/null | egrep -q \"$acl_str1\"" 56 log_must eval "getfacl $ACLDIR 2> /dev/null | egrep -q \"$acl_str2\"" 57 log_pass "POSIX ACLs survive remount" 58else 59 log_fail "Group '$ZFS_ACL_STAFF_GROUP' does not have 'rwx'" 60fi 61