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) 2018 Datto Inc.
16#
17
18. $STF_SUITE/include/libtest.shlib
19
20#
21# DESCRIPTION:
22#	zfs inherit should inherit mountpoint on mountpoint=none children
23#
24# STRATEGY:
25#	1. Create a set of nested datasets with mountpoint=none
26#	2. Verify datasets aren't mounted
27#	3. Inherit mountpoint and verify all datasets are now mounted
28#
29
30verify_runnable "both"
31
32function inherit_cleanup
33{
34	log_must zfs destroy -fR $TESTPOOL/inherit_test
35}
36
37log_onexit inherit_cleanup
38
39
40log_must zfs create -o mountpoint=none $TESTPOOL/inherit_test
41log_must zfs create $TESTPOOL/inherit_test/child
42
43if ismounted $TESTPOOL/inherit_test; then
44	log_fail "$TESTPOOL/inherit_test is mounted"
45fi
46if ismounted $TESTPOOL/inherit_test/child; then
47	log_fail "$TESTPOOL/inherit_test/child is mounted"
48fi
49
50log_must zfs inherit mountpoint $TESTPOOL/inherit_test
51
52if ! ismounted $TESTPOOL/inherit_test; then
53	log_fail "$TESTPOOL/inherit_test is not mounted"
54fi
55if ! ismounted $TESTPOOL/inherit_test/child; then
56	log_fail "$TESTPOOL/inherit_test/child is not mounted"
57fi
58
59log_pass "Verified mountpoint for mountpoint=none children inherited."
60