Skip to content

Commit a412f9e

Browse files
committed
reiserfs, kill-the-BKL: fix unsafe j_flush_mutex lock
Impact: fix a deadlock The j_flush_mutex is acquired safely in journal.c: if we can't take it, we free the reiserfs per superblock lock and wait a bit. But we have a remaining place in kupdate_transactions() where j_flush_mutex is still acquired traditionnaly. Thus the following scenario (warned by lockdep) can happen: A B mutex_lock(&write_lock) mutex_lock(&write_lock) mutex_lock(&j_flush_mutex) mutex_lock(&j_flush_mutex) //block mutex_unlock(&write_lock) sleep... mutex_lock(&write_lock) //deadlock Fix this by using reiserfs_mutex_lock_safe() in kupdate_transactions(). Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Alessio Igor Bogani <abogani@texware.it> Cc: Jeff Mahoney <jeffm@suse.com> LKML-Reference: <1239660635-12940-1-git-send-email-fweisbec@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
1 parent 8ebc423 commit a412f9e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎fs/reiserfs/journal.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1826,7 +1826,7 @@ static int kupdate_transactions(struct super_block *s,
18261826
struct reiserfs_journal *journal = SB_JOURNAL(s);
18271827
chunk.nr = 0;
18281828

1829-
mutex_lock(&journal->j_flush_mutex);
1829+
reiserfs_mutex_lock_safe(&journal->j_flush_mutex, s);
18301830
if (!journal_list_still_alive(s, orig_trans_id)) {
18311831
goto done;
18321832
}

0 commit comments

Comments
 (0)