2.6.27-longterm review patch. If anyone has any objections, please let us know.

------------------

commit ad95c5e9bc8b5885f94dce720137cac8fa8da4c9 upstream.

Block allocation is called from two places: ext3_get_blocks_handle() andext3_xattr_block_set(). These two callers are not necessarily synchronizedbecause xattr code holds only xattr_sem and i_mutex, andext3_get_blocks_handle() may hold only truncate_mutex when called fromwritepage() path. Block reservation code does not expect two concurrentallocations to happen to the same inode and thus assertions can be triggeredor reservation structure corruption can occur.

Fix the problem by taking truncate_mutex in xattr code to serializeallocations.