[ndctl,v2,2/2] ndctl/namespace: fix reported count for disable-namespace
diff mbox series

Message ID 20191105172713.3628-2-vishal.l.verma@intel.com
State New
Headers show
Series
  • Untitled series #198245
Related show

Commit Message

Verma, Vishal L Nov. 5, 2019, 5:27 p.m. UTC
Make the count reported disable-namespace consistent with
enable-namespace by skipping namespaces that were already disabled.

Cc: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
 ndctl/namespace.c | 4 ++++
 1 file changed, 4 insertions(+)

Patch
diff mbox series

diff --git a/ndctl/namespace.c b/ndctl/namespace.c
index f2987ca..57998ce 100644
--- a/ndctl/namespace.c
+++ b/ndctl/namespace.c
@@ -1426,6 +1426,10 @@  static int do_xaction_namespace(const char *namespace,
 					continue;
 				switch (action) {
 				case ACTION_DISABLE:
+					if (!ndctl_namespace_is_enabled(ndns)) {
+						rc = 0;
+						continue;
+					}
 					rc = ndctl_namespace_disable_safe(ndns);
 					if (rc == 0)
 						(*processed)++;