|
@@ -962,8 +962,8 @@ static ssize_t __size_store(struct device *dev, unsigned long long val)
|
|
struct nvdimm_drvdata *ndd;
|
|
struct nvdimm_drvdata *ndd;
|
|
struct nd_label_id label_id;
|
|
struct nd_label_id label_id;
|
|
u32 flags = 0, remainder;
|
|
u32 flags = 0, remainder;
|
|
|
|
+ int rc, i, id = -1;
|
|
u8 *uuid = NULL;
|
|
u8 *uuid = NULL;
|
|
- int rc, i;
|
|
|
|
|
|
|
|
if (dev->driver || ndns->claim)
|
|
if (dev->driver || ndns->claim)
|
|
return -EBUSY;
|
|
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);
|
|
struct nd_namespace_pmem *nspm = to_nd_namespace_pmem(dev);
|
|
|
|
|
|
uuid = nspm->uuid;
|
|
uuid = nspm->uuid;
|
|
|
|
+ id = nspm->id;
|
|
} else if (is_namespace_blk(dev)) {
|
|
} else if (is_namespace_blk(dev)) {
|
|
struct nd_namespace_blk *nsblk = to_nd_namespace_blk(dev);
|
|
struct nd_namespace_blk *nsblk = to_nd_namespace_blk(dev);
|
|
|
|
|
|
uuid = nsblk->uuid;
|
|
uuid = nsblk->uuid;
|
|
flags = NSLABEL_FLAG_LOCAL;
|
|
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
|
|
* 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);
|
|
nd_device_unregister(dev, ND_ASYNC);
|
|
|
|
|
|
return rc;
|
|
return rc;
|