@@ -684,6 +684,17 @@ static int validate_namespace_options(struct ndctl_region *region,
return rc;
}
+ /*
+ * Block attempts to set a custom size on legacy (label-less)
+ * namespaces
+ */
+ if (ndctl_region_get_nstype(region) == ND_DEVICE_NAMESPACE_IO
+ && p->size != ndctl_region_get_size(region)) {
+ error("Legacy / label-less namespaces do not support sub-dividing a region\n");
+ error("Retry without -s/--size=\n");
+ return -EINVAL;
+ }
+
if (param.uuid) {
if (uuid_parse(param.uuid, p->uuid) != 0) {
err("%s: invalid uuid\n", __func__);
Fail attempts to specify a size smaller than the host region to 'create-namespace' when labels are not available. Otherwise ndctl confusingly succeeds and reports that the namespace is still statically sized to the region: Example before: # ndctl create-namespace -s 32g "size":"63.00 GiB (67.64 GB)", Example after: # ndctl create-namespace -e namespace0.0 -s 2G -f Error: Legacy / label-less namespaces do not support sub-dividing a region retry without -s/--size= failed to reconfigure namespace: Invalid argument The memmap= parameter while useful, does not emulate many of the provisioning flows of real persistent memory devices. The set of useful namespace configuration that can be performed on top of memmap= defined region+namespace is reconfiguring the namespace between operation modes: create-namespace -e namespace0.0 -f -m {devdax,fsdax,sector} Link: https://github.com/pmem/ndctl/issues/150 Reported-by: Eric Sandeen <esandeen@redhat.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com> --- ndctl/namespace.c | 11 +++++++++++ 1 file changed, 11 insertions(+)