[GIT PULL] libnvdimm fixes for 4.9-rc3

From: Williams, Dan J
Date: Fri Oct 28 2016 - 14:20:51 EST


Hi Linus, please pull from:

git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm libnvdimm-fixes

...to receive:

A compilation fix, a NULL de-reference found by static analysis, a
misuse of the percpu+AF8-ref+AF8-exit() (tagged for -stable), and notification
of failed attempts to clear media errors.

These patches have received a build success notification from the 0day-
kbuild-robot and appeared in next-20161028.

---

The following changes since commit 1001354ca34179f3db924eb66672442a173147dc:

Linux 4.9-rc1 (2016-10-15 12:17:50 -0700)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm libnvdimm-fixes

for you to fetch changes up to 52e73eb2872c9af6f382b2b22954ca8214397a4e:

device-dax: fix percpu+AF8-ref+AF8-exit ordering (2016-10-27 17:04:05 -0700)

----------------------------------------------------------------
Arnd Bergmann (1):
nvdimm: make CONFIG+AF8-NVDIMM+AF8-DAX 'bool'

Dan Carpenter (1):
libnvdimm, namespace: potential NULL deref on allocation error

Dan Williams (1):
device-dax: fix percpu+AF8-ref+AF8-exit ordering

Toshi Kani (1):
pmem: report error on clear poison failure

drivers/dax/Kconfig +AHw- 2 +--
drivers/dax/pmem.c +AHw- 2 +--
drivers/nvdimm/Kconfig +AHw- 2 +--
drivers/nvdimm/namespace+AF8-devs.c +AHw- 14 +-+-+-+-+-+-+-+-------
drivers/nvdimm/pmem.c +AHw- 8 +-+-+-+-+-+---
5 files changed, 17 insertions(+-), 11 deletions(-)

---

commit 75d29713b792da4782cadfaa87e802183440694e
Author: Dan Carpenter +ADw-dan.carpenter+AEA-oracle.com+AD4-
Date: Wed Oct 12 09:34:29 2016 +-0300

libnvdimm, namespace: potential NULL deref on allocation error

If the kcalloc() fails then +ACI-devs+ACI- can be NULL and we dereference it
checking +ACI-devs+AFs-i+AF0AIg-.

Fixes: 1b40e09a1232 ('libnvdimm: blk labels and namespace instantiation')
Signed-off-by: Dan Carpenter +ADw-dan.carpenter+AEA-oracle.com+AD4-
Signed-off-by: Dan Williams +ADw-dan.j.williams+AEA-intel.com+AD4-

commit 3115bb02b5c23d960df5f1bf551ec394a9bb10ec
Author: Toshi Kani +ADw-toshi.kani+AEA-hpe.com+AD4-
Date: Thu Oct 13 09:54:21 2016 -0600

pmem: report error on clear poison failure

ACPI Clear Uncorrectable Error DSM function may fail or may be
unsupported on a platform. pmem+AF8-clear+AF8-poison() returns without clearing
badblocks in such cases. This failure is detected at the next read
(-EIO).

This behavior can lead to an issue when user keeps writing but does not
read immediately. For instance, flight recorder file may be only read
when it is necessary for troubleshooting.

Change pmem+AF8-do+AF8-bvec() and pmem+AF8-clear+AF8-poison() to return -EIO so that
filesystem can log an error message on a write error.

Cc: Vishal Verma +ADw-vishal.l.verma+AEA-intel.com+AD4-
Signed-off-by: Toshi Kani +ADw-toshi.kani+AEA-hpe.com+AD4-
Signed-off-by: Dan Williams +ADw-dan.j.williams+AEA-intel.com+AD4-

commit 867dfe342118b1ea0256a85f7c0d9ceb0ead032a
Author: Arnd Bergmann +ADw-arnd+AEA-arndb.de+AD4-
Date: Tue Oct 25 17:52:04 2016 +-0200

nvdimm: make CONFIG+AF8-NVDIMM+AF8-DAX 'bool'

A bugfix just tried to address a randconfig build problem and introduced
a variant of the same problem: with CONFIG+AF8-LIBNVDIMM+AD0-y and
CONFIG+AF8-NVDIMM+AF8-DAX+AD0-m, the nvdimm module now fails to link:

