summary refs log tree commit diff
path: root/fs/ext4/xattr.c
diff options
context:
space:
mode:
authorTahsin Erdogan <tahsin@google.com>2017-06-21 22:02:06 -0400
committerTheodore Ts'o <tytso@mit.edu>2017-06-21 22:02:06 -0400
commit0bd454c04f02e7bb101d8ff510b54826eda4a5f0 (patch)
tree2be30a10b0e7b7ddc2c653a4f8243dc7a2be7eae /fs/ext4/xattr.c
parent990461dd85d57875accc798919e6fe42ab7e294d (diff)
downloadlinux-0bd454c04f02e7bb101d8ff510b54826eda4a5f0.tar.gz
ext4: ext4_xattr_value_same() should return false for external data
ext4_xattr_value_same() is used as a quick optimization in case the new
xattr value is identical to the previous value. When xattr value is
stored in a xattr inode the check becomes expensive so it is better to
just assume that they are not equal.

Signed-off-by: Tahsin Erdogan <tahsin@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/xattr.c')
-rw-r--r--fs/ext4/xattr.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index 3983bc455d02..13b7fa4cbf16 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -1426,6 +1426,9 @@ static int ext4_xattr_value_same(struct ext4_xattr_search *s,
 {
 	void *value;
 
+	/* When e_value_inum is set the value is stored externally. */
+	if (s->here->e_value_inum)
+		return 0;
 	if (le32_to_cpu(s->here->e_value_size) != i->value_len)
 		return 0;
 	value = ((void *)s->base) + le16_to_cpu(s->here->e_value_offs);