]> git.baikalelectronics.ru Git - kernel.git/commit
jbd2: Fix lockdep splat with generic/270 test
authorJan Kara <jack@suse.cz>
Sun, 30 Apr 2017 00:12:16 +0000 (20:12 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 30 Apr 2017 00:12:16 +0000 (20:12 -0400)
commit5a9fbc319092f11c1c8c5db9633911f1cdb5b398
tree4b61b1a2c7c8ff64679d49c191149fcadfb78176
parent230fdf14ee49906c383e3acfd9cd1c47c9ee64ff
jbd2: Fix lockdep splat with generic/270 test

I've hit a lockdep splat with generic/270 test complaining that:

3216.fsstress.b/3533 is trying to acquire lock:
 (jbd2_handle){++++..}, at: [<ffffffff813152e0>] jbd2_log_wait_commit+0x0/0x150

but task is already holding lock:
 (jbd2_handle){++++..}, at: [<ffffffff8130bd3b>] start_this_handle+0x35b/0x850

The underlying problem is that jbd2_journal_force_commit_nested()
(called from ext4_should_retry_alloc()) may get called while a
transaction handle is started. In such case it takes care to not wait
for commit of the running transaction (which would deadlock) but only
for a commit of a transaction that is already committing (which is safe
as that doesn't wait for any filesystem locks).

In fact there are also other callers of jbd2_log_wait_commit() that take
care to pass tid of a transaction that is already committing and for
those cases, the lockdep instrumentation is too restrictive and leading
to false positive reports. Fix the problem by calling
jbd2_might_wait_for_commit() from jbd2_log_wait_commit() only if the
transaction isn't already committing.

Fixes: 94880f448c96dbda8a7c637cfed7f6d3c4fbaab4
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/jbd2/journal.c