Fix history logging for zpool create -t
#18118
Open
+10
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation and Context
zpool createis supposed to log the command to the new pool’s history, as a special record that never gets evicted from the ring buffer. but when you create a pool withzpool create -t, no such record is ever logged (#18102). that bug may be the cause of issues like #16408.Description
zpool create -t(83e9986) andzpool import -t(26b42f3) are both designed to override the on-disk zpool propertynamewith an in-core “temporary” name, but they work somewhat differently under the hood.importing with a temporary name sets
spa->spa_import_flags |= ZFS_IMPORT_TEMP_NAMEin ZFS_IOC_POOL_IMPORT, which tells spa_write_cachefile() and spa_config_generate() to use the ZPOOL_CONFIG_POOL_NAME inspa->spa_configinstead ofspa->spa_name.creating with a temporary name permanently(!) sets the internal zpool property
tname(ZPOOL_PROP_TNAME) in thezc->zc_nvlist_srcof ZFS_IOC_POOL_CREATE, which tells zfs_ioc_pool_create() (4ceb8dd) and spa_create() to use that name instead ofzc->zc_name, then setsspa->spa_import_flags |= ZFS_IMPORT_TEMP_NAMElike an import.but zfsdev_ioctl_common() fails to check for
tnamewhen saving the pool name tozfs_allow_log_key, so when we call ZFS_IOC_LOG_HISTORY, we call spa_open() on the wrong pool name and get ENOENT, so the logging silently fails.this patch fixes #18102 by checking for
tnamein zfsdev_ioctl_common() like we do in zfs_ioc_pool_create().How Has This Been Tested?
tested using quiz, on linux 6.12.44:
zfs-18102-repro.sh:
Types of changes
Checklist:
Signed-off-by.