Skip to content

Commit cc4a90a

Browse files
Matthew Wilcoxdjbw
authored andcommitted
dax: dax_insert_mapping_entry always succeeds
It does not return an error, so we don't need to check the return value for IS_ERR(). Indeed, it is a bug to do so; with a sufficiently large PFN, a legitimate DAX entry may be mistaken for an error return. Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent d6dc57e commit cc4a90a

1 file changed

Lines changed: 2 additions & 16 deletions

File tree

‎fs/dax.c‎

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,6 @@ static int dax_load_hole(struct address_space *mapping, void *entry,
10091009
unsigned long vaddr = vmf->address;
10101010
int ret = VM_FAULT_NOPAGE;
10111011
struct page *zero_page;
1012-
void *entry2;
10131012
pfn_t pfn;
10141013

10151014
zero_page = ZERO_PAGE(0);
@@ -1019,13 +1018,8 @@ static int dax_load_hole(struct address_space *mapping, void *entry,
10191018
}
10201019

10211020
pfn = page_to_pfn_t(zero_page);
1022-
entry2 = dax_insert_mapping_entry(mapping, vmf, entry, pfn,
1023-
RADIX_DAX_ZERO_PAGE, false);
1024-
if (IS_ERR(entry2)) {
1025-
ret = VM_FAULT_SIGBUS;
1026-
goto out;
1027-
}
1028-
1021+
dax_insert_mapping_entry(mapping, vmf, entry, pfn, RADIX_DAX_ZERO_PAGE,
1022+
false);
10291023
vm_insert_mixed(vmf->vma, vaddr, pfn);
10301024
out:
10311025
trace_dax_load_hole(inode, vmf, ret);
@@ -1337,10 +1331,6 @@ static int dax_iomap_pte_fault(struct vm_fault *vmf, pfn_t *pfnp,
13371331

13381332
entry = dax_insert_mapping_entry(mapping, vmf, entry, pfn,
13391333
0, write && !sync);
1340-
if (IS_ERR(entry)) {
1341-
error = PTR_ERR(entry);
1342-
goto error_finish_iomap;
1343-
}
13441334

13451335
/*
13461336
* If we are doing synchronous page fault and inode needs fsync,
@@ -1424,8 +1414,6 @@ static int dax_pmd_load_hole(struct vm_fault *vmf, struct iomap *iomap,
14241414
pfn = page_to_pfn_t(zero_page);
14251415
ret = dax_insert_mapping_entry(mapping, vmf, entry, pfn,
14261416
RADIX_DAX_PMD | RADIX_DAX_ZERO_PAGE, false);
1427-
if (IS_ERR(ret))
1428-
goto fallback;
14291417

14301418
ptl = pmd_lock(vmf->vma->vm_mm, vmf->pmd);
14311419
if (!pmd_none(*(vmf->pmd))) {
@@ -1547,8 +1535,6 @@ static int dax_iomap_pmd_fault(struct vm_fault *vmf, pfn_t *pfnp,
15471535

15481536
entry = dax_insert_mapping_entry(mapping, vmf, entry, pfn,
15491537
RADIX_DAX_PMD, write && !sync);
1550-
if (IS_ERR(entry))
1551-
goto finish_iomap;
15521538

15531539
/*
15541540
* If we are doing synchronous page fault and inode needs fsync,

0 commit comments

Comments
 (0)