drivers/nvdimm/built-in.o: In function +AGA-to+AF8-nd+AF8-device+AF8-type':
bus.c:(.text+-0x1b5d): undefined reference to +AGA-is+AF8-nd+AF8-dax'
drivers/nvdimm/built-in.o: In function +AGA-nd+AF8-region+AF8-notify+AF8-driver+AF8-action.constprop.2':
region+AF8-devs.c:(.text+-0x6b6c): undefined reference to +AGA-is+AF8-nd+AF8-dax'
region+AF8-devs.c:(.text+-0x6b8c): undefined reference to +AGA-to+AF8-nd+AF8-dax'
drivers/nvdimm/built-in.o: In function +AGA-nd+AF8-region+AF8-probe':
region.c:(.text+-0x70f3): undefined reference to +AGA-nd+AF8-dax+AF8-create'
drivers/nvdimm/built-in.o: In function +AGA-mode+AF8-show':
namespace+AF8-devs.c:(.text+-0xa196): undefined reference to +AGA-is+AF8-nd+AF8-dax'
drivers/nvdimm/built-in.o: In function +AGA-nvdimm+AF8-namespace+AF8-common+AF8-probe':
(.text+-0xa55f): undefined reference to +AGA-is+AF8-nd+AF8-dax'
drivers/nvdimm/built-in.o: In function +AGA-nvdimm+AF8-namespace+AF8-common+AF8-probe':
(.text+-0xa56e): undefined reference to +AGA-to+AF8-nd+AF8-dax'

This reverts the earlier fix, making NVDIMM+AF8-DAX a 'bool' option again
as it should be (it gets linked into the libnvdimm module). To fix
the original problem, I'm adding a dependency on LIBNVDIMM to
DEV+AF8-DAX+AF8-PMEM, which ensures we can't have that one built-in if the
rest is a module.

Fixes: 4e65e9381c7a (+ACI-/dev/dax: fix Kconfig dependency build breakage+ACI-)
Signed-off-by: Arnd Bergmann +ADw-arnd+AEA-arndb.de+AD4-
Reviewed-by: Ross Zwisler +ADw-ross.zwisler+AEA-linux.intel.com+AD4-
Signed-off-by: Dan Williams +ADw-dan.j.williams+AEA-intel.com+AD4-

commit 52e73eb2872c9af6f382b2b22954ca8214397a4e
Author: Dan Williams +ADw-dan.j.williams+AEA-intel.com+AD4-
Date: Thu Oct 27 17:04:05 2016 -0700

device-dax: fix percpu+AF8-ref+AF8-exit ordering

We need to wait until the percpu+AF8-ref is released before exit. Otherwise,
we sometimes lose the race and trigger this new warning that was added
in v4.9 (commit a67823c1ed10 +ACI-percpu-refcount: init -+AD4-confirm+AF8-switch
member properly+ACI-):

WARNING: CPU: 0 PID: 3629 at lib/percpu-refcount.c:107 percpu+AF8-ref+AF8-exit+-0x51/0x60
+AFs-..+AF0-
Call Trace:
+AFsAPA-ffffffff814bf093+AD4AXQ- dump+AF8-stack+-0x85/0xc2
+AFsAPA-ffffffff810b15db+AD4AXQ- +AF8AXw-warn+-0xcb/0xf0
+AFsAPA-ffffffff810b170d+AD4AXQ- warn+AF8-slowpath+AF8-null+-0x1d/0x20
+AFsAPA-ffffffff814d70c1+AD4AXQ- percpu+AF8-ref+AF8-exit+-0x51/0x60
+AFsAPA-ffffffffa005706a+AD4AXQ- dax+AF8-pmem+AF8-percpu+AF8-exit+-0x1a/0x50 +AFs-dax+AF8-pmem+AF0-
+AFsAPA-ffffffff81615f1f+AD4AXQ- devm+AF8-action+AF8-release+-0xf/0x20

Cc: +ADw-stable+AEA-vger.kernel.org+AD4-
Fixes: ab68f2622136 (+ACI-/dev/dax, pmem: direct access to persistent memory+ACI-)
Signed-off-by: Dan Williams +ADw-dan.j.williams+AEA-intel.com+AD4-