]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
hugetlb: add missing unlock in avoidcopy path in hugetlb_cow()
authorNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Fri, 2 Jul 2010 05:47:20 +0000 (14:47 +0900)
committerAndi Kleen <ak@linux.intel.com>
Wed, 11 Aug 2010 07:23:48 +0000 (09:23 +0200)
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: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
Acked-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
mm/hugetlb.c

index 3c275ffd32a77849c919ad25c0c19a2c3781e7db..303fb0c02364c3a5422db9163e1d0aca4b445e95 100644 (file)
@@ -2324,9 +2324,11 @@ retry_avoidcopy:
         * and just make the page writable */
        avoidcopy = (page_mapcount(old_page) == 1);
        if (avoidcopy) {
-               if (!trylock_page(old_page))
+               if (!trylock_page(old_page)) {
                        if (PageAnon(old_page))
                                page_move_anon_rmap(old_page, vma, address);
+               } else
+                       unlock_page(old_page);
                set_huge_ptep_writable(vma, address, ptep);
                return 0;
        }