diff --git a/usr.sbin/makefs/tests/makefs_zfs_tests.sh b/usr.sbin/makefs/tests/makefs_zfs_tests.sh --- a/usr.sbin/makefs/tests/makefs_zfs_tests.sh +++ b/usr.sbin/makefs/tests/makefs_zfs_tests.sh @@ -654,6 +654,44 @@ common_cleanup } +# +# Create a legacy dataset. +# +atf_test_case multi_dataset_5 cleanup +multi_dataset_5_body() +{ + create_test_dirs + cd $TEST_INPUTS_DIR + + mkdir dir1 + echo a > dir1/a + + cd - + + atf_check $MAKEFS -s 1g -o rootpath=/ -o poolname=$ZFS_POOL_NAME \ + -o fs=${ZFS_POOL_NAME}/dir1\;canmount=noauto\;mountpoint=legacy \ + $TEST_IMAGE $TEST_INPUTS_DIR + + import_image + + atf_check -o inline:legacy\\n \ + zfs list -H -o mountpoint ${ZFS_POOL_NAME}/dir1 + + check_image_contents + + atf_check zfs set mountpoint=/dir1 ${ZFS_POOL_NAME}/dir1 + atf_check zfs mount ${ZFS_POOL_NAME}/dir1 + atf_check -o inline:${TEST_MOUNT_DIR}/dir1\\n \ + zfs list -H -o mountpoint ${ZFS_POOL_NAME}/dir1 + + # dir1/a should be part of the root dataset, not dir1. + atf_check -s not-exit:0 -e not-empty stat ${TEST_MOUNT_DIR}/dir1/a +} +multi_dataset_5_cleanup() +{ + common_cleanup +} + # # Validate handling of multiple staging directories. # @@ -1043,6 +1081,7 @@ atf_add_test_case multi_dataset_2 atf_add_test_case multi_dataset_3 atf_add_test_case multi_dataset_4 + atf_add_test_case multi_dataset_5 atf_add_test_case multi_staging_1 atf_add_test_case multi_staging_2 atf_add_test_case reproducible diff --git a/usr.sbin/makefs/zfs/dsl.c b/usr.sbin/makefs/zfs/dsl.c --- a/usr.sbin/makefs/zfs/dsl.c +++ b/usr.sbin/makefs/zfs/dsl.c @@ -103,7 +103,8 @@ char *mountpoint; if (nvlist_find_string(dir->propsnv, "mountpoint", &mountpoint) == 0) { - if (strcmp(mountpoint, "none") == 0) + if (strcmp(mountpoint, "none") == 0 || + strcmp(mountpoint, "legacy") == 0) return (NULL); } else { /* @@ -165,7 +166,7 @@ errx(1, "property `%s' already set", key); if (strcmp(key, "mountpoint") == 0) { - if (strcmp(val, "none") != 0) { + if (strcmp(val, "none") != 0 && strcmp(val, "legacy") != 0) { if (val[0] != '/') errx(1, "mountpoint `%s' is not absolute", val); if (strcmp(val, zfs->rootpath) != 0 &&