> -----Original Message-----
> From: Linux-nvdimm [mailto:[email protected]] On
> Behalf Of Dan Williams
> Sent: Wednesday, November 09, 2016 6:55 PM
> To: Vishal Verma <[email protected]>
> Cc: [email protected]
> Subject: Re: [PATCH] libnvdimm: check and clear poison before writing
> to pmem
...
> >> @@ -233,12 +234,27 @@ static int nsio_rw_bytes(struct
> nd_namespace_common *ndns,
> >
> >> +                             int rc;
> >> +
> >> +                             rc = nvdimm_clear_poison(&ndns->dev, offset,
> >> +                                                      size);
> >> +                             if (rc != size)
> >> +                                     return -EIO;
> >
> > I'm not sure of this myself - perhaps a question to Dan -
> > Is it safe to return EIO here? We have potentially cleared some
> > poison, and lost some data, but subsequent reads will not indicate
> > any errors, returning either 0s or something unpredictable. Would
> > it be better to simply go ahead with the write even if we weren't
> > able to clear the whole range?
> 
> Good point, the interface allows partial completions, so it's
> reasonable to go write what we were able to clear.  However that only
> shrinks the exposure not eliminate it since we could immediately
> crash for some other reason before the write completes.
> 
> We would [like] an error clearing interface that had deterministic data
> after clearing to do something better, but I can get on board with
> writing new data after a partial completion.

You should call badblocks_clear for the blocks for which uncorrectable
errors were successfully cleared.  Future writes constrained to that
area will work fine.

nsio_rw_bytes doesn't return how many bytes were successfully written,
so I don't think doing a partial memcpy_to_pmem would be helpful.


---
Robert Elliott, HPE Persistent Memory



_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

Reply via email to