|
Jeff Moyer |
2c91dc |
From 9bd2994f91bb77604521cbe09a76a51d092c2cfd Mon Sep 17 00:00:00 2001
|
|
Jeff Moyer |
2c91dc |
From: Michal Suchanek <msuchanek@suse.de>
|
|
Jeff Moyer |
2c91dc |
Date: Wed, 6 Jan 2021 14:17:40 +0100
|
|
Jeff Moyer |
2c91dc |
Subject: [PATCH 028/217] ndctl/namespace: Skip seed namespaces when processing
|
|
Jeff Moyer |
2c91dc |
all namespaces.
|
|
Bryan Gurney |
bc084d |
|
|
Jeff Moyer |
2c91dc |
The seed namespaces are exposed by the kernel but most operations are
|
|
Jeff Moyer |
2c91dc |
not valid on seed namespaces.
|
|
Bryan Gurney |
bc084d |
|
|
Jeff Moyer |
2c91dc |
When processing all namespaces the user gets confusing errors from ndctl
|
|
Jeff Moyer |
2c91dc |
trying to process seed namespaces. The kernel does not provide any way
|
|
Jeff Moyer |
2c91dc |
to tell that a namspace is seed namespace but skipping namespaces with
|
|
Jeff Moyer |
2c91dc |
zero size and UUID is a good heuristic.
|
|
Bryan Gurney |
bc084d |
|
|
Jeff Moyer |
2c91dc |
The user can still specify the namespace by name directly in case
|
|
Jeff Moyer |
2c91dc |
processing it is desirable.
|
|
Jeff Moyer |
2c91dc |
|
|
Jeff Moyer |
2c91dc |
Link: https://patchwork.kernel.org/patch/11473645/
|
|
Jeff Moyer |
2c91dc |
Link: https://lore.kernel.org/r/e55ae2c17b8b9c3288491efe6214338118e8c5ae.1609938610.git.msuchanek@suse.de
|
|
Jeff Moyer |
2c91dc |
Fixes: #41
|
|
Jeff Moyer |
2c91dc |
Tested-by: Harish Sriram <harish@linux.ibm.com>
|
|
Jeff Moyer |
2c91dc |
Reviewed-by: Santosh S <santosh@fossix.org>
|
|
Jeff Moyer |
2c91dc |
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
|
|
Jeff Moyer |
2c91dc |
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
|
|
Jeff Moyer |
2c91dc |
---
|
|
Jeff Moyer |
2c91dc |
ndctl/namespace.c | 16 +++++++++++++---
|
|
Jeff Moyer |
2c91dc |
1 file changed, 13 insertions(+), 3 deletions(-)
|
|
Bryan Gurney |
bc084d |
|
|
Bryan Gurney |
bc084d |
diff --git a/ndctl/namespace.c b/ndctl/namespace.c
|
|
Bryan Gurney |
bc084d |
index 1e8a2cd..5e65ed5 100644
|
|
Bryan Gurney |
bc084d |
--- a/ndctl/namespace.c
|
|
Bryan Gurney |
bc084d |
+++ b/ndctl/namespace.c
|
|
Bryan Gurney |
bc084d |
@@ -2210,9 +2210,19 @@ static int do_xaction_namespace(const char *namespace,
|
|
Bryan Gurney |
bc084d |
ndctl_namespace_foreach_safe(region, ndns, _n) {
|
|
Bryan Gurney |
bc084d |
ndns_name = ndctl_namespace_get_devname(ndns);
|
|
Bryan Gurney |
bc084d |
|
|
Bryan Gurney |
bc084d |
- if (strcmp(namespace, "all") != 0
|
|
Bryan Gurney |
bc084d |
- && strcmp(namespace, ndns_name) != 0)
|
|
Bryan Gurney |
bc084d |
- continue;
|
|
Bryan Gurney |
bc084d |
+ if (strcmp(namespace, "all") == 0) {
|
|
Bryan Gurney |
bc084d |
+ static const uuid_t zero_uuid;
|
|
Bryan Gurney |
bc084d |
+ uuid_t uuid;
|
|
Bryan Gurney |
bc084d |
+
|
|
Bryan Gurney |
bc084d |
+ ndctl_namespace_get_uuid(ndns, uuid);
|
|
Bryan Gurney |
bc084d |
+ if (!ndctl_namespace_get_size(ndns) &&
|
|
Bryan Gurney |
bc084d |
+ !memcmp(uuid, zero_uuid, sizeof(uuid_t)))
|
|
Bryan Gurney |
bc084d |
+ continue;
|
|
Bryan Gurney |
bc084d |
+ } else {
|
|
Bryan Gurney |
bc084d |
+ if (strcmp(namespace, ndns_name) != 0)
|
|
Bryan Gurney |
bc084d |
+ continue;
|
|
Bryan Gurney |
bc084d |
+ }
|
|
Bryan Gurney |
bc084d |
+
|
|
Bryan Gurney |
bc084d |
switch (action) {
|
|
Bryan Gurney |
bc084d |
case ACTION_DISABLE:
|
|
Bryan Gurney |
bc084d |
rc = ndctl_namespace_disable_safe(ndns);
|
|
Jeff Moyer |
2c91dc |
--
|
|
Jeff Moyer |
2c91dc |
2.27.0
|
|
Jeff Moyer |
2c91dc |
|