@@ -2032,6 +2032,13 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr)
dout("setattr %p issued %s\n", inode, ceph_cap_string(issued));
+ /*
+ * The attr->ia_{g,u}id members contain the target {g,u}id we're
+ * sending over the wire. The mount idmapping only matters when we
+ * create new filesystem objects based on the caller's mapped
+ * fs{g,u}id.
+ */
+ req->mnt_userns = &init_user_ns;
if (ia_valid & ATTR_UID) {
dout("setattr %p uid %d -> %d\n", inode,
from_kuid(&init_user_ns, inode->i_uid),
@@ -2222,7 +2229,7 @@ int ceph_setattr(struct user_namespace *mnt_userns, struct dentry *dentry,
if (ceph_inode_is_shutdown(inode))
return -ESTALE;
- err = setattr_prepare(&init_user_ns, dentry, attr);
+ err = setattr_prepare(mnt_userns, dentry, attr);
if (err != 0)
return err;
@@ -2237,7 +2244,7 @@ int ceph_setattr(struct user_namespace *mnt_userns, struct dentry *dentry,
err = __ceph_setattr(inode, attr);
if (err >= 0 && (attr->ia_valid & ATTR_MODE))
- err = posix_acl_chmod(&init_user_ns, inode, attr->ia_mode);
+ err = posix_acl_chmod(mnt_userns, inode, attr->ia_mode);
return err;
}