diff --git a/[refs] b/[refs] index 6fe82ed89beb..63bdbe49619d 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: bd5c9e1854e13d0c62a3de29a5fbc15dd6a4d8c6 +refs/heads/master: ad95c5e9bc8b5885f94dce720137cac8fa8da4c9 diff --git a/trunk/fs/ext3/xattr.c b/trunk/fs/ext3/xattr.c index 32e6cc23bd9a..d565759d82ee 100644 --- a/trunk/fs/ext3/xattr.c +++ b/trunk/fs/ext3/xattr.c @@ -803,8 +803,16 @@ ext3_xattr_block_set(handle_t *handle, struct inode *inode, /* We need to allocate a new block */ ext3_fsblk_t goal = ext3_group_first_block_no(sb, EXT3_I(inode)->i_block_group); - ext3_fsblk_t block = ext3_new_block(handle, inode, - goal, &error); + ext3_fsblk_t block; + + /* + * Protect us agaist concurrent allocations to the + * same inode from ext3_..._writepage(). Reservation + * code does not expect racing allocations. + */ + mutex_lock(&EXT3_I(inode)->truncate_mutex); + block = ext3_new_block(handle, inode, goal, &error); + mutex_unlock(&EXT3_I(inode)->truncate_mutex); if (error) goto cleanup; ea_idebug(inode, "creating block %d", block);