nvdimm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Yi Zhang <yi.zhang@redhat.com>
To: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
Cc: nvdimm@lists.linux.dev, Dan Williams <dan.j.williams@intel.com>,
	 Vishal L Verma <vishal.l.verma@intel.com>,
	Jeff Moyer <jmoyer@redhat.com>
Subject: Re: [PATCH] ndctl: Avoid confusing error message when operating on all the namespaces
Date: Tue, 13 Jul 2021 08:19:36 +0800	[thread overview]
Message-ID: <CAHj4cs_t9sMw9b5XRPMkYE37BfAEMkWCFFpU1C8heKYBbRcnbA@mail.gmail.com> (raw)
In-Reply-To: <20210708100104.168348-1-aneesh.kumar@linux.ibm.com>

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


  reply	other threads:[~2021-07-13  0:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHj4cs_t9sMw9b5XRPMkYE37BfAEMkWCFFpU1C8heKYBbRcnbA@mail.gmail.com \
    --to=yi.zhang@redhat.com \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=dan.j.williams@intel.com \
    --cc=jmoyer@redhat.com \
    --cc=nvdimm@lists.linux.dev \
    --cc=vishal.l.verma@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).