Skip to contentSkip to conversation

ndctl: Avoid confusing error message when operating on all the namespaces

PATCH In review Aneesh Kumar K.V 3 participants 6 messages Jul 8, 2021 – Sep 13, 2021 libnvdimm: non-volatile memory device

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ndctl: Avoid confusing error message when operating on all the namespaces

With only seed namespace present, ndctl results in confusing error messages as below.

ndctl# ./ndctl/ndctl enable-namespace all error enabling namespaces: No such device or address enabled 0 namespaces

ndctl# ./ndctl/ndctl disable-namespace all
disabled 3 namespaces

ndctl# ./ndctl/ndctl destroy-namespace all -f
Error: destroy namespace: namespace1.0 failed to enable for zeroing, continuing

Error: destroy namespace: namespace1.1 failed to enable for zeroing, continuing

Error: destroy namespace: namespace0.0 failed to enable for zeroing, continuing

destroyed 0 namespaces
ndctl#

With the patch we get
ndctl# ./ndctl/ndctl disable-namespace all
disabled 0 namespaces

ndctl# ./ndctl/ndctl enable-namespace all
enabled 0 namespaces

ndctl# ./ndctl/ndctl destroy-namespace all -f
destroyed 0 namespaces
ndctl#

---
 ndctl/namespace.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
ndctl/namespace.c +8 -1
index 0c8df9fa8b47..c52daeae562a 100644
@@ -2205,8 +2205,15 @@ static int do_xaction_namespace(const char *namespace,
 				return rc;
 			}
 			ndctl_namespace_foreach_safe(region, ndns, _n) {
-				ndns_name = ndctl_namespace_get_devname(ndns);
 
+				if (!strcmp(namespace, "all")
+						&& !ndctl_namespace_get_size(ndns)) {
+					if (!*processed && rc)
+						rc  = 0;
+					continue;
+				}
+
+				ndns_name = ndctl_namespace_get_devname(ndns);
 				if (strcmp(namespace, "all") != 0
 						&& strcmp(namespace, ndns_name) != 0)
 					continue;
Signature · 1 line
2.31.1
#1 lore raw

Jeff had posted one patch to fix similar issue
https://lore.kernel.org/linux-nvdimm/[email protected]/T/#u

Hi Dan/Visha
Could we make some progress on this issue?

Quoted 62 lines · Aneesh Kumar K.V

With only seed namespace present, ndctl results in confusing error messages as below.

ndctl# ./ndctl/ndctl enable-namespace all error enabling namespaces: No such device or address enabled 0 namespaces

ndctl# ./ndctl/ndctl disable-namespace all
disabled 3 namespaces

ndctl# ./ndctl/ndctl destroy-namespace all -f
Error: destroy namespace: namespace1.0 failed to enable for zeroing, continuing

Error: destroy namespace: namespace1.1 failed to enable for zeroing, continuing

Error: destroy namespace: namespace0.0 failed to enable for zeroing, continuing

destroyed 0 namespaces
ndctl#

With the patch we get
ndctl# ./ndctl/ndctl disable-namespace all
disabled 0 namespaces

ndctl# ./ndctl/ndctl enable-namespace all
enabled 0 namespaces

ndctl# ./ndctl/ndctl destroy-namespace all -f
destroyed 0 namespaces
ndctl#

---
 ndctl/namespace.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
ndctl/namespace.c +8 -2
index 0c8df9fa8b47..c52daeae562a 100644
@@ -2205,8 +2205,15 @@ static int do_xaction_namespace(const char *namespace,
                                return rc;
                        }
                        ndctl_namespace_foreach_safe(region, ndns, _n) {
-                               ndns_name = ndctl_namespace_get_devname(ndns);
 
+                               if (!strcmp(namespace, "all")
+                                               && !ndctl_namespace_get_size(ndns)) {
+                                       if (!*processed && rc)
+                                               rc  = 0;
+                                       continue;
+                               }
+
+                               ndns_name = ndctl_namespace_get_devname(ndns);
                                if (strcmp(namespace, "all") != 0
                                                && strcmp(namespace, ndns_name) != 0)
                                        continue;
--

2.31.1

Signature · 2 lines
Best Regards,
  Yi Zhang
#2 lore raw
Quoted 3 lines · Yi Zhang

Jeff had posted one patch to fix similar issue
https://lore.kernel.org/linux-nvdimm/[email protected]/T/#u

I missed that patch. I am wondering whether that would result in ndctl not reporting error when we use the seed namespace name directly with destroy-namespace command

Quoted 70 lines

Hi Dan/Visha
Could we make some progress on this issue?

Quoted 62 lines · Aneesh Kumar K.V

With only seed namespace present, ndctl results in confusing error messages as below.

ndctl# ./ndctl/ndctl enable-namespace all error enabling namespaces: No such device or address enabled 0 namespaces

ndctl# ./ndctl/ndctl disable-namespace all
disabled 3 namespaces

ndctl# ./ndctl/ndctl destroy-namespace all -f
Error: destroy namespace: namespace1.0 failed to enable for zeroing, continuing

Error: destroy namespace: namespace1.1 failed to enable for zeroing, continuing

Error: destroy namespace: namespace0.0 failed to enable for zeroing, continuing

destroyed 0 namespaces
ndctl#

With the patch we get
ndctl# ./ndctl/ndctl disable-namespace all
disabled 0 namespaces

ndctl# ./ndctl/ndctl enable-namespace all
enabled 0 namespaces

ndctl# ./ndctl/ndctl destroy-namespace all -f
destroyed 0 namespaces
ndctl#

---
  ndctl/namespace.c | 9 ++++++++-
  1 file changed, 8 insertions(+), 1 deletion(-)
ndctl/namespace.c +8 -2
index 0c8df9fa8b47..c52daeae562a 100644
@@ -2205,8 +2205,15 @@ static int do_xaction_namespace(const char *namespace,
                                 return rc;
                         }
                         ndctl_namespace_foreach_safe(region, ndns, _n) {
-                               ndns_name = ndctl_namespace_get_devname(ndns);
 
+                               if (!strcmp(namespace, "all")
+                                               && !ndctl_namespace_get_size(ndns)) {
+                                       if (!*processed && rc)
+                                               rc  = 0;
+                                       continue;
+                               }
+
+                               ndns_name = ndctl_namespace_get_devname(ndns);
                                 if (strcmp(namespace, "all") != 0
                                                 && strcmp(namespace, ndns_name) != 0)
                                         continue;
--

2.31.1

#4 lore raw
Quoted 12 lines · Dan Williams
Quoted 6 lines · Yi Zhang

Jeff had posted one patch to fix similar issue
https://lore.kernel.org/linux-nvdimm/[email protected]/T/#u

Hi Dan/Visha
Could we make some progress on this issue?

Apologies, we had some internal administrivia to address, but are getting back to regular releases now and catching up on the backlog.

No worries, thanks for the update :)

Signature · 2 lines
Best Regards,
  Yi Zhang
#5 lore raw
In reply to Dan Williams
Quoted 10 lines · Dan Williams
Quoted 6 lines · Yi Zhang

Jeff had posted one patch to fix similar issue
https://lore.kernel.org/linux-nvdimm/[email protected]/T/#u

Hi Dan/Visha
Could we make some progress on this issue?

Apologies, we had some internal administrivia to address, but are getting back to regular releases now and catching up on the backlog.

Any update on this patch? Without this I get failures with
https://github.com/avocado-framework-tests/avocado-misc-tests/blob/master/memory/ndctl.py
because the return status is 1 for disable-namespace command with only seed namespace.

-aneesh