Skip to content

Commit

Permalink
pmem, dax: disable dax in the presence of bad blocks
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
djbw committed Jan 10, 2016
1 parent e10624f commit 57f7f31
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions block/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions drivers/nvdimm/pmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ static int pmem_attach_disk(struct device *dev,
return -ENOMEM;
nvdimm_namespace_add_poison(ndns, &pmem->bb, pmem->data_offset);

disk->bb = &pmem->bb;
add_disk(disk);
revalidate_disk(disk);

Expand Down

0 comments on commit 57f7f31

Please sign in to comment.