Skip to content

Commit

Permalink
mm/hugetlb.c: avoid double unlock_page() in hugetlb_fault()
Browse files Browse the repository at this point in the history
Have hugetlb_fault() call unlock_page(page) only if it had previously
called lock_page(page).

Setting CONFIG_DEBUG_VM=y and then running the libhugetlbfs test suite,
resulted in the tripping of VM_BUG_ON(!PageLocked(page)) in
unlock_page() having been called by hugetlb_fault() when page ==
pagecache_page.  This patch remedied the problem.

Signed-off-by: Dean Nelson <dnelson@redhat.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Dean Nelson authored and Linus Torvalds committed Dec 2, 2010
1 parent 94c35de commit 1f64d69
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mm/hugetlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -2738,7 +2738,8 @@ int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
unlock_page(pagecache_page);
put_page(pagecache_page);
}
unlock_page(page);
if (page != pagecache_page)
unlock_page(page);

out_mutex:
mutex_unlock(&hugetlb_instantiation_mutex);
Expand Down

0 comments on commit 1f64d69

Please sign in to comment.