NVDIMM Device and Persistent Memory development
 help / color / 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; 5+ 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	[flat|nested] 5+ 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; 5+ 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] 5+ 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; 5+ 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] 5+ 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
  1 sibling, 1 reply; 5+ 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] 5+ 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
  0 siblings, 0 replies; 5+ 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] 5+ messages in thread

end of thread, back to index

Thread overview: 5+ 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

NVDIMM Device and Persistent Memory development

Archives are clonable:
	git clone --mirror https://lore.kernel.org/nvdimm/0 nvdimm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 nvdimm nvdimm/ https://lore.kernel.org/nvdimm \
		nvdimm@lists.linux.dev
	public-inbox-index nvdimm

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/dev.linux.lists.nvdimm


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git