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