Skip to contentSkip to conversation

Patch "pmem: return EIO on read_pmem() failure" has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Jul 3, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

pmem: return EIO on read_pmem() failure

to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
pmem-return-eio-on-read_pmem-failure.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Mon Jul 3 13:33:55 CEST 2017

From: Stefan Hajnoczi <[email protected]>
Date: Thu, 5 Jan 2017 10:05:46 +0000
Subject: pmem: return EIO on read_pmem() failure

From: Stefan Hajnoczi <[email protected]>

[ 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.

---
 drivers/nvdimm/pmem.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/nvdimm/pmem.c +3 -1
@@ -87,7 +87,9 @@ static int read_pmem(struct page *page,
 
 	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,

Patches currently in stable-queue which might be from [email protected] are

queue-4.9/pmem-return-eio-on-read_pmem-failure.patch