'ndctl enable-namespace all' tries to enable seed namespaces too, which results
in a error like

libndctl: ndctl_namespace_enable: namespace1.0: failed to enable

Signed-off-by: Santosh Sivaraj <[email protected]>
---
 ndctl/lib/libndctl.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c
index 6596f94..9c6ccb8 100644
--- a/ndctl/lib/libndctl.c
+++ b/ndctl/lib/libndctl.c
@@ -4010,11 +4010,16 @@ NDCTL_EXPORT int ndctl_namespace_enable(struct 
ndctl_namespace *ndns)
        const char *devname = ndctl_namespace_get_devname(ndns);
        struct ndctl_ctx *ctx = ndctl_namespace_get_ctx(ndns);
        struct ndctl_region *region = ndns->region;
+       unsigned long long size = ndctl_namespace_get_size(ndns);
        int rc;
 
        if (ndctl_namespace_is_enabled(ndns))
                return 0;
 
+       /* Don't try to enable idle namespace (no capacity allocated) */
+       if (size == 0)
+               return -ENXIO;
+
        rc = ndctl_bind(ctx, ndns->module, devname);
 
        /*
-- 
2.24.1
_______________________________________________
Linux-nvdimm mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to