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 https://opensource.org/licenses/CDDL-1.0.
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#
24# Copyright (c) 2023 by Proxmox. All rights reserved.
25#
26
27. $STF_SUITE/include/libtest.shlib
28
29# DESCRIPTION:
30# Verify that nfs shares persist after zfs mount -a
31#
32# STRATEGY:
33# 1. Verify that the filesystem is not shared.
34# 2. Enable the 'sharenfs' property
35# 3. Verify filesystem is shared
36# 4. Invoke 'zfs mount -a'
37# 5. Verify filesystem is still shared
38
39verify_runnable "global"
40
41function cleanup
42{
43	log_must zfs set sharenfs=off $TESTPOOL/$TESTFS
44	is_shared $TESTPOOL/$TESTFS && \
45		log_must unshare_fs $TESTPOOL/$TESTFS
46	log_must zfs share -a
47}
48
49
50log_onexit cleanup
51
52cleanup
53
54log_must zfs set sharenfs="on" $TESTPOOL/$TESTFS
55log_must is_shared $TESTPOOL/$TESTFS
56log_must is_exported $TESTPOOL/$TESTFS
57
58log_must zfs mount -a
59log_must is_shared $TESTPOOL/$TESTFS
60log_must is_exported $TESTPOOL/$TESTFS
61
62log_pass "Verify that nfs shares persist after zfs mount -a"
63