From 741db5a3466236620612772319c3401171d3f2b6 Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Tue, 4 Feb 2020 11:49:12 -0500 Subject: 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 Reviewed-by: Brian Behlendorf Reviewed-by: Ryan Moeller Signed-off-by: Alexander Motin Sponsored-By: iXsystems, Inc. Closes #9933 --- module/os/linux/zfs/abd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'module/os/linux') 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); } } -- cgit v1.2.3