diff options
Diffstat (limited to 'drivers/nvdimm/namespace_devs.c')
-rw-r--r-- | drivers/nvdimm/namespace_devs.c | 11 |
1 files 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) | |||
962 | struct nvdimm_drvdata *ndd; | 962 | struct nvdimm_drvdata *ndd; |
963 | struct nd_label_id label_id; | 963 | struct nd_label_id label_id; |
964 | u32 flags = 0, remainder; | 964 | u32 flags = 0, remainder; |
965 | int rc, i, id = -1; | ||
965 | u8 *uuid = NULL; | 966 | u8 *uuid = NULL; |
966 | int rc, i; | ||
967 | 967 | ||
968 | if (dev->driver || ndns->claim) | 968 | if (dev->driver || ndns->claim) |
969 | return -EBUSY; | 969 | return -EBUSY; |
@@ -972,11 +972,13 @@ static ssize_t __size_store(struct device *dev, unsigned long long val) | |||
972 | struct nd_namespace_pmem *nspm = to_nd_namespace_pmem(dev); | 972 | struct nd_namespace_pmem *nspm = to_nd_namespace_pmem(dev); |
973 | 973 | ||
974 | uuid = nspm->uuid; | 974 | uuid = nspm->uuid; |
975 | id = nspm->id; | ||
975 | } else if (is_namespace_blk(dev)) { | 976 | } else if (is_namespace_blk(dev)) { |
976 | struct nd_namespace_blk *nsblk = to_nd_namespace_blk(dev); | 977 | struct nd_namespace_blk *nsblk = to_nd_namespace_blk(dev); |
977 | 978 | ||
978 | uuid = nsblk->uuid; | 979 | uuid = nsblk->uuid; |
979 | flags = NSLABEL_FLAG_LOCAL; | 980 | flags = NSLABEL_FLAG_LOCAL; |
981 | id = nsblk->id; | ||
980 | } | 982 | } |
981 | 983 | ||
982 | /* | 984 | /* |
@@ -1039,10 +1041,11 @@ static ssize_t __size_store(struct device *dev, unsigned long long val) | |||
1039 | 1041 | ||
1040 | /* | 1042 | /* |
1041 | * Try to delete the namespace if we deleted all of its | 1043 | * Try to delete the namespace if we deleted all of its |
1042 | * allocation, this is not the seed device for the region, and | 1044 | * allocation, this is not the seed or 0th device for the |
1043 | * it is not actively claimed by a btt instance. | 1045 | * region, and it is not actively claimed by a btt, pfn, or dax |
1046 | * instance. | ||
1044 | */ | 1047 | */ |
1045 | if (val == 0 && nd_region->ns_seed != dev && !ndns->claim) | 1048 | if (val == 0 && id != 0 && nd_region->ns_seed != dev && !ndns->claim) |
1046 | nd_device_unregister(dev, ND_ASYNC); | 1049 | nd_device_unregister(dev, ND_ASYNC); |
1047 | 1050 | ||
1048 | return rc; | 1051 | return rc; |