summaryrefslogtreecommitdiffstats
path: root/fs/jbd2/transaction.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2016-06-30 11:40:54 -0400
committerTheodore Ts'o <tytso@mit.edu>2016-06-30 11:40:54 -0400
commit1eaa566d368b214d99cbb973647c1b0b8102a9ae (patch)
tree30f6f17f9dbc22a3ca6ff014c1c38a69f645c00d /fs/jbd2/transaction.c
parentab714aff4f744f52f0beae93ed441f2f5585eb7a (diff)
downloadlinux-1eaa566d368b214d99cbb973647c1b0b8102a9ae.tar.gz
linux-1eaa566d368b214d99cbb973647c1b0b8102a9ae.tar.bz2
linux-1eaa566d368b214d99cbb973647c1b0b8102a9ae.zip
jbd2: track more dependencies on transaction commit
So far we were tracking only dependency on transaction commit due to starting a new handle (which may require commit to start a new transaction). Now add tracking also for other cases where we wait for transaction commit. This way lockdep can catch deadlocks e. g. because we call jbd2_journal_stop() for a synchronous handle with some locks held which rank below transaction start. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/jbd2/transaction.c')
-rw-r--r--fs/jbd2/transaction.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
index c0065040c5be..b5bc3e249163 100644
--- a/fs/jbd2/transaction.c
+++ b/fs/jbd2/transaction.c
@@ -182,6 +182,8 @@ static int add_transaction_credits(journal_t *journal, int blocks,
int needed;
int total = blocks + rsv_blocks;
+ jbd2_might_wait_for_commit(journal);
+
/*
* If the current transaction is locked down for commit, wait
* for the lock to be released.
@@ -695,6 +697,8 @@ void jbd2_journal_lock_updates(journal_t *journal)
{
DEFINE_WAIT(wait);
+ jbd2_might_wait_for_commit(journal);
+
write_lock(&journal->j_state_lock);
++journal->j_barrier_count;