summaryrefslogtreecommitdiffstats
path: root/fs/ext4/xattr.c
diff options
context:
space:
mode:
authorMiao Xie <miaoxie@huawei.com>2017-08-06 00:27:38 -0400
committerTheodore Ts'o <tytso@mit.edu>2017-08-06 00:27:38 -0400
commit3b10fdc6d8bd048f4fb14af5eda2051ace7b8b16 (patch)
treecab4fdbe9b87cda858f93fa1b89519d69a9fd4df /fs/ext4/xattr.c
parent9699d4f91d9bd2f70dcc37afe3c9f18145ab2dba (diff)
downloadlinux-3b10fdc6d8bd048f4fb14af5eda2051ace7b8b16.tar.bz2
ext4: fix forgetten xattr lock protection in ext4_expand_extra_isize
We should avoid the contention between the i_extra_isize update and the inline data insertion, so move the xattr trylock in front of i_extra_isize update. Signed-off-by: Miao Xie <miaoxie@huawei.com> Reviewed-by: Wang Shilong <wshilong@ddn.com>
Diffstat (limited to 'fs/ext4/xattr.c')
-rw-r--r--fs/ext4/xattr.c10
1 files changed, 0 insertions, 10 deletions
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index 5fa912e5d2a6..862ba3891398 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -2645,10 +2645,6 @@ int ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize,
int error = 0, tried_min_extra_isize = 0;
int s_min_extra_isize = le16_to_cpu(EXT4_SB(inode->i_sb)->s_es->s_min_extra_isize);
int isize_diff; /* How much do we need to grow i_extra_isize */
- int no_expand;
-
- if (ext4_write_trylock_xattr(inode, &no_expand) == 0)
- return 0;
retry:
isize_diff = new_extra_isize - EXT4_I(inode)->i_extra_isize;
@@ -2731,16 +2727,10 @@ shift:
EXT4_I(inode)->i_extra_isize = new_extra_isize;
brelse(bh);
out:
- ext4_write_unlock_xattr(inode, &no_expand);
return 0;
cleanup:
brelse(bh);
- /*
- * Inode size expansion failed; don't try again
- */
- no_expand = 1;
- ext4_write_unlock_xattr(inode, &no_expand);
return error;
}