The locking rules say that b_committed_data is covered by
jbd_lock_bh_state(), so implement that during the start of commit, while
throwing away unused shadow buffers.

I don't expect that there is really a race here, but them's the rules.



 fs/jbd/commit.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff -puN fs/jbd/commit.c~jbd-b_committed_data-locking-fix fs/jbd/commit.c
--- 25/fs/jbd/commit.c~jbd-b_committed_data-locking-fix	2003-11-26 05:56:20.000000000 -0800
+++ 25-akpm/fs/jbd/commit.c	2003-11-26 05:56:20.000000000 -0800
@@ -177,8 +177,14 @@ void journal_commit_transaction(journal_
 		 * leave undo-committed data.
 		 */
 		if (jh->b_committed_data) {
-			kfree(jh->b_committed_data);
-			jh->b_committed_data = NULL;
+			struct buffer_head *bh = jh2bh(jh);
+
+			jbd_lock_bh_state(bh);
+			if (jh->b_committed_data) {
+				kfree(jh->b_committed_data);
+				jh->b_committed_data = NULL;
+			}
+			jbd_unlock_bh_state(bh);
 		}
 		journal_refile_buffer(journal, jh);
 	}

_