ext4: Fix locking hierarchy violation in ext4_fallocate()
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Fri, 15 Feb 2008 17:47:21 +0000 (12:47 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 15 Feb 2008 17:47:21 +0000 (12:47 -0500)
commit55bd725aa3a83b3935988f37275b5a80e10d4169
tree9e4c092830eafbb0036892d578d4075689ef81df
parent642be6ec218b956fbae88304449720f76ba0d578
ext4: Fix locking hierarchy violation in ext4_fallocate()

ext4_fallocate() was trying to acquire i_data_sem outside of
jbd2_start_transaction/jbd2_journal_stop, which violates ext4's locking
hierarchy.  So we take i_mutex to prevent writes and truncates during
the complete fallocate operation, and use ext4_get_block_wrap() which
acquires and releases i_data_sem for each block allocation.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Mingming Cao <cmm@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
fs/ext4/extents.c