summaryrefslogtreecommitdiffstats
path: root/module/zfs/dsl_dataset.c
diff options
context:
space:
mode:
Diffstat (limited to 'module/zfs/dsl_dataset.c')
-rw-r--r--module/zfs/dsl_dataset.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/module/zfs/dsl_dataset.c b/module/zfs/dsl_dataset.c
index 7124f3d6a..9bbb6fae2 100644
--- a/module/zfs/dsl_dataset.c
+++ b/module/zfs/dsl_dataset.c
@@ -671,7 +671,11 @@ dsl_dataset_namelen(dsl_dataset_t *ds)
int len;
VERIFY0(dsl_dataset_get_snapname(ds));
mutex_enter(&ds->ds_lock);
- len = dsl_dir_namelen(ds->ds_dir) + 1 + strlen(ds->ds_snapname);
+ len = strlen(ds->ds_snapname);
+ /* add '@' if ds is a snap */
+ if (len > 0)
+ len++;
+ len += dsl_dir_namelen(ds->ds_dir);
mutex_exit(&ds->ds_lock);
return (len);
}