From: "Verma, Vishal L" <vishal.l.verma@intel.com>
To: "Williams, Dan J" <dan.j.williams@intel.com>,
"linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>
Subject: Re: [ndctl PATCH v2] ndctl, list: fix namespace json object parenting
Date: Thu, 15 Mar 2018 23:46:41 +0000 [thread overview]
Message-ID: <1521157599.28441.4.camel@intel.com> (raw)
In-Reply-To: <152098394967.38244.14033629842721195081.stgit@dwillia2-desk3.amr.corp.intel.com>
On Tue, 2018-03-13 at 16:33 -0700, Dan Williams wrote:
> When listing namespaces and regions a generic jplatform object is
> created to house the regions array. However, commit f8cc6fee4e4d
> "ndctl,
> list: refactor core topology walking into util_filter_walk()"
> inadvertently added namespaces to that jplatform, and otherwise
> failed
> to parent namespaces to their proper parent region.
>
> # ndctl list -RNu
> {
> "regions":[
> {
> "dev":"region1",
> "size":"511.00 GiB (548.68 GB)",
> "available_size":0,
> "type":"pmem",
> "numa_node":0,
> "namespaces":[
> {
> "dev":"namespace1.0",
> "mode":"raw",
> "size":"511.00 GiB (548.68 GB)",
> "sector_size":512,
> "blockdev":"pmem1",
> "numa_node":0
> },
> {
> "dev":"namespace0.0", <------- wrong region
> "mode":"fsdax",
> "size":"4.00 GiB (4.29 GB)",
> "sector_size":512,
> "blockdev":"pmem0",
> "numa_node":0
> }
> ]
> },
> {
> "dev":"region0",
> "size":"4.00 GiB (4.29 GB)",
> "available_size":0,
> "type":"pmem"
> }
> ],
> "namespaces":[ <------ we already listed the namespaces
> {
> "dev":"namespace1.0",
> "mode":"raw",
> "size":"511.00 GiB (548.68 GB)",
> "sector_size":512,
> "blockdev":"pmem1",
> "numa_node":0
> },
> {
> "dev":"namespace0.0",
> "mode":"fsdax",
> "size":"4.00 GiB (4.29 GB)",
> "sector_size":512,
> "blockdev":"pmem0",
> "numa_node":0
> }
> ]
> }
> ndctl: json_object.c:188: json_object_put: Assertion `jso-
> >_ref_count > 0' failed.
> Aborted (core dumped) <------ not ideal
>
> Clear out the jnamespaces tracking as the filter walk transitions to
> the
> next region, and make sure that jnamepsaces is not added to jplatform
> when regions are being displayed.
>
> Fixes: f8cc6fee4e4d(" ndctl, list: refactor core topology
> walking...")
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
> v2: fix breaking namespace arrays on region boundaries
>
> ndctl/list.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
Looks good, queued.
>
> diff --git a/ndctl/list.c b/ndctl/list.c
> index 0ca5b6dee5eb..fe8036eabc3b 100644
> --- a/ndctl/list.c
> +++ b/ndctl/list.c
> @@ -245,6 +245,13 @@ static bool filter_region(struct ndctl_region
> *region,
> lfa->jregion = jregion;
>
> /*
> + * We've started a new region, any previous jnamespaces will
> + * have been parented to the last region. Clear out
> jnamespaces
> + * so we start a new array per region.
> + */
> + lfa->jnamespaces = NULL;
> +
> + /*
> * Without a bus we are collecting regions anonymously
> across
> * the platform.
> */
> @@ -366,7 +373,7 @@ static int list_display(struct list_filter_arg
> *lfa)
> json_object_object_add(jplatform, "dimms",
> jdimms);
> if (jregions)
> json_object_object_add(jplatform, "regions",
> jregions);
> - if (jnamespaces)
> + if (jnamespaces && !jregions)
> json_object_object_add(jplatform,
> "namespaces",
> jnamespaces);
> printf("%s\n",
> json_object_to_json_string_ext(jplatform,
>
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
prev parent reply other threads:[~2018-03-15 23:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-13 23:33 [ndctl PATCH v2] ndctl, list: fix namespace json object parenting Dan Williams
2018-03-15 23:46 ` Verma, Vishal L [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=1521157599.28441.4.camel@intel.com \
--to=vishal.l.verma@intel.com \
--cc=dan.j.williams@intel.com \
--cc=linux-nvdimm@lists.01.org \
/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