diff mbox series

[1/5] ext4: never move the system.data xattr out of the inode body

Message ID 20180618032232.25481-1-tytso@mit.edu
State Accepted, archived
Headers show
Series [1/5] ext4: never move the system.data xattr out of the inode body | expand

Commit Message

Theodore Ts'o June 18, 2018, 3:22 a.m. UTC
When expanding the extra isize space, we must never move the
system.data xattr out of the inode body.  For performance reasons, it
doesn't make any sense, and the inline data implementation assumes
that system.data xattr is never in the external xattr block.

https://bugzilla.kernel.org/show_bug.cgi?id=200005

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
 fs/ext4/xattr.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Andreas Dilger June 18, 2018, 5:50 p.m. UTC | #1
On Jun 17, 2018, at 9:22 PM, Theodore Ts'o <tytso@mit.edu> wrote:
> 
> When expanding the extra isize space, we must never move the
> system.data xattr out of the inode body.  For performance reasons, it
> doesn't make any sense, and the inline data implementation assumes
> that system.data xattr is never in the external xattr block.
> 
> https://bugzilla.kernel.org/show_bug.cgi?id=200005
> 
> Signed-off-by: Theodore Ts'o <tytso@mit.edu>

Reviewed-by: Andreas Dilger <adilger@dilger.ca>

> ---
> fs/ext4/xattr.c | 5 +++++
> 1 file changed, 5 insertions(+)
> 
> diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
> index 0263692979ec..72377b77fbd7 100644
> --- a/fs/ext4/xattr.c
> +++ b/fs/ext4/xattr.c
> @@ -2657,6 +2657,11 @@ static int ext4_xattr_make_inode_space(handle_t *handle, struct inode *inode,
> 		last = IFIRST(header);
> 		/* Find the entry best suited to be pushed into EA block */
> 		for (; !IS_LAST_ENTRY(last); last = EXT4_XATTR_NEXT(last)) {
> +			/* never move system.data out of the inode */
> +			if ((last->e_name_len == 4) &&
> +			    (last->e_name_index == EXT4_XATTR_INDEX_SYSTEM) &&
> +			    !memcmp(last->e_name, "data", 4))
> +				continue;
> 			total_size = EXT4_XATTR_LEN(last->e_name_len);
> 			if (!last->e_value_inum)
> 				total_size += EXT4_XATTR_SIZE(
> --
> 2.18.0.rc0
> 


Cheers, Andreas
diff mbox series

Patch

diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index 0263692979ec..72377b77fbd7 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -2657,6 +2657,11 @@  static int ext4_xattr_make_inode_space(handle_t *handle, struct inode *inode,
 		last = IFIRST(header);
 		/* Find the entry best suited to be pushed into EA block */
 		for (; !IS_LAST_ENTRY(last); last = EXT4_XATTR_NEXT(last)) {
+			/* never move system.data out of the inode */
+			if ((last->e_name_len == 4) &&
+			    (last->e_name_index == EXT4_XATTR_INDEX_SYSTEM) &&
+			    !memcmp(last->e_name, "data", 4))
+				continue;
 			total_size = EXT4_XATTR_LEN(last->e_name_len);
 			if (!last->e_value_inum)
 				total_size += EXT4_XATTR_SIZE(