Commit 4736ba03 authored by Kenneth W. Chen's avatar Kenneth W. Chen Committed by Linus Torvalds

[PATCH] Fix direct I/O into hugetlb page

Hit a kernel oops on 2.6.7 kernel when doing direct I/O to hugetlb page.

The destructor of compound page was moved into page->mapping since 2.6.6.
It got interfered with set_page_dirty() for hugetlb page: an O_DIRECT read
into first tail page of the compound page will fool set_page_dirty() to
deference page->mapping->a_ops and then kernel oops.  Patch to fix the
oops.  We do just like what bio_set_pages_dirty() does.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 081681b6
......@@ -395,7 +395,7 @@ static int dio_bio_complete(struct dio *dio, struct bio *bio)
for (page_no = 0; page_no < bio->bi_vcnt; page_no++) {
struct page *page = bvec[page_no].bv_page;
if (dio->rw == READ)
if (dio->rw == READ && !PageCompound(page))
set_page_dirty_lock(page);
page_cache_release(page);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment