]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
mm: fix false-positive WARN_ON() in truncate/invalidate for hugetlb
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Wed, 30 Nov 2016 23:54:19 +0000 (15:54 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Dec 2016 06:16:18 +0000 (07:16 +0100)
commit5661a69268715cde3489a668251926b314a59173
treeb88074311732d42723b9801cfb3c214ac5b472ea
parent48b6b50a2ba5fa74399e9fb0abf3c26982a0048e
mm: fix false-positive WARN_ON() in truncate/invalidate for hugetlb

commit 5cbc198ae08d84bd416b672ad8bd1222acd0855c upstream.

Hugetlb pages have ->index in size of the huge pages (PMD_SIZE or
PUD_SIZE), not in PAGE_SIZE as other types of pages.  This means we
cannot user page_to_pgoff() to check whether we've got the right page
for the radix-tree index.

Let's introduce page_to_index() which would return radix-tree index for
given page.

We will be able to get rid of this once hugetlb will be switched to
multi-order entries.

Fixes: fc127da085c2 ("truncate: handle file thp")
Link: http://lkml.kernel.org/r/20161123093053.mjbnvn5zwxw5e6lk@black.fi.intel.com
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Reported-by: Doug Nelson <doug.nelson@intel.com>
Tested-by: Doug Nelson <doug.nelson@intel.com>
Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/pagemap.h
mm/truncate.c