diff options
author | Chunwei Chen <[email protected]> | 2016-12-09 10:52:08 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2016-12-09 11:52:08 -0700 |
commit | a806cb6a89589d4e1e57a01161b4ce0e2d53523a (patch) | |
tree | d8b484da115493b5f12c72e8c50e70933f3e5de9 /module | |
parent | c077090a9b11d42c0734f0741ca08d0c9b6b37b0 (diff) |
Don't count '@' for dataset namelen if not a snapshot
Don't count '@' for dataset namelen if not a snapshot. This
fixes making a pool unimportable when the dataset namelen
is 255.
Add test file for zfs create name length 255.
Reviewed-by: Giuseppe Di Natale <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Chunwei Chen <[email protected]>
Closes #5432
Closes #5456
Diffstat (limited to 'module')
-rw-r--r-- | module/zfs/dsl_dataset.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/module/zfs/dsl_dataset.c b/module/zfs/dsl_dataset.c index 9362d49bd..f2c40a3c4 100644 --- a/module/zfs/dsl_dataset.c +++ b/module/zfs/dsl_dataset.c @@ -705,7 +705,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); } |