Skip to content

Commit

Permalink
filesystem-dax: fix broken __dax_zero_page_range() conversion
Browse files Browse the repository at this point in the history
The conversion of __dax_zero_page_range() to 'struct dax_operations'
caused it to frequently fail. The mistake was treating the @SiZe
parameter as a dax mapping length rather than just a length of the
clear_pmem() operation. The dax mapping length is assumed to be hard
coded as PAGE_SIZE.

Without this fix any page unaligned zeroing request will trigger a
-EINVAL return from bdev_dax_pgoff().

Cc: Jan Kara <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Reported-by: Ross Zwisler <[email protected]>
Tested-by: Ross Zwisler <[email protected]>
Fixes: cccbce6 ("filesystem-dax: convert to dax_direct_access()")
Signed-off-by: Dan Williams <[email protected]>
  • Loading branch information
djbw committed May 11, 2017
1 parent b177fe8 commit e84b83b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/dax.c
Original file line number Diff line number Diff line change
Expand Up @@ -971,12 +971,12 @@ int __dax_zero_page_range(struct block_device *bdev,
void *kaddr;
pfn_t pfn;

rc = bdev_dax_pgoff(bdev, sector, size, &pgoff);
rc = bdev_dax_pgoff(bdev, sector, PAGE_SIZE, &pgoff);
if (rc)
return rc;

id = dax_read_lock();
rc = dax_direct_access(dax_dev, pgoff, PHYS_PFN(size), &kaddr,
rc = dax_direct_access(dax_dev, pgoff, 1, &kaddr,
&pfn);
if (rc < 0) {
dax_read_unlock(id);
Expand Down

0 comments on commit e84b83b

Please sign in to comment.