Drop in a few assertions to ensure that the locking rules are being adhered to. 25-akpm/fs/jbd/transaction.c | 3 +++ 25-akpm/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 Thu May 29 16:17:04 2003 +++ 25-akpm/fs/jbd/transaction.c Thu May 29 16:17:04 2003 @@ -1498,6 +1498,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); @@ -1924,6 +1925,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__ @@ -2013,6 +2015,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 Thu May 29 16:17:04 2003 +++ 25-akpm/include/linux/jbd.h Thu May 29 16:17:04 2003 @@ -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); _