pmem: fail io-requests to known bad blocks
authorDan Williams <dan.j.williams@intel.com>
Wed, 6 Jan 2016 20:03:41 +0000 (12:03 -0800)
committerDan Williams <dan.j.williams@intel.com>
Sat, 9 Jan 2016 16:39:04 +0000 (08:39 -0800)
commite10624f8c09710b3b0740ea3847627ea02f55c39
treeab59f8d9dbb5ca7e7d2771e0b5f8bf0cbf935553
parentb95f5f4391fad65f1819c2404080b05ca95bdd92
pmem: fail io-requests to known bad blocks

Check the sectors specified in a read bio to see if they hit a known bad
block, and return an error code pmem_do_bvec().

Note that the ->rw_page() is not in a position to return errors.  For
now, copy the same layering violation present in zram_rw_page() to avoid
crashes of the form:

 kernel BUG at mm/filemap.c:822!
 [..]
 Call Trace:
  [<ffffffff811c540e>] page_endio+0x1e/0x60
  [<ffffffff81290d29>] mpage_end_io+0x39/0x60
  [<ffffffff8141c4ef>] bio_endio+0x3f/0x60
  [<ffffffffa005c491>] pmem_make_request+0x111/0x230 [nd_pmem]

...i.e. unlock a page that was already unlocked via pmem_rw_page() =>
page_endio().

Reported-by: Vishal Verma <vishal.l.verma@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/nvdimm/pmem.c