pmem: return EIO on read_pmem() failure
PATCH 1/1 pmem: return EIO on read_pmem() failure
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.
--- drivers/nvdimm/pmem.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/nvdimm/pmem.c +3 -1
@@ -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,
Signature · 1 line
2.9.3
A message that is not in the archive (sent off-list or not yet received): 20170105100546.11379-1-stefanha-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Jeff Moyer
Reviewed-byQuoted 4 lines · Stefan Hajnoczi
The
read_pmem()function usesmemcpy_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.
Quoted 21 lines
Cc Dan Williams <[email protected]>Signed-off-by Stefan Hajnoczi <[email protected]>--- drivers/nvdimm/pmem.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/nvdimm/pmem.c +3
-1@@ -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,