From 866d2df80fe547ec2fc061891452dbce0ffa0f19 Mon Sep 17 00:00:00 2001 From: Jan Kara Date: Mon, 30 May 2011 13:29:20 +0200 Subject: [PATCH] --- yaml --- r: 260315 b: refs/heads/master c: ad95c5e9bc8b5885f94dce720137cac8fa8da4c9 h: refs/heads/master i: 260313: ebe3f126b9eeea1e424ff8b8c88cac52fd0d9f2d 260311: a80823ca06e0cabe42fc9800937e7e3c933580f3 v: v3 --- [refs] | 2 +- trunk/fs/ext3/xattr.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) 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);