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 <dinatale2@llnl.gov> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Chunwei Chen <david.chen@osnexus.com> Closes #5432 Closes #5456
This commit is contained in:
parent
625ee0a5e0
commit
f3da7a1b40
|
@ -671,7 +671,11 @@ dsl_dataset_namelen(dsl_dataset_t *ds)
|
||||||
int len;
|
int len;
|
||||||
VERIFY0(dsl_dataset_get_snapname(ds));
|
VERIFY0(dsl_dataset_get_snapname(ds));
|
||||||
mutex_enter(&ds->ds_lock);
|
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);
|
mutex_exit(&ds->ds_lock);
|
||||||
return (len);
|
return (len);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue