aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2016-01-06 15:03:42 -0500
committerDan Williams <dan.j.williams@intel.com>2016-01-10 01:42:31 -0500
commit57f7f317abdd07954cb116280c88d18378afb33e (patch)
tree8f39a9ea74d7babfbccfd0bcafc01e0e284499f4
parente10624f8c09710b3b0740ea3847627ea02f55c39 (diff)
pmem, dax: disable dax in the presence of bad blocks
Longer term teach dax to punch "error" holes in mapping requests and deliver SIGBUS to applications that consume a bad pmem page. For now, simply disable the dax performance optimization in the presence of known errors. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
-rw-r--r--block/ioctl.c10
-rw-r--r--drivers/nvdimm/pmem.c1
2 files changed, 11 insertions, 0 deletions
diff --git a/block/ioctl.c b/block/ioctl.c
index 7a964d842913..2c84683aada5 100644
--- a/block/ioctl.c
+++ b/block/ioctl.c
@@ -4,6 +4,7 @@
4#include <linux/gfp.h> 4#include <linux/gfp.h>
5#include <linux/blkpg.h> 5#include <linux/blkpg.h>
6#include <linux/hdreg.h> 6#include <linux/hdreg.h>
7#include <linux/badblocks.h>
7#include <linux/backing-dev.h> 8#include <linux/backing-dev.h>
8#include <linux/fs.h> 9#include <linux/fs.h>
9#include <linux/blktrace_api.h> 10#include <linux/blktrace_api.h>
@@ -422,6 +423,15 @@ bool blkdev_dax_capable(struct block_device *bdev)
422 || (bdev->bd_part->nr_sects % (PAGE_SIZE / 512))) 423 || (bdev->bd_part->nr_sects % (PAGE_SIZE / 512)))
423 return false; 424 return false;
424 425
426 /*
427 * If the device has known bad blocks, force all I/O through the
428 * driver / page cache.
429 *
430 * TODO: support finer grained dax error handling
431 */
432 if (disk->bb && disk->bb->count)
433 return false;
434
425 return true; 435 return true;
426} 436}
427 437
diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c
index d00c659d1304..6a1832b3983c 100644
--- a/drivers/nvdimm/pmem.c
+++ b/drivers/nvdimm/pmem.c
@@ -233,6 +233,7 @@ static int pmem_attach_disk(struct device *dev,
233 return -ENOMEM; 233 return -ENOMEM;
234 nvdimm_namespace_add_poison(ndns, &pmem->bb, pmem->data_offset); 234 nvdimm_namespace_add_poison(ndns, &pmem->bb, pmem->data_offset);
235 235
236 disk->bb = &pmem->bb;
236 add_disk(disk); 237 add_disk(disk);
237 revalidate_disk(disk); 238 revalidate_disk(disk);
238 239