stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] nfit, libnvdimm, pmem: clear poison support
@ 2016-03-08 22:47 Dan Williams
  2016-03-08 22:47 ` [PATCH 2/3] libnvdimm, pmem: fix kmap_atomic() leak in error path Dan Williams
  2016-03-09 23:05 ` [PATCH 0/3] nfit, libnvdimm, pmem: clear poison support Verma, Vishal L
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Williams @ 2016-03-08 22:47 UTC (permalink / raw)
  To: linux-nvdimm
  Cc: Vishal Verma, x86, linux-kernel, stable, linux-acpi, Ross Zwisler

ACPI 6.1 introduces the ability to send "clear error" commands to the
ACPI0012:00 device representing the root of an "nvdimm bus".

Similar to relocating a bad block on a disk, this support clears
media errors in response to a write.

---

Dan Williams (3):
      nfit, libnvdimm: clear poison command support
      libnvdimm, pmem: fix kmap_atomic() leak in error path
      libnvdimm, pmem: clear poison on write


 arch/x86/include/asm/pmem.h      |    5 +++
 drivers/acpi/nfit.c              |   12 ++++++-
 drivers/nvdimm/bus.c             |   65 ++++++++++++++++++++++++++++++++++++++
 drivers/nvdimm/nd.h              |    2 +
 drivers/nvdimm/pmem.c            |   40 ++++++++++++++++++++---
 include/linux/pmem.h             |   19 +++++++++++
 include/uapi/linux/ndctl.h       |   13 ++++++++
 tools/testing/nvdimm/test/nfit.c |   29 +++++++++++++++++
 8 files changed, 179 insertions(+), 6 deletions(-)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/3] libnvdimm, pmem: fix kmap_atomic() leak in error path
  2016-03-08 22:47 [PATCH 0/3] nfit, libnvdimm, pmem: clear poison support Dan Williams
@ 2016-03-08 22:47 ` Dan Williams
  2016-03-09 23:05 ` [PATCH 0/3] nfit, libnvdimm, pmem: clear poison support Verma, Vishal L
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Williams @ 2016-03-08 22:47 UTC (permalink / raw)
  To: linux-nvdimm; +Cc: linux-acpi, Ross Zwisler, linux-kernel, stable

When we enounter a bad block we need to kunmap_atomic() before
returning.

Cc: <stable@vger.kernel.org>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/nvdimm/pmem.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c
index efc2a5e671c6..e7b86a7fca0a 100644
--- a/drivers/nvdimm/pmem.c
+++ b/drivers/nvdimm/pmem.c
@@ -66,22 +66,25 @@ static int pmem_do_bvec(struct pmem_device *pmem, struct page *page,
 			unsigned int len, unsigned int off, int rw,
 			sector_t sector)
 {
+	int rc = 0;
 	void *mem = kmap_atomic(page);
 	phys_addr_t pmem_off = sector * 512 + pmem->data_offset;
 	void __pmem *pmem_addr = pmem->virt_addr + pmem_off;
 
 	if (rw == READ) {
 		if (unlikely(is_bad_pmem(&pmem->bb, sector, len)))
-			return -EIO;
-		memcpy_from_pmem(mem + off, pmem_addr, len);
-		flush_dcache_page(page);
+			rc = -EIO;
+		else {
+			memcpy_from_pmem(mem + off, pmem_addr, len);
+			flush_dcache_page(page);
+		}
 	} else {
 		flush_dcache_page(page);
 		memcpy_to_pmem(pmem_addr, mem + off, len);
 	}
 
 	kunmap_atomic(mem);
-	return 0;
+	return rc;
 }
 
 static blk_qc_t pmem_make_request(struct request_queue *q, struct bio *bio)


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 0/3] nfit, libnvdimm, pmem: clear poison support
  2016-03-08 22:47 [PATCH 0/3] nfit, libnvdimm, pmem: clear poison support Dan Williams
  2016-03-08 22:47 ` [PATCH 2/3] libnvdimm, pmem: fix kmap_atomic() leak in error path Dan Williams
@ 2016-03-09 23:05 ` Verma, Vishal L
  1 sibling, 0 replies; 3+ messages in thread
From: Verma, Vishal L @ 2016-03-09 23:05 UTC (permalink / raw)
  To: Williams, Dan J, linux-nvdimm@lists.01.org
  Cc: linux-kernel@vger.kernel.org, ross.zwisler@linux.intel.com,
	stable@vger.kernel.org, x86@kernel.org,
	linux-acpi@vger.kernel.org

On Tue, 2016-03-08 at 14:47 -0800, Dan Williams wrote:
> ACPI 6.1 introduces the ability to send "clear error" commands to the
> ACPI0012:00 device representing the root of an "nvdimm bus".
> 
> Similar to relocating a bad block on a disk, this support clears
> media errors in response to a write.
> 
> ---
> 
> Dan Williams (3):
>       nfit, libnvdimm: clear poison command support
>       libnvdimm, pmem: fix kmap_atomic() leak in error path
>       libnvdimm, pmem: clear poison on write
> 
> 
>  arch/x86/include/asm/pmem.h      |    5 +++
>  drivers/acpi/nfit.c              |   12 ++++++-
>  drivers/nvdimm/bus.c             |   65
> ++++++++++++++++++++++++++++++++++++++
>  drivers/nvdimm/nd.h              |    2 +
>  drivers/nvdimm/pmem.c            |   40 ++++++++++++++++++++---
>  include/linux/pmem.h             |   19 +++++++++++
>  include/uapi/linux/ndctl.h       |   13 ++++++++
>  tools/testing/nvdimm/test/nfit.c |   29 +++++++++++++++++
>  8 files changed, 179 insertions(+), 6 deletions(-)

Except for the one comment in patch 1, this looks good to me!

For the series,
Reviewed-by: Vishal Verma <vishal.l.verma@intel.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-03-09 23:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-08 22:47 [PATCH 0/3] nfit, libnvdimm, pmem: clear poison support Dan Williams
2016-03-08 22:47 ` [PATCH 2/3] libnvdimm, pmem: fix kmap_atomic() leak in error path Dan Williams
2016-03-09 23:05 ` [PATCH 0/3] nfit, libnvdimm, pmem: clear poison support Verma, Vishal L

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).