diff options
author | Jeff Moyer <jmoyer@redhat.com> | 2015-08-14 16:15:31 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-10-22 14:49:17 -0700 |
commit | fda7e543449bf0fde30464e8005dba8f1af36a2d (patch) | |
tree | f93c83812c19fa92b2be0de9eff23b6e57a9e7ad /fs | |
parent | 47365d694f3bc4da33923aca12836b378caf4017 (diff) |
dax: fix O_DIRECT I/O to the last block of a blockdev
commit e94f5a2285fc94202a9efb2c687481f29b64132c upstream.
commit bbab37ddc20b (block: Add support for DAX reads/writes to
block devices) caused a regression in mkfs.xfs. That utility
sets the block size of the device to the logical block size
using the BLKBSZSET ioctl, and then issues a single sector read
from the last sector of the device. This results in the dax_io
code trying to do a page-sized read from 512 bytes from the end
of the device. The result is -ERANGE being returned to userspace.
The fix is to align the block to the page size before calling
get_block.
Thanks to willy for simplifying my original patch.
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Tested-by: Linda Knippers <linda.knippers@hp.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/dax.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -116,7 +116,8 @@ static ssize_t dax_io(struct inode *inode, struct iov_iter *iter, unsigned len; if (pos == max) { unsigned blkbits = inode->i_blkbits; - sector_t block = pos >> blkbits; + long page = pos >> PAGE_SHIFT; + sector_t block = page << (PAGE_SHIFT - blkbits); unsigned first = pos - (block << blkbits); long size; |