提交 28957a54 编写于 作者: N Naoya Horiguchi 提交者: Andi Kleen

hugetlb: add missing unlock in avoidcopy path in hugetlb_cow()

This patch fixes possible deadlock in hugepage lock_page()
by adding missing unlock_page().

libhugetlbfs test will hit this bug when the next patch in this
patchset ("hugetlb, HWPOISON: move PG_HWPoison bit check") is applied.
Signed-off-by: NNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Signed-off-by: NJun'ichi Nomura <j-nomura@ce.jp.nec.com>
Acked-by: NFengguang Wu <fengguang.wu@intel.com>
Signed-off-by: NAndi Kleen <ak@linux.intel.com>
上级 e3390f67
...@@ -2324,9 +2324,11 @@ static int hugetlb_cow(struct mm_struct *mm, struct vm_area_struct *vma, ...@@ -2324,9 +2324,11 @@ static int hugetlb_cow(struct mm_struct *mm, struct vm_area_struct *vma,
* and just make the page writable */ * and just make the page writable */
avoidcopy = (page_mapcount(old_page) == 1); avoidcopy = (page_mapcount(old_page) == 1);
if (avoidcopy) { if (avoidcopy) {
if (!trylock_page(old_page)) if (!trylock_page(old_page)) {
if (PageAnon(old_page)) if (PageAnon(old_page))
page_move_anon_rmap(old_page, vma, address); page_move_anon_rmap(old_page, vma, address);
} else
unlock_page(old_page);
set_huge_ptep_writable(vma, address, ptep); set_huge_ptep_writable(vma, address, ptep);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册