commit e03a9976afce6634826d56c33531dd10bb9a9166 upstream.
Thomas has reported a lockdep splat hitting in
add_transaction_credits(). The problem is that that function calls
jbd2_might_wait_for_commit() while holding j_state_lock which is wrong
(we do not really wait for transaction commit while holding that lock).
Fix the problem by moving jbd2_might_wait_for_commit() into places where
we are ready to wait for transaction commit and thus j_state_lock is
Fixes: 1eaa566dReported-by: Thomas Gleixner <email@example.com>
Signed-off-by: Jan Kara <firstname.lastname@example.org>
Signed-off-by: Theodore Ts'o <email@example.com>
Signed-off-by: Greg Kroah-Hartman <firstname.lastname@example.org>