diff options
author | gaurkuma <[email protected]> | 2017-08-11 08:53:35 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2017-08-11 08:53:35 -0700 |
commit | 9df9692637aeee416f509c7f39655beb2d35b549 (patch) | |
tree | 9bde9cf767ce488ba74a34b761bbb30958023208 /module | |
parent | bbefaeba2966512080541dac3c10589327686c1a (diff) |
Allow longer SPA names in stats
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Giuseppe Di Natale <[email protected]>
Signed-off-by: gaurkuma <[email protected]>
Closes #641
Diffstat (limited to 'module')
-rw-r--r-- | module/spl/spl-kstat.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/module/spl/spl-kstat.c b/module/spl/spl-kstat.c index 1b6a7df9b..3765f63cb 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); } |