]> git.proxmox.com Git - mirror_zfs.git/commit
ddt: ensure ddt objects exist before trying to get stats from them
authorRob Norris <rob.norris@klarasystems.com>
Thu, 15 Jun 2023 06:10:00 +0000 (16:10 +1000)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 15 Feb 2024 19:45:33 +0000 (11:45 -0800)
commit5ee0f9c64946fca90026c0d7092326755d75c2d7
tree220ea145b8f13d4633faf5aea00e69475c2fc5a1
parent3bad70040a7b8437ac587d249895e723594c16cf
ddt: ensure ddt objects exist before trying to get stats from them

ddt_get_dedup_histogram() was actually checking it, just in an extremely
cursed way. ddt_get_dedup_object_stats() wasn't, but wasn't being called
from a dangerous place so no one noticed.

These checks are necessary, because spa_ddt[] is not populated until
spa_load(), but the spa can exist before that, while being created, and
as vdevs and metaslabs are initialised the space accounting functions
will be called to update pool space counts.

Probably the whole create path doesn't need to go asking for space
accounting from metadata subsystems until after the pool is created.
This will at least catch misuse.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
Sponsored-by: Klara, Inc.
Sponsored-by: iXsystems, Inc.
Closes #15887
module/zfs/ddt_stats.c