From: Mingming Cao <cmm@us.ibm.com>
To: Girish Shilamkar <girish@clusterfs.com>
Cc: Avantika Mathur <mathur@linux.vnet.ibm.com>, linux-ext4@vger.kernel.org
Subject: [PATCH][RFC]JBD2: Fix journal checksum kernel oops on NUMA
Date: Thu, 01 Nov 2007 17:40:35 -0700 [thread overview]
Message-ID: <1193964035.4014.23.camel@localhost.localdomain> (raw)
In-Reply-To: <1188552066.3781.15.camel@dhcp5.linsyssoft.com>
JBD2: Fix NULL pointer bh->b_data on NUMA box with journal checksumming.
Current journal checksumming patch failed fsstress test on NUMA. The
bh->b_data passed to the crc32_be () function could be NULL pointer,
which caused kernel oops immediately when running fsstress with -o
journal_checksum. It is because the page is part of highmem on NUMA box.
We need to kmap the page before access the bh->b_data to calculate
the checksums.
Signed-off-by: Mingming Cao <cmm@us.ibm.com>
---
fs/jbd2/commit.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
Index: linux-2.6.24-rc1/fs/jbd2/commit.c
===================================================================
--- linux-2.6.24-rc1.orig/fs/jbd2/commit.c 2007-11-01 11:15:08.000000000 -0700
+++ linux-2.6.24-rc1/fs/jbd2/commit.c 2007-11-01 12:27:02.000000000 -0700
@@ -352,6 +352,20 @@ write_out_data:
journal_do_submit_data(wbuf, bufs);
}
+static inline __u32 jbd2_checksum_data(__u32 crc32_sum, struct buffer_head *bh)
+{
+ struct page *page = bh->b_page;
+ char *addr;
+ __u32 checksum;
+
+ addr = kmap(page);
+ checksum = crc32_be(crc32_sum,
+ (void *)(addr + offset_in_page(bh->b_data)), bh->b_size);
+ kunmap(page);
+
+ return checksum;
+}
+
static inline void write_tag_block(int tag_bytes, journal_block_tag_t *tag,
unsigned long long block)
{
@@ -715,9 +729,8 @@ start_journal_io:
*/
if (JBD2_HAS_COMPAT_FEATURE(journal,
JBD2_FEATURE_COMPAT_CHECKSUM)) {
- crc32_sum = crc32_be(crc32_sum,
- (void *)bh->b_data,
- bh->b_size);
+ crc32_sum =
+ jbd2_checksum_data(crc32_sum, bh);
}
lock_buffer(bh);
next prev parent reply other threads:[~2007-11-02 0:40 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-30 18:16 jbd2_journal_commit_transaction oops Avantika Mathur
2007-08-31 9:21 ` Girish Shilamkar
2007-08-31 21:32 ` Avantika Mathur
2007-09-13 9:49 ` Girish Shilamkar
2007-11-02 0:40 ` Mingming Cao [this message]
2007-11-02 5:20 ` [PATCH][RFC]JBD2: Fix journal checksum kernel oops on NUMA Andreas Dilger
2007-11-02 16:31 ` Badari Pulavarty
2007-11-03 1:36 ` Andreas Dilger
2007-11-05 16:04 ` Badari Pulavarty
2007-11-05 16:15 ` Andreas Dilger
2007-11-05 18:07 ` Badari Pulavarty
2007-11-05 23:21 ` Mingming Cao
2007-11-06 1:33 ` Andreas Dilger
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=1193964035.4014.23.camel@localhost.localdomain \
--to=cmm@us.ibm.com \
--cc=girish@clusterfs.com \
--cc=linux-ext4@vger.kernel.org \
--cc=mathur@linux.vnet.ibm.com \
/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;
as well as URLs for NNTP newsgroup(s).