Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8eaaf66d authored by Stefan Hajnoczi's avatar Stefan Hajnoczi Committed by Greg Kroah-Hartman
Browse files

pmem: return EIO on read_pmem() failure




[ Upstream commit d47d1d27fd6206c18806440f6ebddf51a806be4f ]

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: default avatarJeff Moyer <jmoyer@redhat.com>
Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 25319ae8
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -87,7 +87,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,