WSL2-Linux-Kernel/drivers/nvdimm
Dan Williams 4aa5615e08 libnvdimm: band aid btt vs clear poison locking
The following warning results from holding a lane spinlock,
preempt_disable(), or the btt map spinlock and then trying to take the
reconfig_mutex to walk the poison list and potentially add new entries.

 BUG: sleeping function called from invalid context at kernel/locking/mutex.c:747
 in_atomic(): 1, irqs_disabled(): 0, pid: 17159, name: dd
 [..]
 Call Trace:
  dump_stack+0x85/0xc8
  ___might_sleep+0x184/0x250
  __might_sleep+0x4a/0x90
  __mutex_lock+0x58/0x9b0
  ? nvdimm_bus_lock+0x21/0x30 [libnvdimm]
  ? __nvdimm_bus_badblocks_clear+0x2f/0x60 [libnvdimm]
  ? acpi_nfit_forget_poison+0x79/0x80 [nfit]
  ? _raw_spin_unlock+0x27/0x40
  mutex_lock_nested+0x1b/0x20
  nvdimm_bus_lock+0x21/0x30 [libnvdimm]
  nvdimm_forget_poison+0x25/0x50 [libnvdimm]
  nvdimm_clear_poison+0x106/0x140 [libnvdimm]
  nsio_rw_bytes+0x164/0x270 [libnvdimm]
  btt_write_pg+0x1de/0x3e0 [nd_btt]
  ? blk_queue_enter+0x30/0x290
  btt_make_request+0x11a/0x310 [nd_btt]
  ? blk_queue_enter+0xb7/0x290
  ? blk_queue_enter+0x30/0x290
  generic_make_request+0x118/0x3b0

As a minimal fix, disable error clearing when the BTT is enabled for the
namespace. For the final fix a larger rework of the poison list locking
is needed.

Note that this is not a problem in the blk case since that path never
calls nvdimm_clear_poison().

Cc: <stable@vger.kernel.org>
Fixes: 82bf1037f2 ("libnvdimm: check and clear poison before writing to pmem")
Cc: Dave Jiang <dave.jiang@intel.com>
[jeff: dynamically disable error clearing in the btt case]
Suggested-by: Jeff Moyer <jmoyer@redhat.com>
Reviewed-by: Jeff Moyer <jmoyer@redhat.com>
Reported-by: Vishal Verma <vishal.l.verma@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2017-04-10 17:21:45 -07:00
..
Kconfig Linux 4.9-rc4 2016-11-18 16:13:41 -07:00
Makefile
blk.c
btt.c nvdimm, btt: add a size attribute for BTTs 2016-08-08 09:26:14 -07:00
btt.h
btt_devs.c nvdimm, btt: add a size attribute for BTTs 2016-08-08 09:26:14 -07:00
bus.c libnvdimm: fix reconfig_mutex, mmap_sem, and jbd2_handle lockdep splat 2017-04-10 17:21:45 -07:00
claim.c libnvdimm: band aid btt vs clear poison locking 2017-04-10 17:21:45 -07:00
core.c libnvdimm: use generic iostat interfaces 2016-10-19 08:53:26 -07:00
dax_devs.c
dimm.c libnvdimm: allow a platform to force enable label support 2016-10-19 08:57:33 -07:00
dimm_devs.c libnvdimm: fix blk free space accounting 2017-04-04 15:08:36 -07:00
e820.c libnvdimm, e820: use module_platform_driver 2016-12-05 08:52:21 -08:00
label.c nvdimm: use the right length of "pmem" 2016-11-11 20:37:42 -08:00
label.h
namespace_devs.c nfit, libnvdimm: fix interleave set cookie calculation 2017-03-01 00:49:42 -08:00
nd-core.h libnvdimm, namespace: allow creation of multiple pmem-namespaces per region 2016-10-07 09:22:53 -07:00
nd.h nfit, libnvdimm: fix interleave set cookie calculation 2017-03-01 00:49:42 -08:00
pfn.h
pfn_devs.c libnvdimm, pfn: fix memmap reservation size versus 4K alignment 2017-02-04 14:47:31 -08:00
pmem.c pmem: return EIO on read_pmem() failure 2017-01-12 16:40:29 -08:00
pmem.h
region.c
region_devs.c nfit, libnvdimm: fix interleave set cookie calculation 2017-03-01 00:49:42 -08:00