Skip to content

Commit 1e8b8d9

Browse files
davejiangdjbw
authored andcommitted
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 <[email protected]> Signed-off-by: Dave Jiang <[email protected]> Signed-off-by: Dan Williams <[email protected]>
1 parent 2e21807 commit 1e8b8d9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/nvdimm/bus.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,12 @@ long nvdimm_clear_poison(struct device *dev, phys_addr_t phys,
185185
return -ENXIO;
186186

187187
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+
*/
188192
if (!nd_desc->ndctl)
189-
return -ENXIO;
193+
return len;
190194

191195
memset(&ars_cap, 0, sizeof(ars_cap));
192196
ars_cap.address = phys;

0 commit comments

Comments
 (0)