aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Jiang <dave.jiang@intel.com>2016-09-09 12:10:08 -0400
committerDan Williams <dan.j.williams@intel.com>2016-09-09 20:34:46 -0400
commit1e8b8d9619f9476e94f32eb20cab000d50d236aa (patch)
tree916ab96acbdc05f548e85b3897be7167276b3e4f
parent2e21807d4b131dfd4a8e5c82116a85b62f28aeec (diff)
libnvdimm: allow legacy (e820) pmem region to clear bad blocks
Bad blocks can be injected via /sys/block/pmemN/badblocks. In a situation where legacy pmem is being used or a pmem region created by using memmap kernel parameter, the injected bad blocks are not cleared due to nvdimm_clear_poison() failing from lack of ndctl function pointer. In this case we need to just return as handled and allow the bad blocks to be cleared rather than fail. Reviewed-by: Vishal Verma <vishal.l.verma@intel.com> Signed-off-by: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
-rw-r--r--drivers/nvdimm/bus.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c
index 458daf927336..935866fe5ec2 100644
--- a/drivers/nvdimm/bus.c
+++ b/drivers/nvdimm/bus.c
@@ -185,8 +185,12 @@ long nvdimm_clear_poison(struct device *dev, phys_addr_t phys,
185 return -ENXIO; 185 return -ENXIO;
186 186
187 nd_desc = nvdimm_bus->nd_desc; 187 nd_desc = nvdimm_bus->nd_desc;
188 /*
189 * if ndctl does not exist, it's PMEM_LEGACY and
190 * we want to just pretend everything is handled.
191 */
188 if (!nd_desc->ndctl) 192 if (!nd_desc->ndctl)
189 return -ENXIO; 193 return len;
190 194
191 memset(&ars_cap, 0, sizeof(ars_cap)); 195 memset(&ars_cap, 0, sizeof(ars_cap));
192 ars_cap.address = phys; 196 ars_cap.address = phys;