Commit d4d09464 authored by Christian Brauner's avatar Christian Brauner Committed by David Sterba

btrfs: allow idmapped setattr inode op

Enable btrfs_setattr() to handle idmapped mounts. This is just a matter
of passing down the mount's userns.
Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
Signed-off-by: default avatarChristian Brauner <christian.brauner@ubuntu.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 98b6ab5f
...@@ -5392,7 +5392,7 @@ static int btrfs_setattr(struct user_namespace *mnt_userns, struct dentry *dentr ...@@ -5392,7 +5392,7 @@ static int btrfs_setattr(struct user_namespace *mnt_userns, struct dentry *dentr
if (btrfs_root_readonly(root)) if (btrfs_root_readonly(root))
return -EROFS; return -EROFS;
err = setattr_prepare(&init_user_ns, dentry, attr); err = setattr_prepare(mnt_userns, dentry, attr);
if (err) if (err)
return err; return err;
...@@ -5403,13 +5403,12 @@ static int btrfs_setattr(struct user_namespace *mnt_userns, struct dentry *dentr ...@@ -5403,13 +5403,12 @@ static int btrfs_setattr(struct user_namespace *mnt_userns, struct dentry *dentr
} }
if (attr->ia_valid) { if (attr->ia_valid) {
setattr_copy(&init_user_ns, inode, attr); setattr_copy(mnt_userns, inode, attr);
inode_inc_iversion(inode); inode_inc_iversion(inode);
err = btrfs_dirty_inode(inode); err = btrfs_dirty_inode(inode);
if (!err && attr->ia_valid & ATTR_MODE) if (!err && attr->ia_valid & ATTR_MODE)
err = posix_acl_chmod(&init_user_ns, inode, err = posix_acl_chmod(mnt_userns, inode, inode->i_mode);
inode->i_mode);
} }
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment