nvdimm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH] ndctl: Avoid confusing error message when operating on all the namespaces
@ 2021-07-08 10:01 Aneesh Kumar K.V
  2021-07-13  0:19 ` Yi Zhang
  0 siblings, 1 reply; 6+ messages in thread
From: Aneesh Kumar K.V @ 2021-07-08 10:01 UTC (permalink / raw)
  To: nvdimm, dan.j.williams, Vishal L Verma; +Cc: Aneesh Kumar K.V

With only seed namespace present, ndctl results in confusing error messages as
below.

ndctl# ./ndctl/ndctl  enable-namespace all
error enabling namespaces: No such device or address
enabled 0 namespaces

ndctl# ./ndctl/ndctl  disable-namespace all
disabled 3 namespaces

ndctl# ./ndctl/ndctl  destroy-namespace all -f
  Error: destroy namespace: namespace1.0 failed to enable for zeroing, continuing

  Error: destroy namespace: namespace1.1 failed to enable for zeroing, continuing

  Error: destroy namespace: namespace0.0 failed to enable for zeroing, continuing

destroyed 0 namespaces
ndctl#

With the patch we get
ndctl# ./ndctl/ndctl  disable-namespace all
disabled 0 namespaces

ndctl# ./ndctl/ndctl  enable-namespace all
enabled 0 namespaces

ndctl# ./ndctl/ndctl  destroy-namespace all -f
destroyed 0 namespaces
ndctl#

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
---
 ndctl/namespace.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/ndctl/namespace.c b/ndctl/namespace.c
index 0c8df9fa8b47..c52daeae562a 100644
--- a/ndctl/namespace.c
+++ b/ndctl/namespace.c
@@ -2205,8 +2205,15 @@ static int do_xaction_namespace(const char *namespace,
 				return rc;
 			}
 			ndctl_namespace_foreach_safe(region, ndns, _n) {
-				ndns_name = ndctl_namespace_get_devname(ndns);
 
+				if (!strcmp(namespace, "all")
+						&& !ndctl_namespace_get_size(ndns)) {
+					if (!*processed && rc)
+						rc  = 0;
+					continue;
+				}
+
+				ndns_name = ndctl_namespace_get_devname(ndns);
 				if (strcmp(namespace, "all") != 0
 						&& strcmp(namespace, ndns_name) != 0)
 					continue;
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] ndctl: Avoid confusing error message when operating on all the namespaces
  2021-07-08 10:01 [PATCH] ndctl: Avoid confusing error message when operating on all the namespaces Aneesh Kumar K.V
@ 2021-07-13  0:19 ` Yi Zhang
  2021-07-13  4:14   ` Aneesh Kumar K.V
  2021-07-13  5:16   ` Dan Williams
  0 siblings, 2 replies; 6+ messages in thread
From: Yi Zhang @ 2021-07-13  0:19 UTC (permalink / raw)
  To: Aneesh Kumar K.V; +Cc: nvdimm, Dan Williams, Vishal L Verma, Jeff Moyer

Jeff had posted one patch to fix similar issue
https://lore.kernel.org/linux-nvdimm/x49r1lohpty.fsf@segfault.boston.devel.redhat.com/T/#u

Hi Dan/Visha
Could we make some progress on this issue?


