Fix changelist mounted-dataset iteration

Commit 0c6d093 caused a regression in the inherit codepath.
The fix is to restrict the changelist iteration on mountpoints and
add proper handling for 'legacy' mountpoints

Reviewed by: Serapheim Dimitropoulos <serapheim.dimitro@delphix.com>
Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alek Pinchuk <apinchuk@datto.com>
Closes #7988 
Closes #7991
This commit is contained in:
Alek P
2018-10-11 00:13:13 -04:00
committed by Brian Behlendorf
parent 5b3bfd86a4
commit 50a343d85c
9 changed files with 201 additions and 28 deletions
+3 -2
View File
@@ -166,7 +166,8 @@ tests = ['zfs_get_001_pos', 'zfs_get_002_pos', 'zfs_get_003_pos',
tags = ['functional', 'cli_root', 'zfs_get']
[tests/functional/cli_root/zfs_inherit]
tests = ['zfs_inherit_001_neg', 'zfs_inherit_002_neg', 'zfs_inherit_003_pos']
tests = ['zfs_inherit_001_neg', 'zfs_inherit_002_neg', 'zfs_inherit_003_pos',
'zfs_inherit_mountpoint']
tags = ['functional', 'cli_root', 'zfs_inherit']
[tests/functional/cli_root/zfs_load-key]
@@ -218,7 +219,7 @@ tests = ['zfs_rename_001_pos', 'zfs_rename_002_pos', 'zfs_rename_003_pos',
'zfs_rename_007_pos', 'zfs_rename_008_pos', 'zfs_rename_009_neg',
'zfs_rename_010_neg', 'zfs_rename_011_pos', 'zfs_rename_012_neg',
'zfs_rename_013_pos', 'zfs_rename_014_neg', 'zfs_rename_encrypted_child',
'zfs_rename_to_encrypted']
'zfs_rename_to_encrypted', 'zfs_rename_mountpoint']
tags = ['functional', 'cli_root', 'zfs_rename']
[tests/functional/cli_root/zfs_reservation]
@@ -4,4 +4,5 @@ dist_pkgdata_SCRIPTS = \
setup.ksh \
zfs_inherit_001_neg.ksh \
zfs_inherit_002_neg.ksh \
zfs_inherit_003_pos.ksh
zfs_inherit_003_pos.ksh \
zfs_inherit_mountpoint.ksh
@@ -0,0 +1,62 @@
#!/bin/ksh -p
#
# CDDL HEADER START
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy is of the CDDL is also available via the Internet
# at http://www.illumos.org/license/CDDL.
#
# CDDL HEADER END
#
#
# Copyright (c) 2018 Datto Inc.
#
. $STF_SUITE/include/libtest.shlib
#
# DESCRIPTION:
# zfs inherit should inherit mountpoint on mountpoint=none children
#
# STRATEGY:
# 1. Create a set of nested datasets with mountpoint=none
# 2. Verify datasets aren't mounted
# 3. Inherit mountpoint and verify all datasets are now mounted
#
verify_runnable "both"
function inherit_cleanup
{
log_must zfs destroy -fR $TESTPOOL/inherit_test
}
log_onexit inherit_cleanup
log_must zfs create -o mountpoint=none $TESTPOOL/inherit_test
log_must zfs create $TESTPOOL/inherit_test/child
if ismounted $TESTPOOL/inherit_test; then
log_fail "$TESTPOOL/inherit_test is mounted"
fi
if ismounted $TESTPOOL/inherit_test/child; then
log_fail "$TESTPOOL/inherit_test/child is mounted"
fi
log_must zfs inherit mountpoint $TESTPOOL/inherit_test
if ! ismounted $TESTPOOL/inherit_test; then
log_fail "$TESTPOOL/inherit_test is not mounted"
fi
if ! ismounted $TESTPOOL/inherit_test/child; then
log_fail "$TESTPOOL/inherit_test/child is not mounted"
fi
log_pass "Verified mountpoint for mountpoint=none children inherited."
@@ -17,7 +17,8 @@ dist_pkgdata_SCRIPTS = \
zfs_rename_013_pos.ksh \
zfs_rename_014_neg.ksh \
zfs_rename_encrypted_child.ksh \
zfs_rename_to_encrypted.ksh
zfs_rename_to_encrypted.ksh \
zfs_rename_mountpoint.ksh
dist_pkgdata_DATA = \
zfs_rename.cfg \
@@ -0,0 +1,88 @@
#!/bin/ksh -p
#
# CDDL HEADER START
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy is of the CDDL is also available via the Internet
# at http://www.illumos.org/license/CDDL.
#
# CDDL HEADER END
#
#
# Copyright (c) 2018 Datto Inc.
#
. $STF_SUITE/include/libtest.shlib
#
# DESCRIPTION:
# zfs rename should rename datasets even for mountpoint=none children
#
# STRATEGY:
# 1. Create a set of nested datasets with mountpoint=none
# 2. Verify datasets aren't mounted except for the parent
# 3. Rename mountpoint and verify all child datasets are renamed
#
verify_runnable "both"
function rename_cleanup
{
log_note zfs destroy -fR $TESTPOOL/rename_test
log_note zfs destroy -fR $TESTPOOL/renamed
}
log_onexit rename_cleanup
log_must zfs create $TESTPOOL/rename_test
log_must zfs create $TESTPOOL/rename_test/ds
log_must zfs create -o mountpoint=none $TESTPOOL/rename_test/child
log_must zfs create $TESTPOOL/rename_test/child/grandchild
if ! ismounted $TESTPOOL/rename_test; then
log_fail "$TESTPOOL/rename_test is not mounted"
fi
if ! ismounted $TESTPOOL/rename_test/ds; then
log_fail "$TESTPOOL/rename_test/ds is not mounted"
fi
if ismounted $TESTPOOL/rename_test/child; then
log_fail "$TESTPOOL/rename_test/child is mounted"
fi
if ismounted $TESTPOOL/rename_test/child/grandchild; then
log_fail "$TESTPOOL/rename_test/child/grandchild is mounted"
fi
log_must zfs rename $TESTPOOL/rename_test $TESTPOOL/renamed
log_mustnot zfs list $TESTPOOL/rename_test
log_mustnot zfs list $TESTPOOL/rename_test/ds
log_mustnot zfs list $TESTPOOL/rename_test/child
log_mustnot zfs list $TESTPOOL/rename_test/child/grandchild
log_must zfs list $TESTPOOL/renamed
log_must zfs list $TESTPOOL/renamed/ds
log_must zfs list $TESTPOOL/renamed/child
log_must zfs list $TESTPOOL/renamed/child/grandchild
if ! ismounted $TESTPOOL/renamed; then
log_must zfs get all $TESTPOOL/renamed
log_fail "$TESTPOOL/renamed is not mounted"
fi
if ! ismounted $TESTPOOL/renamed/ds; then
log_fail "$TESTPOOL/renamed/ds is not mounted"
fi
if ismounted $TESTPOOL/renamed/child; then
log_fail "$TESTPOOL/renamed/child is mounted"
fi
if ismounted $TESTPOOL/renamed/child/grandchild; then
log_fail "$TESTPOOL/renamed/child/grandchild is mounted"
fi
log_pass "Verified rename for mountpoint=none children."