|
Bryan Gurney |
bc084d |
ndctl/namespace: Suppress -ENXIO when processing all namespaces.
|
|
Bryan Gurney |
bc084d |
|
|
Bryan Gurney |
bc084d |
BZ:
|
|
Bryan Gurney |
bc084d |
Brew:
|
|
Bryan Gurney |
bc084d |
|
|
Bryan Gurney |
bc084d |
commit 07011a334fd1e4b641cdbfaf5de7500f7bdc941d
|
|
Bryan Gurney |
bc084d |
Author: Michal Suchanek <msuchanek@suse.de>
|
|
Bryan Gurney |
bc084d |
Date: Wed Jan 6 14:17:41 2021 +0100
|
|
Bryan Gurney |
bc084d |
|
|
Bryan Gurney |
bc084d |
ndctl/namespace: Suppress -ENXIO when processing all namespaces.
|
|
Bryan Gurney |
bc084d |
|
|
Bryan Gurney |
bc084d |
When processing all namespaces and no namespaces exist user gets the
|
|
Bryan Gurney |
bc084d |
default -ENXIO. Set default rc to 0 when processing all namespaces.
|
|
Bryan Gurney |
bc084d |
This avoids confusing error message printed in addition to the message
|
|
Bryan Gurney |
bc084d |
saying 0 namespaces were affected.
|
|
Bryan Gurney |
bc084d |
|
|
Bryan Gurney |
bc084d |
Before:
|
|
Bryan Gurney |
bc084d |
|
|
Bryan Gurney |
bc084d |
# ndctl check-namespace all
|
|
Bryan Gurney |
bc084d |
namespace0.0: namespace_check: namespace0.0: check aborted, namespace online
|
|
Bryan Gurney |
bc084d |
error checking namespaces: Device or resource busy
|
|
Bryan Gurney |
bc084d |
checked 0 namespaces
|
|
Bryan Gurney |
bc084d |
# ndctl disable-namespace all
|
|
Bryan Gurney |
bc084d |
disabled 1 namespace
|
|
Bryan Gurney |
bc084d |
# ndctl check-namespace all
|
|
Bryan Gurney |
bc084d |
namespace0.0: namespace_check: Unable to recover any BTT info blocks
|
|
Bryan Gurney |
bc084d |
error checking namespaces: No such device or address
|
|
Bryan Gurney |
bc084d |
checked 0 namespaces
|
|
Bryan Gurney |
bc084d |
# ndctl destroy-namespace all
|
|
Bryan Gurney |
bc084d |
destroyed 1 namespace
|
|
Bryan Gurney |
bc084d |
# ndctl check-namespace all
|
|
Bryan Gurney |
bc084d |
error checking namespaces: No such device or address
|
|
Bryan Gurney |
bc084d |
checked 0 namespaces
|
|
Bryan Gurney |
bc084d |
# ndctl destroy-namespace all
|
|
Bryan Gurney |
bc084d |
error destroying namespaces: No such device or address
|
|
Bryan Gurney |
bc084d |
destroyed 0 namespaces
|
|
Bryan Gurney |
bc084d |
|
|
Bryan Gurney |
bc084d |
After:
|
|
Bryan Gurney |
bc084d |
|
|
Bryan Gurney |
bc084d |
# ndctl check-namespace all
|
|
Bryan Gurney |
bc084d |
namespace0.0: namespace_check: namespace0.0: check aborted, namespace online
|
|
Bryan Gurney |
bc084d |
error checking namespaces: Device or resource busy
|
|
Bryan Gurney |
bc084d |
checked 0 namespaces
|
|
Bryan Gurney |
bc084d |
# ndctl disable-namespace namespace0.0
|
|
Bryan Gurney |
bc084d |
disabled 1 namespace
|
|
Bryan Gurney |
bc084d |
# ndctl check-namespace all
|
|
Bryan Gurney |
bc084d |
namespace0.0: namespace_check: Unable to recover any BTT info blocks
|
|
Bryan Gurney |
bc084d |
error checking namespaces: No such device or address
|
|
Bryan Gurney |
bc084d |
checked 0 namespaces
|
|
Bryan Gurney |
bc084d |
# ndctl destroy-namespace all
|
|
Bryan Gurney |
bc084d |
destroyed 1 namespace
|
|
Bryan Gurney |
bc084d |
# ndctl check-namespace all
|
|
Bryan Gurney |
bc084d |
checked 0 namespaces
|
|
Bryan Gurney |
bc084d |
# ndctl destroy-namespace all
|
|
Bryan Gurney |
bc084d |
destroyed 0 namespaces
|
|
Bryan Gurney |
bc084d |
# ndctl destroy-namespace all
|
|
Bryan Gurney |
bc084d |
destroyed 0 namespaces
|
|
Bryan Gurney |
bc084d |
|
|
Bryan Gurney |
bc084d |
Note: this does change the return value from -ENXIO to 0 in the cases
|
|
Bryan Gurney |
bc084d |
when no namespaces exist and processing all namespaces was requested.
|
|
Bryan Gurney |
bc084d |
|
|
Bryan Gurney |
bc084d |
Link: https://patchwork.kernel.org/patch/11681431/
|
|
Bryan Gurney |
bc084d |
Link: https://lore.kernel.org/r/32c8cd8d2716f5e52aebea4e4d303eeb4e0550f9.1609938610.git.msuchanek@suse.de
|
|
Bryan Gurney |
bc084d |
Reviewed-by: Santosh S <santosh@fossix.org>
|
|
Bryan Gurney |
bc084d |
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
|
|
Bryan Gurney |
bc084d |
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
|
|
Bryan Gurney |
bc084d |
|
|
Bryan Gurney |
bc084d |
diff --git a/ndctl/namespace.c b/ndctl/namespace.c
|
|
Bryan Gurney |
bc084d |
index 5e65ed5..cd822b3 100644
|
|
Bryan Gurney |
bc084d |
--- a/ndctl/namespace.c
|
|
Bryan Gurney |
bc084d |
+++ b/ndctl/namespace.c
|
|
Bryan Gurney |
bc084d |
@@ -2151,6 +2151,9 @@ static int do_xaction_namespace(const char *namespace,
|
|
Bryan Gurney |
bc084d |
if (!namespace && action != ACTION_CREATE)
|
|
Bryan Gurney |
bc084d |
return rc;
|
|
Bryan Gurney |
bc084d |
|
|
Bryan Gurney |
bc084d |
+ if (namespace && (strcmp(namespace, "all") == 0))
|
|
Bryan Gurney |
bc084d |
+ rc = 0;
|
|
Bryan Gurney |
bc084d |
+
|
|
Bryan Gurney |
bc084d |
if (verbose)
|
|
Bryan Gurney |
bc084d |
ndctl_set_log_priority(ctx, LOG_DEBUG);
|
|
Bryan Gurney |
bc084d |
|