zfsonlinux/spl-patches/0002-Allow-longer-SPA-names-in-stats.patch
Fabian Grünbichler edf5051c71 update SPL to 0.7.7
by importing the upstream release as patches.
2018-04-03 14:27:05 +02:00

71 lines
1.9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: gaurkuma <gaurkuma@users.noreply.github.com>
Date: Fri, 11 Aug 2017 08:53:35 -0700
Subject: [PATCH] Allow longer SPA names in stats
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Signed-off-by: gaurkuma <gauravk.18@gmail.com>
Closes #641
(cherry picked from commit cbf0dff3d8a13c2b4e547321ff2005055521e5ee)
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
include/sys/kstat.h | 2 +-
module/spl/spl-kstat.c | 13 +++++++++----
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/include/sys/kstat.h b/include/sys/kstat.h
index faf6b81..7862ab0 100644
--- a/include/sys/kstat.h
+++ b/include/sys/kstat.h
@@ -32,7 +32,7 @@
#include <sys/kmem.h>
#include <sys/mutex.h>
-#define KSTAT_STRLEN 31
+#define KSTAT_STRLEN 255
#define KSTAT_RAW_MAX (128*1024)
/* For reference valid classes are:
diff --git a/module/spl/spl-kstat.c b/module/spl/spl-kstat.c
index e306915..ed52653 100644
--- a/module/spl/spl-kstat.c
+++ b/module/spl/spl-kstat.c
@@ -614,21 +614,26 @@ kstat_detect_collision(kstat_t *ksp)
{
kstat_module_t *module;
kstat_t *tmp;
- char parent[KSTAT_STRLEN+1];
+ char *parent;
char *cp;
- (void) strlcpy(parent, ksp->ks_module, sizeof(parent));
+ parent = kmem_asprintf("%s", ksp->ks_module);
- if ((cp = strrchr(parent, '/')) == NULL)
+ if ((cp = strrchr(parent, '/')) == NULL) {
+ strfree(parent);
return (0);
+ }
cp[0] = '\0';
if ((module = kstat_find_module(parent)) != NULL) {
list_for_each_entry(tmp, &module->ksm_kstat_list, ks_list)
- if (strncmp(tmp->ks_name, cp+1, KSTAT_STRLEN) == 0)
+ if (strncmp(tmp->ks_name, cp+1, KSTAT_STRLEN) == 0) {
+ strfree(parent);
return (EEXIST);
+ }
}
+ strfree(parent);
return (0);
}
--
2.14.2