diff options
author | Dan Williams <dan.j.williams@intel.com> | 2016-01-15 16:55:56 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-15 17:56:32 -0800 |
commit | fe683adabfe6629c0b6db32bbbc1ce6cacbf2117 (patch) | |
tree | 16798d03701b19665bcfcdfdf7796c4b52641242 | |
parent | 0e749e54244eec87b2a3cd0a4314e60bc6781115 (diff) | |
download | op-kernel-dev-fe683adabfe6629c0b6db32bbbc1ce6cacbf2117.zip op-kernel-dev-fe683adabfe6629c0b6db32bbbc1ce6cacbf2117.tar.gz |
dax: guarantee page aligned results from bdev_direct_access()
If a ->direct_access() implementation ever returns a map count less than
PAGE_SIZE, catch the error in bdev_direct_access(). This simplifies
error checking in upper layers.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Reported-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | fs/block_dev.c | 2 | ||||
-rw-r--r-- | fs/dax.c | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c index 81c0705..ddc6cdd 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -494,6 +494,8 @@ long bdev_direct_access(struct block_device *bdev, sector_t sector, avail = ops->direct_access(bdev, sector, addr, pfn); if (!avail) return -ERANGE; + if (avail > 0 && avail & ~PAGE_MASK) + return -ENXIO; return min(avail, size); } EXPORT_SYMBOL_GPL(bdev_direct_access); @@ -52,7 +52,6 @@ int dax_clear_blocks(struct inode *inode, sector_t block, long size) sz = min_t(long, count, SZ_128K); clear_pmem(addr, sz); size -= sz; - BUG_ON(sz & 511); sector += sz / 512; cond_resched(); } while (size); |