1#!/bin/ksh -p 2# SPDX-License-Identifier: CDDL-1.0 3# 4# This file and its contents are supplied under the terms of the 5# Common Development and Distribution License ("CDDL"), version 1.0. 6# You may only use this file in accordance with the terms of version 7# 1.0 of the CDDL. 8# 9# A full copy of the text of the CDDL should have accompanied this 10# source. A copy of the CDDL is also available via the Internet at 11# https://opensource.org/license/CDDL-1.0. 12# 13 14# 15# Copyright (c) 2026, TrueNAS. 16# 17 18. $STF_SUITE/tests/functional/snapdir/snapdir.kshlib 19. $STF_SUITE/tests/functional/snapdir/snapdir.cfg 20 21verify_runnable "both" 22 23log_assert "Verify unmounting snapshot automount away allows another automount" 24 25function cleanup 26{ 27 destroy_pool $TESTPOOL 28} 29 30log_onexit cleanup 31 32# Create a pool and a snapshot 33create_pool $TESTPOOL $DISKS 34log_must zfs create -o snapdir=visible -o mountpoint=$TESTDIR/fs $TESTPOOL/$TESTFS 35log_must zfs snapshot $TESTPOOL/$TESTFS@snap 36 37# Trigger the mount 38log_must ls -l $TESTDIR/fs/$SNAPROOT/snap 39log_must test "$(get_mount_paths $TESTPOOL/$TESTFS@snap)" == "$TESTDIR/fs/$SNAPROOT/snap" 40 41# Unmount explicitly 42log_must umount $TESTDIR/fs/$SNAPROOT/snap 43log_must test -z "$(get_mount_paths $TESTPOOL/$TESTFS@snap)" 44 45# Trigger the mount again 46log_must ls -l $TESTDIR/fs/$SNAPROOT/snap 47log_must test "$(get_mount_paths $TESTPOOL/$TESTFS@snap)" == "$TESTDIR/fs/$SNAPROOT/snap" 48 49log_pass "Snapshot automount succeeds after previous automount is unmounted." 50