diff options
author | Jeff Moyer <jmoyer@redhat.com> | 2015-08-14 16:15:31 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2015-09-15 20:07:35 -0400 |
commit | e94f5a2285fc94202a9efb2c687481f29b64132c (patch) | |
tree | 2cb07ecaaaf15389bad53415ecf7c6143f07a9fa /fs/dax.c | |
parent | 6ff33f3902c3b1c5d0db6b1e2c70b6d76fba357f (diff) | |
download | linux-rpi-e94f5a2285fc94202a9efb2c687481f29b64132c.tar.gz linux-rpi-e94f5a2285fc94202a9efb2c687481f29b64132c.tar.bz2 linux-rpi-e94f5a2285fc94202a9efb2c687481f29b64132c.zip |
dax: fix O_DIRECT I/O to the last block of a blockdev
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.
Cc: <stable@vger.kernel.org>
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>
Diffstat (limited to 'fs/dax.c')
-rw-r--r-- | fs/dax.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -119,7 +119,8 @@ static ssize_t dax_io(struct inode *inode, struct iov_iter *iter, size_t 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; |