diff options
author | Stefan Hajnoczi <stefanha@redhat.com> | 2017-01-05 10:05:46 +0000 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2017-01-12 16:40:29 -0800 |
commit | d47d1d27fd6206c18806440f6ebddf51a806be4f (patch) | |
tree | 5aa1994533c4f587b61a9123cf78e52cfe2bbea6 /drivers/nvdimm/pmem.c | |
parent | a121103c922847ba5010819a3f250f1f7fc84ab8 (diff) | |
download | linux-d47d1d27fd6206c18806440f6ebddf51a806be4f.tar.bz2 |
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.
This fixes compatibility with consumers like btrfs that try to parse the
specific error code rather than treat all errors the same.
Reviewed-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/nvdimm/pmem.c')
-rw-r--r-- | drivers/nvdimm/pmem.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c index 7282d7495bf1..5b536be5a12e 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, |