ndctl/07011a3-ndctl-namespace-Suppress-ENXIO-when-processing-all-namespaces.patch
Bryan Gurney bc084de093 Pull in fixes from upstream v72 and v73
We could not rebase to v73 because there was an incompatible config
file change (the file both changed in format and moved location).
Unfortunately, that configuration change also added externally facing
APIs, and with them, new versioned symbols.  As a result, I couldn't
pull in all fixes because it would result in an incompatible list of
symbols in a given ABI version.  Long term, upstream is aware of the
config file problem, and is looking to address it by supporting both
old and new formats and locations.

This update addresses the following reported bugs:
- Fix enable-namespace all reporting errors incorrectly
- Add support for inject-smart on papr scm

Related: rhbz#2040075
Related: rhbz#1873851
Related: rhbz#1880578
Related: rhbz#1922538
Related: rhbz#2087707

Signed-off-by: Bryan Gurney <bgurney@redhat.com>
2022-06-17 10:35:16 -04:00

82 lines
2.8 KiB
Diff

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