diff options
author | Jeff Moyer <jmoyer@redhat.com> | 2015-08-14 22:15:32 +0200 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2015-09-16 02:08:05 +0200 |
commit | f0b2e563bc419df7c1b3d2f494574c25125f6aed (patch) | |
tree | a9fbfb63817c1bd49115e4a6b2175d617aeb41ff | |
parent | dax: fix O_DIRECT I/O to the last block of a blockdev (diff) | |
download | linux-f0b2e563bc419df7c1b3d2f494574c25125f6aed.tar.xz linux-f0b2e563bc419df7c1b3d2f494574c25125f6aed.zip |
blockdev: don't set S_DAX for misaligned partitions
The dax code doesn't currently support misaligned partitions,
so disable O_DIRECT via dax until such time as that support
materializes.
Cc: <stable@vger.kernel.org>
Suggested-by: Boaz Harrosh <boaz@plexistor.com>
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
-rw-r--r-- | fs/block_dev.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c index 22ea424ee741..073bb57adab1 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -1242,6 +1242,13 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) goto out_clear; } bd_set_size(bdev, (loff_t)bdev->bd_part->nr_sects << 9); + /* + * If the partition is not aligned on a page + * boundary, we can't do dax I/O to it. + */ + if ((bdev->bd_part->start_sect % (PAGE_SIZE / 512)) || + (bdev->bd_part->nr_sects % (PAGE_SIZE / 512))) + bdev->bd_inode->i_flags &= ~S_DAX; } } else { if (bdev->bd_contains == bdev) { |