]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
ext3: Fix oops in ext3_try_to_allocate_with_rsv()
authorJan Kara <jack@suse.cz>
Mon, 30 May 2011 11:29:20 +0000 (13:29 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 8 Aug 2011 17:36:02 +0000 (10:36 -0700)
commit541d2d2fb60c88244a31b7d6f0460fc2d6d1c341
tree5dac4c1cd61615fc701e7c324a28c797507d62f5
parentffbe3723f2af0edae78692b24cd50f123e3282be
ext3: Fix oops in ext3_try_to_allocate_with_rsv()

commit ad95c5e9bc8b5885f94dce720137cac8fa8da4c9 upstream.

Block allocation is called from two places: ext3_get_blocks_handle() and
ext3_xattr_block_set(). These two callers are not necessarily synchronized
because xattr code holds only xattr_sem and i_mutex, and
ext3_get_blocks_handle() may hold only truncate_mutex when called from
writepage() path. Block reservation code does not expect two concurrent
allocations to happen to the same inode and thus assertions can be triggered
or reservation structure corruption can occur.

Fix the problem by taking truncate_mutex in xattr code to serialize
allocations.

CC: Sage Weil <sage@newdream.net>
Reported-by: Fyodor Ustinov <ufm@ufm.su>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/ext3/xattr.c