Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1571887 > unrolled thread
| Started by | Dan Williams <dan.j.williams@intel.com> |
|---|---|
| First post | 2017-02-01 19:40 +0100 |
| Last post | 2017-02-02 09:10 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] libnvdimm, namespace: do not delete namespace-id 0 Dan Williams <dan.j.williams@intel.com> - 2017-02-01 19:40 +0100
Re: [PATCH] libnvdimm, namespace: do not delete namespace-id 0 Johannes Thumshirn <jthumshirn@suse.de> - 2017-02-02 09:10 +0100
| From | Dan Williams <dan.j.williams@intel.com> |
|---|---|
| Date | 2017-02-01 19:40 +0100 |
| Subject | [PATCH] libnvdimm, namespace: do not delete namespace-id 0 |
| Message-ID | <t67Z0-Zl-9@gated-at.bofh.it> |
Given that the naming of pmem devices changes from the pmemX form to the
pmemX.Y form when namespace id is greater than 0, arrange for namespaces
with id-0 to be exempt from deletion. Otherwise a simple reconfiguration
of an existing namespace to a new mode results in a name change of the
resulting block device:
# ndctl list --namespace=namespace1.0
{
"dev":"namespace1.0",
"mode":"raw",
"size":2147483648,
"uuid":"3dadf3dc-89b9-4b24-b20e-abc8a4707ce3",
"blockdev":"pmem1"
}
# ndctl create-namespace --reconfig=namespace1.0 --mode=memory --force
{
"dev":"namespace1.1",
"mode":"memory",
"size":2111832064,
"uuid":"7b4a6341-7318-4219-a02c-fb57c0bbf613",
"blockdev":"pmem1.1"
}
This change does require tooling changes to explicitly look for
namespaceX.0 if the seed has already advanced to another namespace.
Cc: <stable@vger.kernel.org>
Fixes: 98a29c39dc68 ("libnvdimm, namespace: allow creation of multiple pmem-namespaces per region")
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
drivers/nvdimm/namespace_devs.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/nvdimm/namespace_devs.c b/drivers/nvdimm/namespace_devs.c
index eda027db0918..ce3e8dfa10ad 100644
--- a/drivers/nvdimm/namespace_devs.c
+++ b/drivers/nvdimm/namespace_devs.c
@@ -962,8 +962,8 @@ static ssize_t __size_store(struct device *dev, unsigned long long val)
struct nvdimm_drvdata *ndd;
struct nd_label_id label_id;
u32 flags = 0, remainder;
+ int rc, i, id = -1;
u8 *uuid = NULL;
- int rc, i;
if (dev->driver || ndns->claim)
return -EBUSY;
@@ -972,11 +972,13 @@ static ssize_t __size_store(struct device *dev, unsigned long long val)
struct nd_namespace_pmem *nspm = to_nd_namespace_pmem(dev);
uuid = nspm->uuid;
+ id = nspm->id;
} else if (is_namespace_blk(dev)) {
struct nd_namespace_blk *nsblk = to_nd_namespace_blk(dev);
uuid = nsblk->uuid;
flags = NSLABEL_FLAG_LOCAL;
+ id = nsblk->id;
}
/*
@@ -1039,10 +1041,11 @@ static ssize_t __size_store(struct device *dev, unsigned long long val)
/*
* Try to delete the namespace if we deleted all of its
- * allocation, this is not the seed device for the region, and
- * it is not actively claimed by a btt instance.
+ * 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 && nd_region->ns_seed != dev && !ndns->claim)
+ if (val == 0 && id != 0 && nd_region->ns_seed != dev && !ndns->claim)
nd_device_unregister(dev, ND_ASYNC);
return rc;
[toc] | [next] | [standalone]
| From | Johannes Thumshirn <jthumshirn@suse.de> |
|---|---|
| Date | 2017-02-02 09:10 +0100 |
| Message-ID | <t6kCR-1ep-1@gated-at.bofh.it> |
| In reply to | #1571887 |
On Wed, Feb 01, 2017 at 10:35:21AM -0800, Dan Williams wrote:
> Given that the naming of pmem devices changes from the pmemX form to the
> pmemX.Y form when namespace id is greater than 0, arrange for namespaces
> with id-0 to be exempt from deletion. Otherwise a simple reconfiguration
> of an existing namespace to a new mode results in a name change of the
> resulting block device:
>
> # ndctl list --namespace=namespace1.0
> {
> "dev":"namespace1.0",
> "mode":"raw",
> "size":2147483648,
> "uuid":"3dadf3dc-89b9-4b24-b20e-abc8a4707ce3",
> "blockdev":"pmem1"
> }
>
> # ndctl create-namespace --reconfig=namespace1.0 --mode=memory --force
> {
> "dev":"namespace1.1",
> "mode":"memory",
> "size":2111832064,
> "uuid":"7b4a6341-7318-4219-a02c-fb57c0bbf613",
> "blockdev":"pmem1.1"
> }
>
> This change does require tooling changes to explicitly look for
> namespaceX.0 if the seed has already advanced to another namespace.
>
> Cc: <stable@vger.kernel.org>
> Fixes: 98a29c39dc68 ("libnvdimm, namespace: allow creation of multiple pmem-namespaces per region")
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
Looks good,
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
--
Johannes Thumshirn Storage
jthumshirn@suse.de +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web