FreeBSD exports statistics about pools and datasets via sysctl, in a tree rooted at "kstat.zfs.<pool_name>". One problem: "." is a legal character in pool names but it's the separator for sysctl trees. When a pool has "." in the name its stats will still be exported and they can be viewed by iterating through all of "kstat.zfs". However, they won't be addressable by pool, and interpreting the output of "kstat.zfs" is difficult. For example:
# I have a pool named "foo.bar"
$ zpool list
NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
foo.bar 9.50G 720K 9.50G - - 0% 0% 1.00x ONLINE -
testpool 9.50G 1.45M 9.50G - - 0% 0% 1.00x ONLINE -
# Its statistics are exported
$ sysctl kstat.zfs | grep foo.bar.dataset
# But they aren't individually addressable
$ sysctl kstat.zfs.foo.bar
sysctl: unknown oid 'kstat.zfs.foo.bar'
$ sysctl kstat.zfs.foo
sysctl: unknown oid 'kstat.zfs.foo'
I think a proper solution would involve some kind of escaping of the "." character in the name.
A commit in branch main references this bug:
Author: Alan Somers <asomers@FreeBSD.org>
AuthorDate: 2021-07-21 21:11:00 +0000
Commit: Alan Somers <asomers@FreeBSD.org>
CommitDate: 2021-07-22 16:22:48 +0000
Escape any '.' characters in sysctl node names
ZFS creates some sysctl nodes that include a pool name, and '.' is an
allowed character in pool names. But it's the separator in the sysctl
tree, so it can't be included in a sysctl name. Replace it with "%25".
Handily, "%" is illegal in ZFS pool names, so there's no ambiguity
MFC after: 3 weeks
Sponsored by: Axcient
Reviewed by: freqlabs
Differential Revision: https://reviews.freebsd.org/D31265
sys/kern/kern_sysctl.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 46 insertions(+), 2 deletions(-)