ndctl/namespace: skip zero namespaces when processing
PATCH 1/1 ndctl/namespace: skip zero namespaces when processing
Hello,
this is a fix for github issue #41. I tested on system with vpmem with ndctl 64.1 that the issue is fixed. master builds with the fix applied.
8<-------------------------------------------------------------------->8
The kernel always creates zero length namespace with uuid 0 in each region.
When processing all namespaces the user gets confusing errors from ndctl trying to process this namespace. Skip it.
The user can still specify the namespace by name directly in case processing it is desirable.
--- ndctl/namespace.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
ndctl/namespace.c +13 -3
@@ -2128,9 +2128,19 @@ static int do_xaction_namespace(const char *namespace, ndctl_namespace_foreach_safe(region, ndns, _n) { ndns_name =ndctl_namespace_get_devname (ndns); -if (strcmp (namespace,"all" ) !=0 - &&strcmp (namespace, ndns_name) !=0 ) -continue ; +if (strcmp (namespace,"all" ) ==0 ) { +static const uuid_t zero_uuid; +uuid_t uuid; + +ndctl_namespace_get_uuid (ndns, uuid); +if (!ndctl_namespace_get_size (ndns) && + !memcmp (uuid, zero_uuid,sizeof (uuid_t))) +continue ; + }else { +if (strcmp (namespace, ndns_name) !=0 ) +continue ; + } +switch (action) {case ACTION_DISABLE : rc =ndctl_namespace_disable_safe (ndns);
Signature · 4 lines
2.23.0 _______________________________________________ Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]
Quoted 16 lines · Michal Suchanek
Hello,
this is a fix for github issue #41. I tested on system with vpmem with ndctl 64.1 that the issue is fixed. master builds with the fix applied.
8<-------------------------------------------------------------------->8
The kernel always creates zero length namespace with uuid 0 in each region.
When processing all namespaces the user gets confusing errors from ndctl trying to process this namespace. Skip it.
The user can still specify the namespace by name directly in case processing it is desirable.
Quoted 6 lines
Fixes #41Signed-off-by Michal Suchanek <[email protected]>--- ndctl/namespace.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
Tested on a vpmem system with master branch, and I can see the issue got fixed.
# ./ndctl/ndctl enable-namespace all error enabling namespaces: No such device or address enabled 24 namespaces
After this patch
# ./ndctl/ndctl enable-namespace all enabled 24 namespaces
Thanks,
Santosh
Quoted 30 lines
ndctl/namespace.c +13
-3@@ -2128,9 +2128,19 @@ static int do_xaction_namespace(const char *namespace, ndctl_namespace_foreach_safe(region, ndns, _n) { ndns_name =ndctl_namespace_get_devname (ndns); -if (strcmp (namespace,"all" ) !=0 - &&strcmp (namespace, ndns_name) !=0 ) -continue ; +if (strcmp (namespace,"all" ) ==0 ) { +static const uuid_t zero_uuid; +uuid_t uuid; + +ndctl_namespace_get_uuid (ndns, uuid); +if (!ndctl_namespace_get_size (ndns) && + !memcmp (uuid, zero_uuid,sizeof (uuid_t))) +continue ; + }else { +if (strcmp (namespace, ndns_name) !=0 ) +continue ; + } +switch (action) {case ACTION_DISABLE : rc =ndctl_namespace_disable_safe (ndns);Signature · 1 line
2.23.0
_______________________________________________
Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]
Quoted 40 lines · Michal Suchanek
Hello,
this is a fix for github issue #41. I tested on system with vpmem with ndctl 64.1 that the issue is fixed. master builds with the fix applied.
8<-------------------------------------------------------------------->8
The kernel always creates zero length namespace with uuid 0 in each region.
When processing all namespaces the user gets confusing errors from ndctl trying to process this namespace. Skip it.
The user can still specify the namespace by name directly in case processing it is desirable.
Fixes #41Signed-off-by Michal Suchanek <[email protected]>--- ndctl/namespace.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)ndctl/namespace.c +6
-3@@ -2128,9 +2128,19 @@ static int do_xaction_namespace(const char *namespace, ndctl_namespace_foreach_safe(region, ndns, _n) { ndns_name =ndctl_namespace_get_devname (ndns); -if (strcmp (namespace,"all" ) !=0 - &&strcmp (namespace, ndns_name) !=0 ) -continue ; +if (strcmp (namespace,"all" ) ==0 ) { +static const uuid_t zero_uuid; +uuid_t uuid; + +ndctl_namespace_get_uuid (ndns, uuid); + if (!ndctl_namespace_get_size(ndns) &&
ndctl/namespace.c static int do_xaction_namespace(const char *namespace, · line 2146
Quoted 10 lines
ndctl/namespace.c +7
-0+ !memcmp(uuid, zero_uuid, sizeof(uuid_t))) +continue ; + }else { +if (strcmp (namespace, ndns_name) !=0 ) +continue ; + } +switch (action) {case ACTION_DISABLE : rc =ndctl_namespace_disable_safe (ndns);
_______________________________________________
Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]