aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTahsin Erdogan <tahsin@google.com>2017-06-21 21:27:00 -0400
committerTheodore Ts'o <tytso@mit.edu>2017-06-21 21:27:00 -0400
commit9e1ba00161a6f3bec8d4e7912025cbf889878e59 (patch)
treeab034b602e91ed6b5a147ef3d16923fb36352ab6
parentbd3b963b273e247e13979f98812a6e4979b5c1e4 (diff)
ext4: ea_inode owner should be the same as the inode owner
Quota charging is based on the ownership of the inode. Currently, the xattr inode owner is set to the caller which may be different from the parent inode owner. This is inconsistent with how quota is charged for xattr block and regular data block writes. Signed-off-by: Tahsin Erdogan <tahsin@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r--fs/ext4/xattr.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index 0b77ab944c3f..a29e68293d59 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -824,6 +824,7 @@ static struct inode *ext4_xattr_inode_create(handle_t *handle,
824 struct inode *inode) 824 struct inode *inode)
825{ 825{
826 struct inode *ea_inode = NULL; 826 struct inode *ea_inode = NULL;
827 uid_t owner[2] = { i_uid_read(inode), i_gid_read(inode) };
827 int err; 828 int err;
828 829
829 /* 830 /*
@@ -831,7 +832,7 @@ static struct inode *ext4_xattr_inode_create(handle_t *handle,
831 * in the same group, or nearby one. 832 * in the same group, or nearby one.
832 */ 833 */
833 ea_inode = ext4_new_inode(handle, inode->i_sb->s_root->d_inode, 834 ea_inode = ext4_new_inode(handle, inode->i_sb->s_root->d_inode,
834 S_IFREG | 0600, NULL, inode->i_ino + 1, NULL, 835 S_IFREG | 0600, NULL, inode->i_ino + 1, owner,
835 EXT4_EA_INODE_FL); 836 EXT4_EA_INODE_FL);
836 if (!IS_ERR(ea_inode)) { 837 if (!IS_ERR(ea_inode)) {
837 ea_inode->i_op = &ext4_file_inode_operations; 838 ea_inode->i_op = &ext4_file_inode_operations;