[Bug 257316] kstat.zfs sysctl tree unreachable for pools with "." in the name

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 21 Jul 2021 17:42:39 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=257316

            Bug ID: 257316
           Summary: kstat.zfs sysctl tree unreachable for pools with "."
                    in the name
           Product: Base System
           Version: 13.0-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: asomers@FreeBSD.org

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
kstat.zfs.foo.bar.dataset.objset-0x36.nunlinked: 0
kstat.zfs.foo.bar.dataset.objset-0x36.nunlinks: 0
kstat.zfs.foo.bar.dataset.objset-0x36.nread: 0
kstat.zfs.foo.bar.dataset.objset-0x36.reads: 0
kstat.zfs.foo.bar.dataset.objset-0x36.nwritten: 0
kstat.zfs.foo.bar.dataset.objset-0x36.writes: 0
kstat.zfs.foo.bar.dataset.objset-0x36.dataset_name: foo.bar

# 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.

-- 
You are receiving this mail because:
You are the assignee for the bug.