提交 5c2178e7 编写于 作者: T Theodore Ts'o

jbd2: Add sanity check for attempts to start handle during umount

An attempt to modify the file system during the call to
jbd2_destroy_journal() can lead to a system lockup.  So add some
checking to make it much more obvious when this happens to and to
determine where the offending code is located.
Signed-off-by: N"Theodore Ts'o" <tytso@mit.edu>
上级 a1c6c569
...@@ -299,6 +299,16 @@ static int __process_buffer(journal_t *journal, struct journal_head *jh, ...@@ -299,6 +299,16 @@ static int __process_buffer(journal_t *journal, struct journal_head *jh,
transaction->t_chp_stats.cs_forced_to_close++; transaction->t_chp_stats.cs_forced_to_close++;
spin_unlock(&journal->j_list_lock); spin_unlock(&journal->j_list_lock);
jbd_unlock_bh_state(bh); jbd_unlock_bh_state(bh);
if (unlikely(journal->j_flags & JBD2_UNMOUNT))
/*
* The journal thread is dead; so starting and
* waiting for a commit to finish will cause
* us to wait for a _very_ long time.
*/
printk(KERN_ERR "JBD2: %s: "
"Waiting for Godot: block %llu\n",
journal->j_devname,
(unsigned long long) bh->b_blocknr);
jbd2_log_start_commit(journal, tid); jbd2_log_start_commit(journal, tid);
jbd2_log_wait_commit(journal, tid); jbd2_log_wait_commit(journal, tid);
ret = 1; ret = 1;
......
...@@ -156,6 +156,7 @@ static int start_this_handle(journal_t *journal, handle_t *handle, ...@@ -156,6 +156,7 @@ static int start_this_handle(journal_t *journal, handle_t *handle,
*/ */
repeat: repeat:
read_lock(&journal->j_state_lock); read_lock(&journal->j_state_lock);
BUG_ON(journal->j_flags & JBD2_UNMOUNT);
if (is_journal_aborted(journal) || if (is_journal_aborted(journal) ||
(journal->j_errno != 0 && !(journal->j_flags & JBD2_ACK_ERR))) { (journal->j_errno != 0 && !(journal->j_flags & JBD2_ACK_ERR))) {
read_unlock(&journal->j_state_lock); read_unlock(&journal->j_state_lock);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册