提交 fe683ada 编写于 作者: D Dan Williams 提交者: Linus Torvalds

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: NDan Williams <dan.j.williams@intel.com>
Reported-by: NRoss Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 0e749e54
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册