From: Santosh Sivaraj <santosh@fossix.org>
To: Michal Suchanek <msuchanek@suse.de>, linux-nvdimm@lists.01.org
Cc: Michal Suchanek <msuchanek@suse.de>
Subject: Re: [PATCH 2/2] ndctl/namespace: Suppress ENODEV when processing all namespaces.
Date: Fri, 28 Aug 2020 14:09:12 +0530 [thread overview]
Message-ID: <87d03bcggf.fsf@santosiv.in.ibm.com> (raw)
In-Reply-To: <3905bc44eec1a7251ea67729aee9ecf4d6d33653.1595526596.git.msuchanek@suse.de>
Michal Suchanek <msuchanek@suse.de> writes:
> When processing all namespaces and no namespaces exist user gets the
> default -ENOENT. Set default rc to 0 when processing all namespaces.
> This avoids confusing error message printed in addition to the message
> saying 0 namespaces were affected.
>
> Before:
>
> # ndctl check-namespace all
> namespace0.0: namespace_check: namespace0.0: check aborted, namespace online
> error checking namespaces: Device or resource busy
> checked 0 namespaces
> # ndctl disable-namespace all
> disabled 1 namespace
> # ndctl check-namespace all
> namespace0.0: namespace_check: Unable to recover any BTT info blocks
> error checking namespaces: No such device or address
> checked 0 namespaces
> # ndctl destroy-namespace all
> destroyed 1 namespace
> # ndctl check-namespace all
> error checking namespaces: No such device or address
> checked 0 namespaces
> # ndctl destroy-namespace all
> error destroying namespaces: No such device or address
> destroyed 0 namespaces
>
> After:
>
> # ndctl check-namespace all
> namespace0.0: namespace_check: namespace0.0: check aborted, namespace online
> error checking namespaces: Device or resource busy
> checked 0 namespaces
> # ndctl disable-namespace namespace0.0
> disabled 1 namespace
> # ndctl check-namespace all
> namespace0.0: namespace_check: Unable to recover any BTT info blocks
> error checking namespaces: No such device or address
> checked 0 namespaces
> # ndctl destroy-namespace all
> destroyed 1 namespace
> # ndctl check-namespace all
> checked 0 namespaces
> # ndctl destroy-namespace all
> destroyed 0 namespaces
> # ndctl destroy-namespace all
> destroyed 0 namespaces
>
> Note: this does change the return value from -ENOENT to 0 in the cases
> when no namespaces exist and processing all namespaces was requested.
>
> Signed-off-by: Michal Suchanek <msuchanek@suse.de>
I missed this patch and had a different approach of solving this, fiddling
around with processed and saved_rc in the end of the function. This is
cleaner.
Nit: The default return value is -ENXIO, if that matters in the commit message.
Reviewed-by: Santosh S <santosh@fossix.org>
Thanks,
Santosh
> ---
> ndctl/namespace.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/ndctl/namespace.c b/ndctl/namespace.c
> index 3fabe4799d75..835f4076008a 100644
> --- a/ndctl/namespace.c
> +++ b/ndctl/namespace.c
> @@ -2112,6 +2112,9 @@ static int do_xaction_namespace(const char *namespace,
> if (!namespace && action != ACTION_CREATE)
> return rc;
>
> + if (namespace && (strcmp(namespace, "all") == 0))
> + rc = 0;
> +
> if (verbose)
> ndctl_set_log_priority(ctx, LOG_DEBUG);
>
> --
> 2.26.2
> _______________________________________________
> Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
> To unsubscribe send an email to linux-nvdimm-leave@lists.01.org
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org
prev parent reply other threads:[~2020-08-28 8:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-23 17:51 [PATCH 1/2] ndctl/namespace: skip zero namespaces when processing all namespaces Michal Suchanek
2020-07-23 17:51 ` [PATCH 2/2] ndctl/namespace: Suppress ENODEV " Michal Suchanek
2020-08-28 8:39 ` Santosh Sivaraj [this message]
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=87d03bcggf.fsf@santosiv.in.ibm.com \
--to=santosh@fossix.org \
--cc=linux-nvdimm@lists.01.org \
--cc=msuchanek@suse.de \
/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