[ndctl,1/2] ndctl/namespace: skip seed namespaces for 'enable-namespace'
diff mbox series

Message ID 20191104230857.28172-1-vishal.l.verma@intel.com
State New
Headers show
Series
  • [ndctl,1/2] ndctl/namespace: skip seed namespaces for 'enable-namespace'
Related show

Commit Message

Verma, Vishal L Nov. 4, 2019, 11:08 p.m. UTC
Performing 'ndctl enable-namespace all' results in ndctl going through a
number of seed namespaces, one per region, and trying to enable them,
which fails as expected. This results in error messages like the
following, which are almost always going to be present, and are almost
always pointless:

  $ sudo ndctl enable-namespace all
  libndctl: ndctl_namespace_enable: namespace3.0: failed to enable
  libndctl: ndctl_namespace_enable: namespace5.0: failed to enable
  error enabling namespaces: No such device or address
  enabled 5 namespaces

Using the new 'ndctl_namespace_is_configuration_idle()' API to determine
whether a given namespace might be a 'seed' namespace, we can avoid
these error messages.

Ad a debug message gated behind the verbose option that prints when a
namespace is skipped when it it detected as a 'seed'.

Link: https://github.com/pmem/ndctl/issues/119
Cc: Dan Williams <dan.j.williams@intel.com>
Reported-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
 ndctl/namespace.c | 5 +++++
 1 file changed, 5 insertions(+)

Patch
diff mbox series

diff --git a/ndctl/namespace.c b/ndctl/namespace.c
index a07d7e2..ed0421b 100644
--- a/ndctl/namespace.c
+++ b/ndctl/namespace.c
@@ -1401,6 +1401,11 @@  static int do_xaction_namespace(const char *namespace,
 						(*processed)++;
 					break;
 				case ACTION_ENABLE:
+					if (ndctl_namespace_is_configuration_idle(ndns)) {
+						debug("%s: skip seed namespace\n",
+							ndctl_namespace_get_devname(ndns));
+						continue;
+					}
 					rc = ndctl_namespace_enable(ndns);
 					if (rc >= 0) {
 						(*processed)++;