Emit a usable error message when on attempts to place a blk-namespace
into device-dax mode.

Signed-off-by: Dan Williams <[email protected]>
---
 ndctl/builtin-xaction-namespace.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/ndctl/builtin-xaction-namespace.c 
b/ndctl/builtin-xaction-namespace.c
index 8ce7c3e55216..7bf3320473ff 100644
--- a/ndctl/builtin-xaction-namespace.c
+++ b/ndctl/builtin-xaction-namespace.c
@@ -403,9 +403,12 @@ static int validate_namespace_options(struct ndctl_region 
*region,
 
                if (ndns && ndctl_namespace_get_type(ndns)
                                == ND_DEVICE_NAMESPACE_BLK
-                               && p->mode == NDCTL_NS_MODE_MEMORY) {
-                       debug("%s: blk namespace do not support memory mode\n",
-                                       ndctl_namespace_get_devname(ndns));
+                               && (p->mode == NDCTL_NS_MODE_MEMORY
+                                       || p->mode == NDCTL_NS_MODE_DAX)) {
+                       debug("%s: blk namespace do not support %s mode\n",
+                                       ndctl_namespace_get_devname(ndns),
+                                       p->mode == NDCTL_NS_MODE_MEMORY
+                                       ? "memory" : "dax");
                                return -EINVAL;
                }
        } else if (ndns)

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

Reply via email to