Minro tweak: once log_wait_for_space() has created sufficient space in the journal to start the new handle, hang onto the spinlock as start_this_handle() loops around to reevaluate the journal's state. It prevents anyone else from zooming in and stealing the space we just made. fs/jbd/transaction.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff -puN fs/jbd/transaction.c~jbd-680-log_wait_for_space-fix fs/jbd/transaction.c --- 25/fs/jbd/transaction.c~jbd-680-log_wait_for_space-fix 2003-06-11 03:36:07.000000000 -0700 +++ 25-akpm/fs/jbd/transaction.c 2003-06-11 03:36:31.000000000 -0700 @@ -115,6 +115,7 @@ repeat: * for proper journal barrier handling */ spin_lock(&journal->j_state_lock); +repeat_locked: if (is_journal_aborted(journal) || (journal->j_errno != 0 && !(journal->j_flags & JFS_ACK_ERR))) { spin_unlock(&journal->j_state_lock); @@ -214,8 +215,7 @@ repeat: jbd_debug(2, "Handle %p waiting for checkpoint...\n", handle); spin_unlock(&transaction->t_handle_lock); __log_wait_for_space(journal, needed); - spin_unlock(&journal->j_state_lock); - goto repeat; + goto repeat_locked; } /* OK, account for the buffers that this operation expects to _