Stefan Hajnoczi <stefa...@redhat.com> writes: > The read_pmem() function uses memcpy_mcsafe() on x86 where an EFAULT > error code indicates a failed read. Block I/O should use EIO to > indicate failure. Other pmem code paths (like bad blocks) already use > EIO so let's be consistent.
I agree that it's the right thing to return, though right now it probably doesn't matter. As Dan said, all paths leading back to userspace interpret any non-zero value as EIO. Reviewed-by: Jeff Moyer <jmo...@redhat.com> > Cc: Dan Williams <dan.j.willi...@intel.com> > Signed-off-by: Stefan Hajnoczi <stefa...@redhat.com> > --- > drivers/nvdimm/pmem.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c > index 7282d74..5b536be 100644 > --- a/drivers/nvdimm/pmem.c > +++ b/drivers/nvdimm/pmem.c > @@ -90,7 +90,9 @@ static int read_pmem(struct page *page, unsigned int off, > > rc = memcpy_from_pmem(mem + off, pmem_addr, len); > kunmap_atomic(mem); > - return rc; > + if (rc) > + return -EIO; > + return 0; > } > > static int pmem_do_bvec(struct pmem_device *pmem, struct page *page, _______________________________________________ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm