1#!/bin/ksh -p
2# SPDX-License-Identifier: CDDL-1.0
3#
4# CDDL HEADER START
5#
6# This file and its contents are supplied under the terms of the
7# Common Development and Distribution License ("CDDL"), version 1.0.
8# You may only use this file in accordance with the terms of version
9# 1.0 of the CDDL.
10#
11# A full copy of the text of the CDDL should have accompanied this
12# source.  A copy is of the CDDL is also available via the Internet
13# at http://www.illumos.org/license/CDDL.
14#
15# CDDL HEADER END
16#
17
18#
19# Copyright (c) 2018 Datto Inc.
20#
21
22. $STF_SUITE/include/libtest.shlib
23
24#
25# DESCRIPTION:
26#	zfs inherit should inherit mountpoint on mountpoint=none children
27#
28# STRATEGY:
29#	1. Create a set of nested datasets with mountpoint=none
30#	2. Verify datasets aren't mounted
31#	3. Inherit mountpoint and verify all datasets are now mounted
32#
33
34verify_runnable "both"
35
36function inherit_cleanup
37{
38	log_must zfs destroy -fR $TESTPOOL/inherit_test
39}
40
41log_onexit inherit_cleanup
42
43
44log_must zfs create -o mountpoint=none $TESTPOOL/inherit_test
45log_must zfs create $TESTPOOL/inherit_test/child
46
47if ismounted $TESTPOOL/inherit_test; then
48	log_fail "$TESTPOOL/inherit_test is mounted"
49fi
50if ismounted $TESTPOOL/inherit_test/child; then
51	log_fail "$TESTPOOL/inherit_test/child is mounted"
52fi
53
54log_must zfs inherit mountpoint $TESTPOOL/inherit_test
55
56if ! ismounted $TESTPOOL/inherit_test; then
57	log_fail "$TESTPOOL/inherit_test is not mounted"
58fi
59if ! ismounted $TESTPOOL/inherit_test/child; then
60	log_fail "$TESTPOOL/inherit_test/child is not mounted"
61fi
62
63log_pass "Verified mountpoint for mountpoint=none children inherited."
64