summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJeff Moyer <jmoyer@redhat.com>2015-08-14 16:15:32 -0400
committerDan Williams <dan.j.williams@intel.com>2015-09-15 20:08:05 -0400
commitf0b2e563bc419df7c1b3d2f494574c25125f6aed (patch)
treea9fbfb63817c1bd49115e4a6b2175d617aeb41ff /fs
parente94f5a2285fc94202a9efb2c687481f29b64132c (diff)
downloadlinux-stable-f0b2e563bc419df7c1b3d2f494574c25125f6aed.tar.gz
linux-stable-f0b2e563bc419df7c1b3d2f494574c25125f6aed.tar.bz2
linux-stable-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>
Diffstat (limited to 'fs')
-rw-r--r--fs/block_dev.c7
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) {