summaryrefslogtreecommitdiffstats
path: root/module/os
diff options
context:
space:
mode:
authorAlexander Motin <[email protected]>2020-02-04 11:49:12 -0500
committerGitHub <[email protected]>2020-02-04 08:49:12 -0800
commit741db5a3466236620612772319c3401171d3f2b6 (patch)
treea2e1b4bb693457a94ae45e87f29301eaf4210657 /module/os
parent52c487a0e4432269b0b0ddc034155a8cf62e0299 (diff)
Prepare ks_data before calling kstat_install()
It violated sequence described in kstat.h, and at least on FreeBSD kstat_install() uses provided names to create the sysctls. If the names are not available at the time, it ends up bad. Reviewed-by: Igor Kozhukhov <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: Alexander Motin <[email protected]> Sponsored-By: iXsystems, Inc. Closes #9933
Diffstat (limited to 'module/os')
-rw-r--r--module/os/linux/zfs/abd.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/module/os/linux/zfs/abd.c b/module/os/linux/zfs/abd.c
index 40d73de0a..bc6f81000 100644
--- a/module/os/linux/zfs/abd.c
+++ b/module/os/linux/zfs/abd.c
@@ -573,15 +573,14 @@ abd_init(void)
abd_ksp = kstat_create("zfs", 0, "abdstats", "misc", KSTAT_TYPE_NAMED,
sizeof (abd_stats) / sizeof (kstat_named_t), KSTAT_FLAG_VIRTUAL);
if (abd_ksp != NULL) {
- abd_ksp->ks_data = &abd_stats;
- kstat_install(abd_ksp);
-
for (i = 0; i < MAX_ORDER; i++) {
snprintf(abd_stats.abdstat_scatter_orders[i].name,
KSTAT_STRLEN, "scatter_order_%d", i);
abd_stats.abdstat_scatter_orders[i].data_type =
KSTAT_DATA_UINT64;
}
+ abd_ksp->ks_data = &abd_stats;
+ kstat_install(abd_ksp);
}
}