From a7bc3a359e5337144e0557b757a1c4531b456aa0 Mon Sep 17 00:00:00 2001 From: Vladimir Saveliev Date: Wed, 12 May 2010 01:29:25 +0400 Subject: [PATCH] b=20080 add missing lock_buffer() before call to submit_bh() in journal_submit_commit_record() when submitting write to disk not supporting i/o barriers i=girish.shilamkar i=rahul.deshmukh --- .../jbd-journal-chksum-2.6.18-vanilla.patch | 88 +++++++++++----------- 1 file changed, 46 insertions(+), 42 deletions(-) diff --git a/lustre/kernel_patches/patches/jbd-journal-chksum-2.6.18-vanilla.patch b/lustre/kernel_patches/patches/jbd-journal-chksum-2.6.18-vanilla.patch index 567338e..7779500 100644 --- a/lustre/kernel_patches/patches/jbd-journal-chksum-2.6.18-vanilla.patch +++ b/lustre/kernel_patches/patches/jbd-journal-chksum-2.6.18-vanilla.patch @@ -1,7 +1,7 @@ -Index: linux-2.6.18-128.1.14/fs/jbd/commit.c +Index: linux-2.6.18-164.6.1/fs/jbd/commit.c =================================================================== ---- linux-2.6.18-128.1.14.orig/fs/jbd/commit.c 2009-06-19 12:34:22.000000000 -0600 -+++ linux-2.6.18-128.1.14/fs/jbd/commit.c 2009-06-19 12:35:11.000000000 -0600 +--- linux-2.6.18-164.6.1.orig/fs/jbd/commit.c ++++ linux-2.6.18-164.6.1/fs/jbd/commit.c @@ -22,6 +22,7 @@ #include #include @@ -10,7 +10,7 @@ Index: linux-2.6.18-128.1.14/fs/jbd/commit.c /* -@@ -95,19 +96,23 @@ +@@ -108,19 +109,23 @@ static int inverted_lock(journal_t *jour return 1; } @@ -38,7 +38,7 @@ Index: linux-2.6.18-128.1.14/fs/jbd/commit.c int barrier_done = 0; if (is_journal_aborted(journal)) -@@ -119,21 +124,34 @@ +@@ -132,21 +137,34 @@ static int journal_write_commit_record(j bh = jh2bh(descriptor); @@ -82,7 +82,11 @@ Index: linux-2.6.18-128.1.14/fs/jbd/commit.c /* is it possible for another commit to fail at roughly * the same time as this one? If so, we don't want to * trust the barrier flag in the super, but instead want -@@ -154,12 +173,70 @@ +@@ -164,15 +182,74 @@ static int journal_write_commit_record(j + spin_unlock(&journal->j_state_lock); + + /* And try again, without the barrier */ ++ lock_buffer(bh); clear_buffer_ordered(bh); set_buffer_uptodate(bh); set_buffer_dirty(bh); @@ -94,7 +98,8 @@ Index: linux-2.6.18-128.1.14/fs/jbd/commit.c + *cbh = bh; + return ret; +} -+ + +- return (ret == -EIO); +/* + * This function along with journal_submit_commit_record + * allows to write the commit record asynchronously. @@ -122,8 +127,7 @@ Index: linux-2.6.18-128.1.14/fs/jbd/commit.c +{ + int ret = 0; + struct journal_head *jh; - -- return (ret == -EIO); ++ + while (commit_transaction->t_locked_list) { + struct buffer_head *bh; + @@ -157,7 +161,7 @@ Index: linux-2.6.18-128.1.14/fs/jbd/commit.c } void journal_do_submit_data(struct buffer_head **wbuf, int bufs) -@@ -282,6 +359,20 @@ +@@ -295,6 +372,20 @@ write_out_data: return err; } @@ -178,7 +182,7 @@ Index: linux-2.6.18-128.1.14/fs/jbd/commit.c /* * journal_commit_transaction * -@@ -305,6 +396,8 @@ +@@ -318,6 +409,8 @@ void journal_commit_transaction(journal_ int first_tag = 0; int tag_flag; int i; @@ -187,7 +191,7 @@ Index: linux-2.6.18-128.1.14/fs/jbd/commit.c /* * First job: lock down the current transaction and wait for -@@ -431,39 +524,14 @@ +@@ -444,39 +537,14 @@ void journal_commit_transaction(journal_ err = journal_submit_data_buffers(journal, commit_transaction); /* @@ -233,7 +237,7 @@ Index: linux-2.6.18-128.1.14/fs/jbd/commit.c spin_unlock(&journal->j_list_lock); if (err) -@@ -642,6 +710,16 @@ +@@ -653,6 +721,16 @@ void journal_commit_transaction(journal_ start_journal_io: for (i = 0; i < bufs; i++) { struct buffer_head *bh = wbuf[i]; @@ -250,7 +254,7 @@ Index: linux-2.6.18-128.1.14/fs/jbd/commit.c lock_buffer(bh); clear_buffer_dirty(bh); set_buffer_uptodate(bh); -@@ -658,6 +736,23 @@ +@@ -669,6 +747,23 @@ start_journal_io: } } @@ -274,7 +278,7 @@ Index: linux-2.6.18-128.1.14/fs/jbd/commit.c /* Lo and behold: we have just managed to send a transaction to the log. Before we can commit it, wait for the IO so far to complete. Control buffers being written are on the -@@ -759,9 +854,15 @@ +@@ -770,9 +865,15 @@ wait_for_iobuf: journal_abort(journal, err); jbd_debug(3, "JBD: commit phase 6\n"); @@ -293,11 +297,11 @@ Index: linux-2.6.18-128.1.14/fs/jbd/commit.c if (err) journal_abort(journal, err); -Index: linux-2.6.18-128.1.14/include/linux/jbd.h +Index: linux-2.6.18-164.6.1/include/linux/jbd.h =================================================================== ---- linux-2.6.18-128.1.14.orig/include/linux/jbd.h 2009-06-19 12:34:22.000000000 -0600 -+++ linux-2.6.18-128.1.14/include/linux/jbd.h 2009-06-19 12:35:11.000000000 -0600 -@@ -148,6 +148,29 @@ +--- linux-2.6.18-164.6.1.orig/include/linux/jbd.h ++++ linux-2.6.18-164.6.1/include/linux/jbd.h +@@ -148,6 +148,29 @@ typedef struct journal_header_s __be32 h_sequence; } journal_header_t; @@ -327,7 +331,7 @@ Index: linux-2.6.18-128.1.14/include/linux/jbd.h /* * The block tag: used to describe a single buffer in the journal -@@ -234,12 +257,16 @@ +@@ -234,12 +257,16 @@ typedef struct journal_superblock_s ((j)->j_format_version >= 2 && \ ((j)->j_superblock->s_feature_incompat & cpu_to_be32((mask)))) @@ -347,7 +351,7 @@ Index: linux-2.6.18-128.1.14/include/linux/jbd.h #ifdef __KERNEL__ -@@ -1053,6 +1080,8 @@ +@@ -1053,6 +1080,8 @@ extern int journal_check_available_fe (journal_t *, unsigned long, unsigned long, unsigned long); extern int journal_set_features (journal_t *, unsigned long, unsigned long, unsigned long); @@ -356,10 +360,10 @@ Index: linux-2.6.18-128.1.14/include/linux/jbd.h extern int journal_create (journal_t *); extern int journal_load (journal_t *journal); #ifndef __GENKSYMS__ -Index: linux-2.6.18-128.1.14/fs/jbd/recovery.c +Index: linux-2.6.18-164.6.1/fs/jbd/recovery.c =================================================================== ---- linux-2.6.18-128.1.14.orig/fs/jbd/recovery.c 2009-06-19 12:33:10.000000000 -0600 -+++ linux-2.6.18-128.1.14/fs/jbd/recovery.c 2009-06-19 12:35:11.000000000 -0600 +--- linux-2.6.18-164.6.1.orig/fs/jbd/recovery.c ++++ linux-2.6.18-164.6.1/fs/jbd/recovery.c @@ -21,6 +21,7 @@ #include #include @@ -368,7 +372,7 @@ Index: linux-2.6.18-128.1.14/fs/jbd/recovery.c #endif /* -@@ -310,6 +311,38 @@ +@@ -310,6 +311,38 @@ int journal_skip_recovery(journal_t *jou return err; } @@ -407,7 +411,7 @@ Index: linux-2.6.18-128.1.14/fs/jbd/recovery.c static int do_one_pass(journal_t *journal, struct recovery_info *info, enum passtype pass) { -@@ -321,6 +354,7 @@ +@@ -321,6 +354,7 @@ static int do_one_pass(journal_t *journa struct buffer_head * bh; unsigned int sequence; int blocktype; @@ -415,7 +419,7 @@ Index: linux-2.6.18-128.1.14/fs/jbd/recovery.c /* Precompute the maximum metadata descriptors in a descriptor block */ int MAX_BLOCKS_PER_DESC; -@@ -412,9 +446,24 @@ +@@ -412,9 +446,24 @@ static int do_one_pass(journal_t *journa switch(blocktype) { case JFS_DESCRIPTOR_BLOCK: /* If it is a valid descriptor block, replay it @@ -442,7 +446,7 @@ Index: linux-2.6.18-128.1.14/fs/jbd/recovery.c next_log_block += count_tags(bh, journal->j_blocksize); wrap(journal, next_log_block); -@@ -509,9 +558,97 @@ +@@ -509,9 +558,97 @@ static int do_one_pass(journal_t *journa continue; case JFS_COMMIT_BLOCK: @@ -542,7 +546,7 @@ Index: linux-2.6.18-128.1.14/fs/jbd/recovery.c brelse(bh); next_commit_ID++; continue; -@@ -547,9 +684,10 @@ +@@ -547,9 +684,10 @@ static int do_one_pass(journal_t *journa * transaction marks the end of the valid log. */ @@ -556,11 +560,11 @@ Index: linux-2.6.18-128.1.14/fs/jbd/recovery.c /* It's really bad news if different passes end up at * different places (but possible due to IO errors). */ if (info->end_transaction != next_commit_ID) { -Index: linux-2.6.18-128.1.14/fs/jbd/journal.c +Index: linux-2.6.18-164.6.1/fs/jbd/journal.c =================================================================== ---- linux-2.6.18-128.1.14.orig/fs/jbd/journal.c 2009-06-19 12:34:22.000000000 -0600 -+++ linux-2.6.18-128.1.14/fs/jbd/journal.c 2009-06-19 12:35:11.000000000 -0600 -@@ -67,6 +67,7 @@ +--- linux-2.6.18-164.6.1.orig/fs/jbd/journal.c ++++ linux-2.6.18-164.6.1/fs/jbd/journal.c +@@ -67,6 +67,7 @@ EXPORT_SYMBOL(journal_update_format); EXPORT_SYMBOL(journal_check_used_features); EXPORT_SYMBOL(journal_check_available_features); EXPORT_SYMBOL(journal_set_features); @@ -568,7 +572,7 @@ Index: linux-2.6.18-128.1.14/fs/jbd/journal.c EXPORT_SYMBOL(journal_create); EXPORT_SYMBOL(journal_load); EXPORT_SYMBOL(journal_destroy); -@@ -1583,6 +1584,33 @@ +@@ -1583,6 +1584,33 @@ int journal_set_features (journal_t *jou return 1; } @@ -602,11 +606,11 @@ Index: linux-2.6.18-128.1.14/fs/jbd/journal.c /** * int journal_update_format () - Update on-disk journal structure. -Index: linux-2.6.18-128.1.14/fs/Kconfig +Index: linux-2.6.18-164.6.1/fs/Kconfig =================================================================== ---- linux-2.6.18-128.1.14.orig/fs/Kconfig 2009-06-19 12:33:10.000000000 -0600 -+++ linux-2.6.18-128.1.14/fs/Kconfig 2009-06-19 12:35:11.000000000 -0600 -@@ -206,6 +206,7 @@ +--- linux-2.6.18-164.6.1.orig/fs/Kconfig ++++ linux-2.6.18-164.6.1/fs/Kconfig +@@ -142,6 +142,7 @@ source "fs/ext4/Kconfig" config JBD tristate @@ -614,11 +618,11 @@ Index: linux-2.6.18-128.1.14/fs/Kconfig help This is a generic journaling layer for block devices. It is currently used by the ext3 and OCFS2 file systems, but it could -Index: linux-2.6.18-128.1.14/Documentation/filesystems/ext3.txt +Index: linux-2.6.18-164.6.1/Documentation/filesystems/ext3.txt =================================================================== ---- linux-2.6.18-128.1.14.orig/Documentation/filesystems/ext3.txt 2009-06-19 12:33:10.000000000 -0600 -+++ linux-2.6.18-128.1.14/Documentation/filesystems/ext3.txt 2009-06-19 12:35:11.000000000 -0600 -@@ -14,6 +14,16 @@ +--- linux-2.6.18-164.6.1.orig/Documentation/filesystems/ext3.txt ++++ linux-2.6.18-164.6.1/Documentation/filesystems/ext3.txt +@@ -14,6 +14,16 @@ Options When mounting an ext3 filesystem, the following option are accepted: (*) == default -- 1.8.3.1