diff mbox

[2/2] dax: Fix error returns in PMD fault handler

Message ID 1449168183-20378-3-git-send-email-willy@linux.intel.com (mailing list archive)
State Superseded
Headers show

Commit Message

Matthew Wilcox Dec. 3, 2015, 6:43 p.m. UTC
When we need to bail at this point, we do not hold the mutex, so jumping
to the error path which will drop the mutex is the wrong approach.
Just return the fallback instead.  This mostly reverts commit fd6b9f6393.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
---
 fs/dax.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)
diff mbox

Patch

diff --git a/fs/dax.c b/fs/dax.c
index 727af65..71ba5f7 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -581,28 +581,22 @@  int __dax_pmd_fault(struct vm_area_struct *vma, unsigned long address,
 	/* Fall back to PTEs if we're going to COW */
 	if (write && !(vma->vm_flags & VM_SHARED)) {
 		split_huge_page_pmd(vma, address, pmd);
-		reason = "cow write";
 		return VM_FAULT_FALLBACK;
 	}
+
 	/* If the PMD would extend outside the VMA */
-	if (pmd_addr < vma->vm_start) {
-		reason = "vma start unaligned";
-		goto fallback;
-	}
-	if ((pmd_addr + PMD_SIZE) > vma->vm_end) {
-		reason = "vma end unaligned";
-		goto fallback;
-	}
+	if (pmd_addr < vma->vm_start)
+		return VM_FAULT_FALLBACK;
+	if ((pmd_addr + PMD_SIZE) > vma->vm_end)
+		return VM_FAULT_FALLBACK;
 
 	pgoff = linear_page_index(vma, pmd_addr);
 	size = (i_size_read(inode) + PAGE_SIZE - 1) >> PAGE_SHIFT;
 	if (pgoff >= size)
 		return VM_FAULT_SIGBUS;
 	/* If the PMD would cover blocks out of the file */
-	if ((pgoff | PG_PMD_COLOUR) >= size) {
-		reason = "offset + huge page size > file size";
+	if ((pgoff | PG_PMD_COLOUR) >= size)
 		return VM_FAULT_FALLBACK;
-	}
 
 	memset(&bh, 0, sizeof(bh));
 	block = (sector_t)pgoff << (PAGE_SHIFT - blkbits);