nvdimm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [ndctl PATCH] ndctl/namespace: Catch attempts to sub-divide legacy / label-less capacity
@ 2020-10-07  2:53 Dan Williams
  0 siblings, 0 replies; only message in thread
From: Dan Williams @ 2020-10-07  2:53 UTC (permalink / raw)
  To: vishal.l.verma; +Cc: Eric Sandeen, linux-nvdimm

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(+)

diff --git a/ndctl/namespace.c b/ndctl/namespace.c
index e734248c9752..e946bb6c9bfa 100644
--- a/ndctl/namespace.c
+++ b/ndctl/namespace.c
@@ -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__);
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-10-07  3:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-07  2:53 [ndctl PATCH] ndctl/namespace: Catch attempts to sub-divide legacy / label-less capacity Dan Williams

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).