canmount_003_pos.ksh revision 1d32ba663e202c24a5a1f2e5aef83fffb447cb7f
c99e4bdccfb4ac4da569c64a43baaf908d726329Chris Kirby# CDDL HEADER START
c99e4bdccfb4ac4da569c64a43baaf908d726329Chris Kirby# The contents of this file are subject to the terms of the
c99e4bdccfb4ac4da569c64a43baaf908d726329Chris Kirby# Common Development and Distribution License (the "License").
c99e4bdccfb4ac4da569c64a43baaf908d726329Chris Kirby# You may not use this file except in compliance with the License.
c99e4bdccfb4ac4da569c64a43baaf908d726329Chris Kirby# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
c99e4bdccfb4ac4da569c64a43baaf908d726329Chris Kirby# See the License for the specific language governing permissions
c99e4bdccfb4ac4da569c64a43baaf908d726329Chris Kirby# and limitations under the License.
c99e4bdccfb4ac4da569c64a43baaf908d726329Chris Kirby# When distributing Covered Code, include this CDDL HEADER in each
c99e4bdccfb4ac4da569c64a43baaf908d726329Chris Kirby# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
c99e4bdccfb4ac4da569c64a43baaf908d726329Chris Kirby# If applicable, add the following below this CDDL HEADER, with the
c99e4bdccfb4ac4da569c64a43baaf908d726329Chris Kirby# fields enclosed by brackets "[]" replaced with your own identifying
c99e4bdccfb4ac4da569c64a43baaf908d726329Chris Kirby# information: Portions Copyright [yyyy] [name of copyright owner]
c99e4bdccfb4ac4da569c64a43baaf908d726329Chris Kirby# CDDL HEADER END
c99e4bdccfb4ac4da569c64a43baaf908d726329Chris Kirby# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
c99e4bdccfb4ac4da569c64a43baaf908d726329Chris Kirby# Use is subject to license terms.
c99e4bdccfb4ac4da569c64a43baaf908d726329Chris Kirby# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
c99e4bdccfb4ac4da569c64a43baaf908d726329Chris Kirby. $STF_SUITE/tests/functional/cli_root/zfs_set/zfs_set_common.kshlib
c99e4bdccfb4ac4da569c64a43baaf908d726329Chris Kirby# DESCRIPTION:
c99e4bdccfb4ac4da569c64a43baaf908d726329Chris Kirby# While canmount=noauto and the dataset is mounted,
c99e4bdccfb4ac4da569c64a43baaf908d726329Chris Kirby# zfs must not attempt to unmount it.
c99e4bdccfb4ac4da569c64a43baaf908d726329Chris Kirby# 1. Setup a pool and create fs, volume, snapshot clone within it.
c99e4bdccfb4ac4da569c64a43baaf908d726329Chris Kirby# 2. Set canmount=noauto for each dataset and check the return value
c99e4bdccfb4ac4da569c64a43baaf908d726329Chris Kirby# and check if it still can not be unmounted when the dataset is mounted
c99e4bdccfb4ac4da569c64a43baaf908d726329Chris Kirbyset -A dataset_pos "$TESTPOOL/$TESTFS" "$TESTPOOL/$TESTCLONE"
c99e4bdccfb4ac4da569c64a43baaf908d726329Chris Kirby log_must zfs set canmount=${old_canmount[i]} $ds
a7f53a5629374ca27c5696ace9a1946c2ca050f4Chris Kirby if [[ -d $mntp ]]; then
c99e4bdccfb4ac4da569c64a43baaf908d726329Chris Kirby if snapexists $TESTPOOL/$TESTFS@$TESTSNAP ; then
c99e4bdccfb4ac4da569c64a43baaf908d726329Chris Kirby log_must zfs destroy -R $TESTPOOL/$TESTFS@$TESTSNAP
c99e4bdccfb4ac4da569c64a43baaf908d726329Chris Kirbylog_assert "While canmount=noauto and the dataset is mounted,"\
c99e4bdccfb4ac4da569c64a43baaf908d726329Chris Kirbylog_must zfs snapshot $TESTPOOL/$TESTFS@$TESTSNAP
c99e4bdccfb4ac4da569c64a43baaf908d726329Chris Kirbylog_must zfs clone $TESTPOOL/$TESTFS@$TESTSNAP $TESTPOOL/$TESTCLONE
c99e4bdccfb4ac4da569c64a43baaf908d726329Chris Kirbytypeset -i i=0
a7f53a5629374ca27c5696ace9a1946c2ca050f4Chris Kirbylog_pass "Setting canmount=noauto to filesystem while dataset busy pass."