[PATCH 1/4] dax: Only unlock the i_mmap_mutex if we locked it

From: Matthew Wilcox
Date: Fri Jul 25 2014 - 09:43:15 EST


The second time we faulted on a hole, we would try to unlock the
i_mmap_mutex, even though we weren't holding it. Oops.
---
fs/dax.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/dax.c b/fs/dax.c
index 39b95b1..a65a0f9 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -341,7 +341,8 @@ static int do_dax_fault(struct vm_area_struct *vma, struct vm_fault *vmf,
if (error || bh.b_size < PAGE_SIZE)
goto sigbus;
} else {
- mutex_unlock(&mapping->i_mmap_mutex);
+ if (!page)
+ mutex_unlock(&mapping->i_mmap_mutex);
return dax_load_hole(mapping, page, vmf);
}
}
--
2.0.1


--NU0Ex4SbNnrxsi6C
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0002-dax-Call-delete_from_page_cache-after-unmap_mapping_.patch"