On Thu, 2016-09-08 at 16:33 -0700, Dave Jiang wrote:
> 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.
> 
> Signed-off-by: Dave Jiang <[email protected]>
> ---
>  drivers/nvdimm/bus.c |    6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)

Looks good to me!
Reveiewed-by: Vishal Verma <[email protected]>

> 
> diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c
> index 458daf9..935866f 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,
>               return -ENXIO;
>  
>       nd_desc = nvdimm_bus->nd_desc;
> +     /*
> +      * if ndctl does not exist, it's PMEM_LEGACY and
> +      * we want to just pretend everything is handled.
> +      */
>       if (!nd_desc->ndctl)
> -             return -ENXIO;
> +             return len;
>  
>       memset(&ars_cap, 0, sizeof(ars_cap));
>       ars_cap.address = phys;
> 
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

Reply via email to