1 ext4: ea_inode owner should be the same as the inode owner
3 From: Tahsin Erdogan <tahsin@google.com>
5 Quota charging is based on the ownership of the inode. Currently, the
6 xattr inode owner is set to the caller which may be different from the
7 parent inode owner. This is inconsistent with how quota is charged for
8 xattr block and regular data block writes.
10 Signed-off-by: Tahsin Erdogan <tahsin@google.com>
11 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13 fs/ext4/xattr.c | 3 ++-
14 1 file changed, 2 insertions(+), 1 deletion(-)
16 diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
17 index 8e123533315f..32ad2f2870e9 100644
20 @@ -826,6 +826,7 @@ static struct inode *ext4_xattr_inode_create(handle_t *handle,
23 struct inode *ea_inode = NULL;
24 + uid_t owner[2] = { i_uid_read(inode), i_gid_read(inode) };
28 @@ -833,7 +834,7 @@ static struct inode *ext4_xattr_inode_create(handle_t *handle,
29 * in the same group, or nearby one.
31 ea_inode = ext4_new_inode(handle, inode->i_sb->s_root->d_inode,
32 - S_IFREG | 0600, NULL, inode->i_ino + 1, NULL,
33 + S_IFREG | 0600, NULL, inode->i_ino + 1, owner,
35 if (!IS_ERR(ea_inode)) {
36 ea_inode->i_op = &ext4_file_inode_operations;
38 2.13.1.611.g7e3b11ae1-goog