summaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2016-01-06 12:03:42 -0800
committerDan Williams <dan.j.williams@intel.com>2016-01-09 22:42:31 -0800
commit57f7f317abdd07954cb116280c88d18378afb33e (patch)
tree8f39a9ea74d7babfbccfd0bcafc01e0e284499f4 /block
parente10624f8c09710b3b0740ea3847627ea02f55c39 (diff)
downloadlinux-stable-57f7f317abdd07954cb116280c88d18378afb33e.tar.gz
linux-stable-57f7f317abdd07954cb116280c88d18378afb33e.tar.bz2
linux-stable-57f7f317abdd07954cb116280c88d18378afb33e.zip
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>
Diffstat (limited to 'block')
-rw-r--r--block/ioctl.c10
1 files changed, 10 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 @@
#include <linux/gfp.h>
#include <linux/blkpg.h>
#include <linux/hdreg.h>
+#include <linux/badblocks.h>
#include <linux/backing-dev.h>
#include <linux/fs.h>
#include <linux/blktrace_api.h>
@@ -422,6 +423,15 @@ bool blkdev_dax_capable(struct block_device *bdev)
|| (bdev->bd_part->nr_sects % (PAGE_SIZE / 512)))
return false;
+ /*
+ * If the device has known bad blocks, force all I/O through the
+ * driver / page cache.
+ *
+ * TODO: support finer grained dax error handling
+ */
+ if (disk->bb && disk->bb->count)
+ return false;
+
return true;
}