1#!/bin/ksh -p 2# 3# This file and its contents are supplied under the terms of the 4# Common Development and Distribution License ("CDDL"), version 1.0. 5# You may only use this file in accordance with the terms of version 6# 1.0 of the CDDL. 7# 8# A full copy of the text of the CDDL should have accompanied this 9# source. A copy of the CDDL is also available via the Internet at 10# http://www.illumos.org/license/CDDL. 11# 12 13# 14# Copyright (c) 2015 by Delphix. All rights reserved. 15# 16 17. $STF_SUITE/include/libtest.shlib 18 19# 20# DESCRIPTION: 21# Verify that zfs mount should fail with a non-empty directory 22# 23# STRATEGY: 24# 1. Unmount the dataset 25# 2. Create a new empty directory 26# 3. Set the dataset's mountpoint 27# 4. Attempt to mount the dataset 28# 5. Verify the mount succeeds 29# 6. Unmount the dataset 30# 7. Create a file in the directory created in step 2 31# 8. Attempt to mount the dataset 32# 9. Verify the mount fails 33# 34 35verify_runnable "both" 36 37log_assert "zfs mount fails with non-empty directory" 38 39fs=$TESTPOOL/$TESTFS 40 41log_must zfs umount $fs 42log_must mkdir -p $TESTDIR 43log_must zfs set mountpoint=$TESTDIR $fs 44log_must zfs mount $fs 45log_must zfs umount $fs 46log_must touch $TESTDIR/testfile.$$ 47log_mustnot zfs mount $fs 48log_must rm -rf $TESTDIR 49 50log_pass "zfs mount fails non-empty directory as expected." 51