On Thu, Jul 8, 2021 at 6:41 PM Aneesh Kumar K.V
<aneesh.kumar@linux.ibm.com> wrote:
>
> With only seed namespace present, ndctl results in confusing error messages as
> below.
>
> ndctl# ./ndctl/ndctl  enable-namespace all
> error enabling namespaces: No such device or address
> enabled 0 namespaces
>
> ndctl# ./ndctl/ndctl  disable-namespace all
> disabled 3 namespaces
>
> ndctl# ./ndctl/ndctl  destroy-namespace all -f
>   Error: destroy namespace: namespace1.0 failed to enable for zeroing, continuing
>
>   Error: destroy namespace: namespace1.1 failed to enable for zeroing, continuing
>
>   Error: destroy namespace: namespace0.0 failed to enable for zeroing, continuing
>
> destroyed 0 namespaces
> ndctl#
>
> With the patch we get
> ndctl# ./ndctl/ndctl  disable-namespace all
> disabled 0 namespaces
>
> ndctl# ./ndctl/ndctl  enable-namespace all
> enabled 0 namespaces
>
> ndctl# ./ndctl/ndctl  destroy-namespace all -f
> destroyed 0 namespaces
> ndctl#
>
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> ---
>  ndctl/namespace.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/ndctl/namespace.c b/ndctl/namespace.c
> index 0c8df9fa8b47..c52daeae562a 100644
> --- a/ndctl/namespace.c
> +++ b/ndctl/namespace.c
> @@ -2205,8 +2205,15 @@ static int do_xaction_namespace(const char *namespace,
>                                 return rc;
>                         }
>                         ndctl_namespace_foreach_safe(region, ndns, _n) {
> -                               ndns_name = ndctl_namespace_get_devname(ndns);
>
> +                               if (!strcmp(namespace, "all")
> +                                               && !ndctl_namespace_get_size(ndns)) {
> +                                       if (!*processed && rc)
> +                                               rc  = 0;
> +                                       continue;
> +                               }
> +
> +                               ndns_name = ndctl_namespace_get_devname(ndns);
>                                 if (strcmp(namespace, "all") != 0
>                                                 && strcmp(namespace, ndns_name) != 0)
>                                         continue;
> --
> 2.31.1
>
>


-- 
Best Regards,
  Yi Zhang


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ndctl: Avoid confusing error message when operating on all the namespaces
  2021-07-13  0:19 ` Yi Zhang
@ 2021-07-13  4:14   ` Aneesh Kumar K.V
  2021-07-13  5:16   ` Dan Williams
  1 sibling, 0 replies; 6+ messages in thread
From: Aneesh Kumar K.V @ 2021-07-13  4:14 UTC (permalink / raw)
  To: Yi Zhang; +Cc: nvdimm, Dan Williams, Vishal L Verma, Jeff Moyer

On 7/13/21 5:49 AM, Yi Zhang wrote:
> Jeff had posted one patch to fix similar issue
> https://lore.kernel.org/linux-nvdimm/x49r1lohpty.fsf@segfault.boston.devel.redhat.com/T/#u
> 

I missed that patch. I am wondering whether that would result in ndctl 
not reporting error when we use the seed namespace name directly with 
destroy-namespace command

> Hi Dan/Visha
> Could we make some progress on this issue?
> 
> 
> On Thu, Jul 8, 2021 at 6:41 PM Aneesh Kumar K.V
> <aneesh.kumar@linux.ibm.com> wrote:
>>
>> With only seed namespace present, ndctl results in confusing error messages as
>> below.
>>
>> ndctl# ./ndctl/ndctl  enable-namespace all
>> error enabling namespaces: No such device or address
>> enabled 0 namespaces
>>
>> ndctl# ./ndctl/ndctl  disable-namespace all
>> disabled 3 namespaces
>>
>> ndctl# ./ndctl/ndctl  destroy-namespace all -f
>>    Error: destroy namespace: namespace1.0 failed to enable for zeroing, continuing
>>
>>    Error: destroy namespace: namespace1.1 failed to enable for zeroing, continuing
>>
>>    Error: destroy namespace: namespace0.0 failed to enable for zeroing, continuing
>>
>> destroyed 0 namespaces
>> ndctl#
>>
>> With the patch we get
>> ndctl# ./ndctl/ndctl  disable-namespace all
>> disabled 0 namespaces
>>
>> ndctl# ./ndctl/ndctl  enable-namespace all
>> enabled 0 namespaces
>>
>> ndctl# ./ndctl/ndctl  destroy-namespace all -f
>> destroyed 0 namespaces
>> ndctl#
>>
>> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
>> ---
>>   ndctl/namespace.c | 9 ++++++++-
>>   1 file changed, 8 insertions(+), 1 deletion(-)
>>
>> diff --git a/ndctl/namespace.c b/ndctl/namespace.c
>> index 0c8df9fa8b47..c52daeae562a 100644
>> --- a/ndctl/namespace.c
>> +++ b/ndctl/namespace.c
>> @@ -2205,8 +2205,15 @@ static int do_xaction_namespace(const char *namespace,
>>                                  return rc;
>>                          }
>>                          ndctl_namespace_foreach_safe(region, ndns, _n) {
>> -                               ndns_name = ndctl_namespace_get_devname(ndns);
>>
>> +                               if (!strcmp(namespace, "all")
>> +                                               && !ndctl_namespace_get_size(ndns)) {
>> +                                       if (!*processed && rc)
>> +                                               rc  = 0;
>> +                                       continue;
>> +                               }
>> +
>> +                               ndns_name = ndctl_namespace_get_devname(ndns);
>>                                  if (strcmp(namespace, "all") != 0
>>                                                  && strcmp(namespace, ndns_name) != 0)
>>                                          continue;
>> --
>> 2.31.1
>>
>>
> 
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ndctl: Avoid confusing error message when operating on all the namespaces
  2021-07-13  0:19 ` Yi Zhang
  2021-07-13  4:14   ` Aneesh Kumar K.V
@ 2021-07-13  5:16   ` Dan Williams
  2021-07-15  3:39     ` Yi Zhang
  2021-09-13  4:57     ` Aneesh Kumar K.V
  1 sibling, 2 replies; 6+ messages in thread
From: Dan Williams @ 2021-07-13  5:16 UTC (permalink / raw)
  To: Yi Zhang; +Cc: Aneesh Kumar K.V, Linux NVDIMM, Vishal L Verma, Jeff Moyer

On Mon, Jul 12, 2021 at 5:20 PM Yi Zhang <yi.zhang@redhat.com> wrote:
>
> Jeff had posted one patch to fix similar issue
> https://lore.kernel.org/linux-nvdimm/x49r1lohpty.fsf@segfault.boston.devel.redhat.com/T/#u
>
> Hi Dan/Visha
> Could we make some progress on this issue?

Apologies, we had some internal administrivia to address, but are
getting back to regular releases now and catching up on the backlog.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ndctl: Avoid confusing error message when operating on all the namespaces
  2021-07-13  5:16   ` Dan Williams
@ 2021-07-15  3:39     ` Yi Zhang
  2021-09-13  4:57     ` Aneesh Kumar K.V
  1 sibling, 0 replies; 6+ messages in thread
From: Yi Zhang @ 2021-07-15  3:39 UTC (permalink / raw)
  To: Dan Williams; +Cc: Aneesh Kumar K.V, Linux NVDIMM, Vishal L Verma, Jeff Moyer

On Tue, Jul 13, 2021 at 1:16 PM Dan Williams <dan.j.williams@intel.com> wrote:
>
> On Mon, Jul 12, 2021 at 5:20 PM Yi Zhang <yi.zhang@redhat.com> wrote:
> >
> > Jeff had posted one patch to fix similar issue
> > https://lore.kernel.org/linux-nvdimm/x49r1lohpty.fsf@segfault.boston.devel.redhat.com/T/#u
> >
> > Hi Dan/Visha
> > Could we make some progress on this issue?
>
> Apologies, we had some internal administrivia to address, but are
> getting back to regular releases now and catching up on the backlog.
>

No worries, thanks for the update :)

-- 
Best Regards,
  Yi Zhang


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ndctl: Avoid confusing error message when operating on all the namespaces
  2021-07-13  5:16   ` Dan Williams
  2021-07-15  3:39     ` Yi Zhang
@ 2021-09-13  4:57     ` Aneesh Kumar K.V
  1 sibling, 0 replies; 6+ messages in thread
From: Aneesh Kumar K.V @ 2021-09-13  4:57 UTC (permalink / raw)
  To: Dan Williams, Yi Zhang; +Cc: Linux NVDIMM, Vishal L Verma, Jeff Moyer

Dan Williams <dan.j.williams@intel.com> writes:

> On Mon, Jul 12, 2021 at 5:20 PM Yi Zhang <yi.zhang@redhat.com> wrote:
>>
>> Jeff had posted one patch to fix similar issue
>> https://lore.kernel.org/linux-nvdimm/x49r1lohpty.fsf@segfault.boston.devel.redhat.com/T/#u
>>
>> Hi Dan/Visha
>> Could we make some progress on this issue?
>
> Apologies, we had some internal administrivia to address, but are
> getting back to regular releases now and catching up on the backlog.

Any update on this patch? Without this I get failures with 
https://github.com/avocado-framework-tests/avocado-misc-tests/blob/master/memory/ndctl.py
because the return status is 1 for disable-namespace command with only
seed namespace.

-aneesh

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-09-13  4:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-08 10:01 [PATCH] ndctl: Avoid confusing error message when operating on all the namespaces Aneesh Kumar K.V
2021-07-13  0:19 ` Yi Zhang
2021-07-13  4:14   ` Aneesh Kumar K.V
2021-07-13  5:16   ` Dan Williams
2021-07-15  3:39     ` Yi Zhang
2021-09-13  4:57     ` Aneesh Kumar K.V

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).