* [ndctl PATCH] ndctl, list: fix namespace json object parenting
@ 2018-03-13 20:21 Dan Williams
2018-03-13 20:36 ` Dan Williams
0 siblings, 1 reply; 2+ messages in thread
From: Dan Williams @ 2018-03-13 20:21 UTC (permalink / raw)
To: linux-nvdimm
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. Namespaces should only
be added to jplatform in the case when regions are not being listed.
Otherwise we get duplicated output and a double-put assertion as seen
below:
# 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",
"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":[
{
"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)
Fixes: f8cc6fee4e4d(" ndctl, list: refactor core topology walking...")
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
ndctl/list.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ndctl/list.c b/ndctl/list.c
index 0ca5b6dee5eb..0683bc8d6174 100644
--- a/ndctl/list.c
+++ b/ndctl/list.c
@@ -366,7 +366,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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [ndctl PATCH] ndctl, list: fix namespace json object parenting
2018-03-13 20:21 [ndctl PATCH] ndctl, list: fix namespace json object parenting Dan Williams
@ 2018-03-13 20:36 ` Dan Williams
0 siblings, 0 replies; 2+ messages in thread
From: Dan Williams @ 2018-03-13 20:36 UTC (permalink / raw)
To: linux-nvdimm
On Tue, Mar 13, 2018 at 1:21 PM, Dan Williams <dan.j.williams@intel.com> 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. Namespaces should only
> be added to jplatform in the case when regions are not being listed.
> Otherwise we get duplicated output and a double-put assertion as seen
> below:
Ignore this patch, I see a different problem.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-03-13 20:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-13 20:21 [ndctl PATCH] ndctl, list: fix namespace json object parenting Dan Williams
2018-03-13 20:36 ` Dan Williams
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).