summaryrefslogtreecommitdiffstats
path: root/fs/timerfd.c
diff options
context:
space:
mode:
authorAkira Fujita <a-fujita@rs.jp.nec.com>2009-11-23 07:24:43 -0500
committerTheodore Ts'o <tytso@mit.edu>2009-11-23 07:24:43 -0500
commitfc04cb49a898c372a22b21fffc47f299d8710801 (patch)
tree668bc49ab0a89c6260d78b31eb09b7c60a27bdac /fs/timerfd.c
parentf868a48d06f8886cb0367568a12367fa4f21ea0d (diff)
downloadop-kernel-dev-fc04cb49a898c372a22b21fffc47f299d8710801.zip
op-kernel-dev-fc04cb49a898c372a22b21fffc47f299d8710801.tar.gz
ext4: fix lock order problem in ext4_move_extents()
ext4_move_extents() checks the logical block contiguousness of original file with ext4_find_extent() and mext_next_extent(). Therefore the extent which ext4_ext_path structure indicates must not be changed between above functions. But in current implementation, there is no i_data_sem protection between ext4_ext_find_extent() and mext_next_extent(). So the extent which ext4_ext_path structure indicates may be overwritten by delalloc. As a result, ext4_move_extents() will exchange wrong blocks between original and donor files. I change the place where acquire/release i_data_sem to solve this problem. Moreover, I changed move_extent_per_page() to start transaction first, and then acquire i_data_sem. Without this change, there is a possibility of the deadlock between mmap() and ext4_move_extents(): * NOTE: "A", "B" and "C" mean different processes A-1: ext4_ext_move_extents() acquires i_data_sem of two inodes. B: do_page_fault() starts the transaction (T), and then tries to acquire i_data_sem. But process "A" is already holding it, so it is kept waiting. C: While "A" and "B" running, kjournald2 tries to commit transaction (T) but it is under updating, so kjournald2 waits for it. A-2: Call ext4_journal_start with holding i_data_sem, but transaction (T) is locked. Signed-off-by: Akira Fujita <a-fujita@rs.jp.nec.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/timerfd.c')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud