Skip to content

Commit b90ca5c

Browse files
Matthew Wilcoxdjbw
authored andcommitted
filesystem-dax: Fix use of zero page
Use my_zero_pfn instead of ZERO_PAGE(), and pass the vaddr to it instead of zero so it works on MIPS and s390 who reference the vaddr to select a zero page. Cc: <stable@vger.kernel.org> Fixes: 91d25ba ("dax: use common 4k zero page for dax mmap reads") Signed-off-by: Matthew Wilcox <willy@infradead.org> Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent 11da3a7 commit b90ca5c

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

fs/dax.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,21 +1120,12 @@ static vm_fault_t dax_load_hole(struct address_space *mapping, void *entry,
11201120
{
11211121
struct inode *inode = mapping->host;
11221122
unsigned long vaddr = vmf->address;
1123-
vm_fault_t ret = VM_FAULT_NOPAGE;
1124-
struct page *zero_page;
1125-
pfn_t pfn;
1126-
1127-
zero_page = ZERO_PAGE(0);
1128-
if (unlikely(!zero_page)) {
1129-
ret = VM_FAULT_OOM;
1130-
goto out;
1131-
}
1123+
pfn_t pfn = pfn_to_pfn_t(my_zero_pfn(vaddr));
1124+
vm_fault_t ret;
11321125

1133-
pfn = page_to_pfn_t(zero_page);
11341126
dax_insert_mapping_entry(mapping, vmf, entry, pfn, RADIX_DAX_ZERO_PAGE,
11351127
false);
11361128
ret = vmf_insert_mixed(vmf->vma, vaddr, pfn);
1137-
out:
11381129
trace_dax_load_hole(inode, vmf, ret);
11391130
return ret;
11401131
}

0 commit comments

Comments
 (0)