git: a43b61a1ba45 - stable/15 - makefs: Allow "legacy" as a valid ZFS mountpoint
Jose Luis Duran <[email protected]>
| Newsgroups | gmane.os.freebsd.devel.cvs.src,gmane.os.freebsd.devel.stable.scm |
|---|---|
| Message-ID | <[email protected]> |
The branch stable/15 has been updated by jlduran: URL: https://cgit.FreeBSD.org/src/commit/?id=a43b61a1ba453c95018c0cb0042f823863e3ac69 commit a43b61a1ba453c95018c0cb0042f823863e3ac69 Author: Jose Luis Duran <[email protected]> AuthorDate: 2026-08-11 22:34:16 +0000 Commit: Jose Luis Duran <[email protected]> CommitDate: 2026-08-18 00:30:35 +0000 makefs: Allow "legacy" as a valid ZFS mountpoint Allow "legacy" alongside "none" as a valid value for the ZFS mountpoint property, matching zfsprops(7). Reviewed by: imp, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D58781 (cherry picked from commit 59d6422d6f21fd5cf4709ce9fcada54d3925a4f6) --- usr.sbin/makefs/tests/makefs_zfs_tests.sh | 39 +++++++++++++++++++++++++++++++ usr.sbin/makefs/zfs/dsl.c | 5 ++-- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/usr.sbin/makefs/tests/makefs_zfs_tests.sh b/usr.sbin/makefs/tests/makefs_zfs_tests.sh index 0a6e5597499f..5b6c701ca291 100644 --- a/usr.sbin/makefs/tests/makefs_zfs_tests.sh +++ b/usr.sbin/makefs/tests/makefs_zfs_tests.sh @@ -654,6 +654,44 @@ multi_dataset_4_cleanup() 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_init_test_cases() 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 index 7a634272b7d4..8c336131cea0 100644 --- a/usr.sbin/makefs/zfs/dsl.c +++ b/usr.sbin/makefs/zfs/dsl.c @@ -103,7 +103,8 @@ dsl_dir_get_mountpoint(zfs_opt_t *zfs, zfs_dsl_dir_t *dir) 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 @@ dsl_dir_set_prop(zfs_opt_t *zfs, zfs_dsl_dir_t *dir, const char *key, 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 &&