filemap: update offset check in filemap_fault()
authorSong Liu <songliubraving@fb.com>
Mon, 23 Sep 2019 22:37:50 +0000 (15:37 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 24 Sep 2019 22:54:11 +0000 (15:54 -0700)
With THP, current check of offset:

    VM_BUG_ON_PAGE(page->index != offset, page);

is no longer accurate. Update it to:

    VM_BUG_ON_PAGE(page_to_pgoff(page) != offset, page);

Link: http://lkml.kernel.org/r/20190801184244.3169074-4-songliubraving@fb.com
Signed-off-by: Song Liu <songliubraving@fb.com>
Acked-by: Rik van Riel <riel@surriel.com>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Hillf Danton <hdanton@sina.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: William Kucharski <william.kucharski@oracle.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/filemap.c

index 0b301103ea80e4c82dbc0aab9dc817b2d413b1ff..f4d2971abd7c6b188de4fd7c4592c75d1a795a1b 100644 (file)
@@ -2545,7 +2545,7 @@ retry_find:
                put_page(page);
                goto retry_find;
        }
-       VM_BUG_ON_PAGE(page->index != offset, page);
+       VM_BUG_ON_PAGE(page_to_pgoff(page) != offset, page);
 
        /*
         * We have a locked page in the page cache, now we need to check