]> git.proxmox.com Git - zfsonlinux.git/blob - spl-patches/0002-Allow-longer-SPA-names-in-stats.patch
update SPL to 0.7.7
[zfsonlinux.git] / spl-patches / 0002-Allow-longer-SPA-names-in-stats.patch
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: gaurkuma <gaurkuma@users.noreply.github.com>
3 Date: Fri, 11 Aug 2017 08:53:35 -0700
4 Subject: [PATCH] Allow longer SPA names in stats
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
10 Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
11 Signed-off-by: gaurkuma <gauravk.18@gmail.com>
12 Closes #641
13 (cherry picked from commit cbf0dff3d8a13c2b4e547321ff2005055521e5ee)
14 Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
15 ---
16 include/sys/kstat.h | 2 +-
17 module/spl/spl-kstat.c | 13 +++++++++----
18 2 files changed, 10 insertions(+), 5 deletions(-)
19
20 diff --git a/include/sys/kstat.h b/include/sys/kstat.h
21 index faf6b81..7862ab0 100644
22 --- a/include/sys/kstat.h
23 +++ b/include/sys/kstat.h
24 @@ -32,7 +32,7 @@
25 #include <sys/kmem.h>
26 #include <sys/mutex.h>
27
28 -#define KSTAT_STRLEN 31
29 +#define KSTAT_STRLEN 255
30 #define KSTAT_RAW_MAX (128*1024)
31
32 /* For reference valid classes are:
33 diff --git a/module/spl/spl-kstat.c b/module/spl/spl-kstat.c
34 index e306915..ed52653 100644
35 --- a/module/spl/spl-kstat.c
36 +++ b/module/spl/spl-kstat.c
37 @@ -614,21 +614,26 @@ kstat_detect_collision(kstat_t *ksp)
38 {
39 kstat_module_t *module;
40 kstat_t *tmp;
41 - char parent[KSTAT_STRLEN+1];
42 + char *parent;
43 char *cp;
44
45 - (void) strlcpy(parent, ksp->ks_module, sizeof(parent));
46 + parent = kmem_asprintf("%s", ksp->ks_module);
47
48 - if ((cp = strrchr(parent, '/')) == NULL)
49 + if ((cp = strrchr(parent, '/')) == NULL) {
50 + strfree(parent);
51 return (0);
52 + }
53
54 cp[0] = '\0';
55 if ((module = kstat_find_module(parent)) != NULL) {
56 list_for_each_entry(tmp, &module->ksm_kstat_list, ks_list)
57 - if (strncmp(tmp->ks_name, cp+1, KSTAT_STRLEN) == 0)
58 + if (strncmp(tmp->ks_name, cp+1, KSTAT_STRLEN) == 0) {
59 + strfree(parent);
60 return (EEXIST);
61 + }
62 }
63
64 + strfree(parent);
65 return (0);
66 }
67
68 --
69 2.14.2
70