All of lore.kernel.org
 help / color / mirror / Atom feed
* A question about ndctl namespace
@ 2018-07-10  1:33 Huaisheng HS1 Ye
  2018-07-10  1:41 ` Dan Williams
  0 siblings, 1 reply; 3+ messages in thread
From: Huaisheng HS1 Ye @ 2018-07-10  1:33 UTC (permalink / raw)
  To: Dan Williams, linux-nvdimm; +Cc: NingTing Cheng

Hi All,

I want to destroy some redundant namespaces (namespace0.0 and 0.1) from
my system.
But it still doesn’t work even I used ‘destroy-namespace’, the result
of command looks ok, but I still could find them there. How can I remove
them so they wouldn't appear in next command 'ndctl list'?

My questions are below,

1. Is there a bug of ndctl, or just working as designed?
2. If this is correct, why there are two namespaces as *.0 and *.1 for
every single NVDIMM? BTW, I have two NVDIMMs installed on my test platform.


[root@fedora25-03 ~]# ndctl destroy-namespace namespace0.0
destroyed 1 namespace
[root@fedora25-03 ~]# ndctl destroy-namespace namespace0.1
destroyed 1 namespace
[root@fedora25-03 ~]# ndctl list -i
[
  {
    "dev":"namespace1.0",
    "mode":"fsdax",
    "size":132118478848,
    "uuid":"454f9a8c-8d23-477b-a1b0-3aabb167d2f1",
    "raw_uuid":"a9d87d6c-6bb8-40fa-bebc-41c0a8e029d2",
    "sector_size":512,
    "blockdev":"pmem1",
    "name":"yhs_pmem1"
  },
  {
    "dev":"namespace1.1",
    "mode":"raw",
    "size":0,
    "uuid":"00000000-0000-0000-0000-000000000000",
    "sector_size":512,
    "state":"disabled"
  },
  {
    "dev":"namespace0.1",
    "mode":"raw",
    "size":0,
    "uuid":"00000000-0000-0000-0000-000000000000",
    "sector_size":512,
    "state":"disabled"
  },
  {
    "dev":"namespace0.0",
    "mode":"raw",
    "size":0,
    "uuid":"00000000-0000-0000-0000-000000000000",
    "sector_size":512,
    "state":"disabled"
  }
]

Cheers,
Huaisheng Ye | 叶怀胜
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: A question about ndctl namespace
  2018-07-10  1:33 A question about ndctl namespace Huaisheng HS1 Ye
@ 2018-07-10  1:41 ` Dan Williams
  2018-07-10  3:20   ` [External] " Huaisheng HS1 Ye
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Williams @ 2018-07-10  1:41 UTC (permalink / raw)
  To: Huaisheng HS1 Ye; +Cc: NingTing Cheng, linux-nvdimm

On Mon, Jul 9, 2018 at 6:33 PM, Huaisheng HS1 Ye <yehs1@lenovo.com> wrote:
> Hi All,
>
> I want to destroy some redundant namespaces (namespace0.0 and 0.1) from
> my system.
> But it still doesn’t work even I used ‘destroy-namespace’, the result
> of command looks ok, but I still could find them there. How can I remove
> them so they wouldn't appear in next command 'ndctl list'?

Short answer, you can't.

This is a general misconception about what the 'destroy-namespace'
command does. It destroys any info-block metadata and if the namespace
is not a 'seed' device or the 0th device it may additionally delete
the kernel device object. See this comment from the kernel source.

        /*
         * Try to delete the namespace if we deleted all of its
         * allocation, this is not the seed or 0th device for the
         * region, and it is not actively claimed by a btt, pfn, or dax
         * instance.
         */
        if (val == 0 && id != 0 && nd_region->ns_seed != dev && !ndns->claim)
                nd_device_unregister(dev, ND_ASYNC);

The reason we don't delete the seed device is that we always need at
least one seed device to configure the next namespace, and we keep the
0th device around to try to make sure the first namespace in a region
gets the namespaceX.0 device.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [External]  Re: A question about ndctl namespace
  2018-07-10  1:41 ` Dan Williams
@ 2018-07-10  3:20   ` Huaisheng HS1 Ye
  0 siblings, 0 replies; 3+ messages in thread
From: Huaisheng HS1 Ye @ 2018-07-10  3:20 UTC (permalink / raw)
  To: Dan Williams; +Cc: NingTing Cheng, linux-nvdimm

> From: Dan Williams [mailto:dan.j.williams@intel.com]
> Sent: Tuesday, July 10, 2018 9:42 AM
> On Mon, Jul 9, 2018 at 6:33 PM, Huaisheng HS1 Ye <yehs1@lenovo.com> wrote:
> > Hi All,
> >
> > I want to destroy some redundant namespaces (namespace0.0 and 0.1) from
> > my system.
> > But it still doesn’t work even I used ‘destroy-namespace’, the result
> > of command looks ok, but I still could find them there. How can I remove
> > them so they wouldn't appear in next command 'ndctl list'?
> 
> Short answer, you can't.
> 
> This is a general misconception about what the 'destroy-namespace'
> command does. It destroys any info-block metadata and if the namespace
> is not a 'seed' device or the 0th device it may additionally delete
> the kernel device object. See this comment from the kernel source.
> 
>         /*
>          * Try to delete the namespace if we deleted all of its
>          * allocation, this is not the seed or 0th device for the
>          * region, and it is not actively claimed by a btt, pfn, or dax
>          * instance.
>          */
>         if (val == 0 && id != 0 && nd_region->ns_seed != dev && !ndns->claim)
>                 nd_device_unregister(dev, ND_ASYNC);
> 
> The reason we don't delete the seed device is that we always need at
> least one seed device to configure the next namespace, and we keep the
> 0th device around to try to make sure the first namespace in a region
> gets the namespaceX.0 device.

Thanks for your quick reply and detailed explanation, and it looks like
NamespaceX.1 also couldn't be deleted.

dmesg gets information like this,
[72254.583858] nd namespace0.1: (0)
[72254.589424] nd namespace0.1: __size_store: uuid not set
[72254.596454] nd namespace0.1: 0 fail (-6)

That is to say, __size_store exit at here,
	/*
	 * We need a uuid for the allocation-label and dimm(s) on which
	 * to store the label.
	 */
	if (uuid_not_set(uuid, dev, __func__))
		return -ENXIO;


Cheers,
Huaisheng Ye
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-07-10  3:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-10  1:33 A question about ndctl namespace Huaisheng HS1 Ye
2018-07-10  1:41 ` Dan Williams
2018-07-10  3:20   ` [External] " Huaisheng HS1 Ye

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.