Commit 9bfdc2f8 authored by Luis Henriques's avatar Luis Henriques

Revert "UBUNTU: SAUCE: (namespace) fuse: Translate ids in posix acl xattrs"

BugLink: https://bugs.launchpad.net/bugs/1644165

This reverts commit 2036ce60.

The kernel fix for bug #1634964 breaks LXD userspace, in particular the
following commits:

ac7f3f73 (namespace) vfs: Don't modify inodes with a uid or gid unknown to the vfs
ca52383a (namespace) vfs: Don't create inodes with a uid or gid unknown to the vfs

LXD 2.0.6 will include changes to support these kernel changes, but it isn't
available yet on xenial, so for now we just revert these commits.
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent c6d4a5d2
......@@ -13,8 +13,6 @@
#include <linux/sched.h>
#include <linux/namei.h>
#include <linux/slab.h>
#include <uapi/linux/xattr.h>
#include <linux/posix_acl_xattr.h>
static bool fuse_use_readdirplus(struct inode *dir, struct dir_context *ctx)
{
......@@ -1759,24 +1757,12 @@ static int fuse_setxattr(struct dentry *entry, const char *name,
struct inode *inode = d_inode(entry);
struct fuse_conn *fc = get_fuse_conn(inode);
FUSE_ARGS(args);
void *buf = NULL;
struct fuse_setxattr_in inarg;
int err;
if (fc->no_setxattr)
return -EOPNOTSUPP;
if (!strcmp(name, XATTR_NAME_POSIX_ACL_ACCESS) ||
!strcmp(name, XATTR_NAME_POSIX_ACL_DEFAULT)) {
buf = kmemdup(value, size, GFP_KERNEL);
if (!buf)
return -ENOMEM;
err = posix_acl_fix_xattr_userns(inode->i_sb->s_user_ns,
&init_user_ns, buf, size);
if (err)
goto out;
}
memset(&inarg, 0, sizeof(inarg));
inarg.size = size;
inarg.flags = flags;
......@@ -1788,7 +1774,7 @@ static int fuse_setxattr(struct dentry *entry, const char *name,
args.in.args[1].size = strlen(name) + 1;
args.in.args[1].value = name;
args.in.args[2].size = size;
args.in.args[2].value = buf ? buf : value;
args.in.args[2].value = value;
err = fuse_simple_request(fc, &args);
if (err == -ENOSYS) {
fc->no_setxattr = 1;
......@@ -1798,8 +1784,6 @@ static int fuse_setxattr(struct dentry *entry, const char *name,
fuse_invalidate_attr(inode);
fuse_update_ctime(inode);
}
out:
kfree(buf);
return err;
}
......@@ -1836,16 +1820,8 @@ static ssize_t fuse_getxattr(struct dentry *entry, const char *name,
args.out.args[0].value = &outarg;
}
ret = fuse_simple_request(fc, &args);
if (!ret) {
if (!size) {
ret = outarg.size;
} else if (!strcmp(name, XATTR_NAME_POSIX_ACL_ACCESS) ||
!strcmp(name, XATTR_NAME_POSIX_ACL_DEFAULT)) {
ret = posix_acl_fix_xattr_userns(&init_user_ns,
inode->i_sb->s_user_ns,
value, size);
}
}
if (!ret && !size)
ret = outarg.size;
if (ret == -ENOSYS) {
fc->no_getxattr = 1;
ret = -EOPNOTSUPP;
......
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