Commit 561516c8 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] kjournald shutdown fix

If someome tries to unmount the fs while kjournald is performing a commit,
kjournald forgets to look for the termination request and goes into permanent
sleep.
parent 53f35f47
...@@ -161,7 +161,7 @@ int kjournald(void *arg) ...@@ -161,7 +161,7 @@ int kjournald(void *arg)
del_timer_sync(journal->j_commit_timer); del_timer_sync(journal->j_commit_timer);
journal_commit_transaction(journal); journal_commit_transaction(journal);
spin_lock(&journal->j_state_lock); spin_lock(&journal->j_state_lock);
goto loop; goto end_loop;
} }
wake_up(&journal->j_wait_done_commit); wake_up(&journal->j_wait_done_commit);
...@@ -210,7 +210,7 @@ int kjournald(void *arg) ...@@ -210,7 +210,7 @@ int kjournald(void *arg)
journal->j_commit_request = transaction->t_tid; journal->j_commit_request = transaction->t_tid;
jbd_debug(1, "woke because of timeout\n"); jbd_debug(1, "woke because of timeout\n");
} }
end_loop:
if (!(journal->j_flags & JFS_UNMOUNT)) if (!(journal->j_flags & JFS_UNMOUNT))
goto loop; goto loop;
...@@ -230,12 +230,16 @@ static void journal_start_thread(journal_t *journal) ...@@ -230,12 +230,16 @@ static void journal_start_thread(journal_t *journal)
static void journal_kill_thread(journal_t *journal) static void journal_kill_thread(journal_t *journal)
{ {
spin_lock(&journal->j_state_lock);
journal->j_flags |= JFS_UNMOUNT; journal->j_flags |= JFS_UNMOUNT;
while (journal->j_task) { while (journal->j_task) {
wake_up(&journal->j_wait_commit); wake_up(&journal->j_wait_commit);
spin_unlock(&journal->j_state_lock);
wait_event(journal->j_wait_done_commit, journal->j_task == 0); wait_event(journal->j_wait_done_commit, journal->j_task == 0);
spin_lock(&journal->j_state_lock);
} }
spin_unlock(&journal->j_state_lock);
} }
/* /*
......
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