Drop in a few assertions to ensure that the locking rules are being adhered
to.



 fs/jbd/transaction.c |    3 +++
 include/linux/jbd.h  |    5 +++++
 2 files changed, 8 insertions(+)

diff -puN fs/jbd/transaction.c~jbd-550-locking-checks fs/jbd/transaction.c
--- 25/fs/jbd/transaction.c~jbd-550-locking-checks	2003-05-26 14:06:33.000000000 -0700
+++ 25-akpm/fs/jbd/transaction.c	2003-05-26 14:09:37.000000000 -0700
@@ -1506,6 +1506,7 @@ void __journal_unfile_buffer(struct jour
 	transaction_t *transaction;
 	struct buffer_head *bh = jh2bh(jh);
 
+	J_ASSERT_JH(jh, jbd_is_locked_bh_state(bh));
 	transaction = jh->b_transaction;
 	if (transaction)
 		assert_spin_locked(&transaction->t_journal->j_list_lock);
@@ -1932,6 +1933,7 @@ void __journal_file_buffer(struct journa
 	int was_dirty = 0;
 	struct buffer_head *bh = jh2bh(jh);
 
+	J_ASSERT_JH(jh, jbd_is_locked_bh_state(bh));
 	assert_spin_locked(&transaction->t_journal->j_list_lock);
 
 #ifdef __SMP__
@@ -2021,6 +2023,7 @@ void __journal_refile_buffer(struct jour
 	int was_dirty;
 	struct buffer_head *bh = jh2bh(jh);
 
+	J_ASSERT_JH(jh, jbd_is_locked_bh_state(bh));
 	if (jh->b_transaction)
 		assert_spin_locked(&jh->b_transaction->t_journal->j_list_lock);
 
diff -puN include/linux/jbd.h~jbd-550-locking-checks include/linux/jbd.h
--- 25/include/linux/jbd.h~jbd-550-locking-checks	2003-05-26 14:09:03.000000000 -0700
+++ 25-akpm/include/linux/jbd.h	2003-05-26 14:09:35.000000000 -0700
@@ -322,6 +322,11 @@ static inline int jbd_trylock_bh_state(s
 	return bit_spin_trylock(BH_State, &bh->b_state);
 }
 
+static inline int jbd_is_locked_bh_state(struct buffer_head *bh)
+{
+	return bit_spin_is_locked(BH_State, &bh->b_state);
+}
+
 static inline void jbd_unlock_bh_state(struct buffer_head *bh)
 {
 	bit_spin_unlock(BH_State, &bh->b_state);

_