diff options
Diffstat (limited to 'fs/ext3')
-rw-r--r-- | fs/ext3/xattr.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/fs/ext3/xattr.c b/fs/ext3/xattr.c index 32e6cc23bd9a..d565759d82ee 100644 --- a/fs/ext3/xattr.c +++ b/fs/ext3/xattr.c | |||
@@ -803,8 +803,16 @@ inserted: | |||
803 | /* We need to allocate a new block */ | 803 | /* We need to allocate a new block */ |
804 | ext3_fsblk_t goal = ext3_group_first_block_no(sb, | 804 | ext3_fsblk_t goal = ext3_group_first_block_no(sb, |
805 | EXT3_I(inode)->i_block_group); | 805 | EXT3_I(inode)->i_block_group); |
806 | ext3_fsblk_t block = ext3_new_block(handle, inode, | 806 | ext3_fsblk_t block; |
807 | goal, &error); | 807 | |
808 | /* | ||
809 | * Protect us agaist concurrent allocations to the | ||
810 | * same inode from ext3_..._writepage(). Reservation | ||
811 | * code does not expect racing allocations. | ||
812 | */ | ||
813 | mutex_lock(&EXT3_I(inode)->truncate_mutex); | ||
814 | block = ext3_new_block(handle, inode, goal, &error); | ||
815 | mutex_unlock(&EXT3_I(inode)->truncate_mutex); | ||
808 | if (error) | 816 | if (error) |
809 | goto cleanup; | 817 | goto cleanup; |
810 | ea_idebug(inode, "creating block %d", block); | 818 | ea_idebug(inode, "creating block %d", block); |