Skip to content

Conversation

@delan
Copy link
Contributor

@delan delan commented Jan 7, 2026

Motivation and Context

zpool create is 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 with zpool create -t, no such record is ever logged (#18102). that bug may be the cause of issues like #16408.

Description

zpool create -t (83e9986) and zpool import -t (26b42f3) are both designed to override the on-disk zpool property name with 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_NAME in ZFS_IOC_POOL_IMPORT, which tells spa_write_cachefile() and spa_config_generate() to use the ZPOOL_CONFIG_POOL_NAME in spa->spa_config instead of spa->spa_name.

creating with a temporary name permanently(!) sets the internal zpool property tname (ZPOOL_PROP_TNAME) in the zc->zc_nvlist_src of ZFS_IOC_POOL_CREATE, which tells zfs_ioc_pool_create() (4ceb8dd) and spa_create() to use that name instead of zc->zc_name, then sets spa->spa_import_flags |= ZFS_IMPORT_TEMP_NAME like an import.

but zfsdev_ioctl_common() fails to check for tname when saving the pool name to zfs_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 tname in zfsdev_ioctl_common() like we do in zfs_ioc_pool_create().

How Has This Been Tested?

tested using quiz, on linux 6.12.44:

$ ./quiz -k 6.12.44 -p zfs,ztest /usr/local/share/zfs/zfs-tests.sh -t tests/functional/cli_root/zpool_create/zpool_create_tempname.ksh
$ ./quiz -k 6.12.44 -p memdev,zfs /usr/local/zfs-18102-repro.sh

zfs-18102-repro.sh:

#!/bin/sh
set -euvx
zpool create -t test2 test /dev/quizm0
zpool history test2

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Quality assurance (non-breaking change which makes the code more robust against bugs)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

@delan delan force-pushed the fix-18102 branch 2 times, most recently from 2c8a8d0 to c92d4b5 Compare January 7, 2026 10:52
`zpool create` is 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 with `zpool create -t`, no such record is ever
logged (openzfs#18102). that bug may be the cause of issues like openzfs#16408.

`zpool create -t` (83e9986) and `zpool
import -t` (26b42f3) are both designed
to override the on-disk zpool property `name` with 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_NAME` in ZFS_IOC_POOL_IMPORT, which tells
spa_write_cachefile() and spa_config_generate() to use the
ZPOOL_CONFIG_POOL_NAME in `spa->spa_config` instead of `spa->spa_name`.

creating with a temporary name permanently(!) sets the internal zpool
property `tname` (ZPOOL_PROP_TNAME) in the `zc->zc_nvlist_src` of
ZFS_IOC_POOL_CREATE, which tells zfs_ioc_pool_create()
(4ceb8dd) and spa_create() to use that
name instead of `zc->zc_name`, then sets `spa->spa_import_flags |=
ZFS_IMPORT_TEMP_NAME` like an import.

but zfsdev_ioctl_common() fails to check for `tname` when saving the
pool name to `zfs_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 openzfs#18102 by checking for `tname` in zfsdev_ioctl_common()
like we do in zfs_ioc_pool_create().

Signed-off-by: delan azabani <[email protected]>
@delan delan requested a review from amotin January 9, 2026 02:21
@amotin amotin added the Status: Code Review Needed Ready for review and testing label Jan 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Code Review Needed Ready for review and testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

zpool create -t fails to emit zpool history entry for create command

3 participants