]> Git Repo - linux.git/commit
ext4: fix deadlock when writing in ENOSPC conditions
authorJan Kara <[email protected]>
Wed, 18 Dec 2013 05:44:44 +0000 (00:44 -0500)
committerTheodore Ts'o <[email protected]>
Wed, 18 Dec 2013 05:44:44 +0000 (00:44 -0500)
commit34cf865d54813aab3497838132fb1bbd293f4054
tree1c35c9598e48f8a68ae976bc4ae4ef3374cd8774
parenta67c848a8b9aa9e471f9eaadd2cb29cc527462cf
ext4: fix deadlock when writing in ENOSPC conditions

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 <[email protected]>
Reviewed-by: Zheng Liu <[email protected]>
Signed-off-by: Jan Kara <[email protected]>
Signed-off-by: "Theodore Ts'o" <[email protected]>
Cc: [email protected]
fs/ext4/inode.c
This page took 0.054805 seconds and 4 git commands to generate.