Commit 3e3eb8d8 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] JBD: hold onto j_state_lock after

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.
parent 37835361
No related merge requests found
......@@ -115,6 +115,7 @@ static int start_this_handle(journal_t *journal, handle_t *handle)
* 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 @@ static int start_this_handle(journal_t *journal, handle_t *handle)
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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment