mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Chen, Kenneth W" <kenneth.w.chen@intel.com>
To: <linux-kernel@vger.kernel.org>
Subject: Direct I/O stomp over page->mapping for hugetlb page
Date: Thu, 24 Jun 2004 16:35:06 -0700	[thread overview]
Message-ID: <200406242333.i5ONXeY22955@unix-os.sc.intel.com> (raw)

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

Unable to handle kernel paging request at virtual address 000010180401201d
a.out[1300]: Oops 8813272891392 [1]

Call Trace:
 [<a000000100025010>] die+0x1d0/0x280
 [<a000000100043880>] ia64_do_page_fault+0x380/0x980
 [<a00000010009f500>] set_page_dirty+0xc0/0x1a0
 [<a00000010009f650>] set_page_dirty_lock+0x70/0xa0
 [<a00000010012eec0>] dio_bio_complete+0x100/0x1a0
 [<a00000010012f000>] dio_await_completion+0xa0/0xe0
 [<a000000100130b30>] direct_io_worker+0x810/0x980
 [<a000000100131160>] __blockdev_direct_IO+0x4c0/0x500
 [<a0000001000efbb0>] blkdev_direct_IO+0x90/0xc0
 [<a000000100096eb0>] generic_file_direct_IO+0xd0/0x120
 [<a000000100093920>] __generic_file_aio_read+0x200/0x3c0
 [<a000000100093c60>] generic_file_read+0xc0/0x100
 [<a0000001000dcf70>] vfs_read+0x210/0x2c0
 [<a0000001000dd620>] sys_pread64+0x80/0xe0
 [<a00000010000e0c0>] ia64_ret_from_syscall+0x0/0x20

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.

--- linux/fs/direct-io.c.orig	2004-06-24 11:56:53.000000000 -0700
+++ linux/fs/direct-io.c	2004-06-24 15:24:02.000000000 -0700
@@ -395,7 +395,7 @@ static int dio_bio_complete(struct dio *
 		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);
 		}




                 reply	other threads:[~2004-06-24 23:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200406242333.i5ONXeY22955@unix-os.sc.intel.com \
    --to=kenneth.w.chen@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®