diff options
author | Jan Kara <jack@suse.cz> | 2013-12-18 00:44:44 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-01-09 12:25:10 -0800 |
commit | c4589c1f2b1f529ca0383bba9f7cc2eb73cdfa04 (patch) | |
tree | 74f8d6b7ae9cb40546e6f20f4a315b9b27dbcfea /fs/ext4/mballoc.c | |
parent | 12f5b490823b9e75d9550720eaf0b2ac111c0f3e (diff) |
ext4: fix deadlock when writing in ENOSPC conditions
commit 34cf865d54813aab3497838132fb1bbd293f4054 upstream.
Akira-san has been reporting rare deadlocks of his machine when running
xfstests test 269 on ext4 filesystem. The problem turned out to be in
ext4_da_reserve_metadata() and ext4_da_reserve_space() which called
ext4_should_retry_alloc() while holding i_data_sem. Since
ext4_should_retry_alloc() can force a transaction commit, this is a
lock ordering violation and leads to deadlocks.
Fix the problem by just removing the retry loops. These functions should
just report ENOSPC to the caller (e.g. ext4_da_write_begin()) and that
function must take care of retrying after dropping all necessary locks.
Reported-and-tested-by: Akira Fujita <a-fujita@rs.jp.nec.com>
Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/ext4/mballoc.c')
0 files changed, 0 insertions, 0 deletions