]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
Revert "(namespace) quota: Ensure qids map to the filesystem"
authorLuis Henriques <luis.henriques@canonical.com>
Wed, 23 Nov 2016 10:00:35 +0000 (10:00 +0000)
committerLuis Henriques <luis.henriques@canonical.com>
Wed, 23 Nov 2016 10:14:15 +0000 (10:14 +0000)
BugLink: https://bugs.launchpad.net/bugs/1644165
This reverts commit ec41f5ac648ff7bd3ae671d67483b5290bff68e6.

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

ac7f3f73cb39 (namespace) vfs: Don't modify inodes with a uid or gid unknown to the vfs
ca52383ad6a6 (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: Luis Henriques <luis.henriques@canonical.com>
fs/quota/dquot.c
fs/quota/quota.c
include/linux/quota.h

index 25db359d6ec830901658a798d5b36c84ffcb3a49..353ff31dcee17a19af0ffdc67c25dde9f0eaa1d9 100644 (file)
@@ -834,9 +834,6 @@ struct dquot *dqget(struct super_block *sb, struct kqid qid)
        unsigned int hashent = hashfn(sb, qid);
        struct dquot *dquot, *empty = NULL;
 
-       if (!qid_has_mapping(sb->s_user_ns, qid))
-               return ERR_PTR(-EINVAL);
-
         if (!sb_has_quota_active(sb, qid.type))
                return ERR_PTR(-ESRCH);
 we_slept:
index 7fc43921e6d197a902d26070c7d1ae9b9b8e6f76..a40eaecbd5cc6c475081501d3a5000893bebca87 100644 (file)
@@ -211,7 +211,7 @@ static int quota_getquota(struct super_block *sb, int type, qid_t id,
        if (!sb->s_qcop->get_dqblk)
                return -ENOSYS;
        qid = make_kqid(current_user_ns(), type, id);
-       if (!qid_has_mapping(sb->s_user_ns, qid))
+       if (!qid_valid(qid))
                return -EINVAL;
        ret = sb->s_qcop->get_dqblk(sb, qid, &fdq);
        if (ret)
@@ -260,7 +260,7 @@ static int quota_setquota(struct super_block *sb, int type, qid_t id,
        if (!sb->s_qcop->set_dqblk)
                return -ENOSYS;
        qid = make_kqid(current_user_ns(), type, id);
-       if (!qid_has_mapping(sb->s_user_ns, qid))
+       if (!qid_valid(qid))
                return -EINVAL;
        copy_from_if_dqblk(&fdq, &idq);
        return sb->s_qcop->set_dqblk(sb, qid, &fdq);
@@ -553,7 +553,7 @@ static int quota_setxquota(struct super_block *sb, int type, qid_t id,
        if (!sb->s_qcop->set_dqblk)
                return -ENOSYS;
        qid = make_kqid(current_user_ns(), type, id);
-       if (!qid_has_mapping(sb->s_user_ns, qid))
+       if (!qid_valid(qid))
                return -EINVAL;
        /* Are we actually setting timer / warning limits for all users? */
        if (from_kqid(&init_user_ns, qid) == 0 &&
@@ -614,7 +614,7 @@ static int quota_getxquota(struct super_block *sb, int type, qid_t id,
        if (!sb->s_qcop->get_dqblk)
                return -ENOSYS;
        qid = make_kqid(current_user_ns(), type, id);
-       if (!qid_has_mapping(sb->s_user_ns, qid))
+       if (!qid_valid(qid))
                return -EINVAL;
        ret = sb->s_qcop->get_dqblk(sb, qid, &qdq);
        if (ret)
index 760d7c92a011c31f9ef9729b1e9ff4f91896d209..b2505acfd3c078c70e733f7d9e826cfc4b6c9524 100644 (file)
@@ -179,16 +179,6 @@ static inline struct kqid make_kqid_projid(kprojid_t projid)
        return kqid;
 }
 
-/**
- *     qid_has_mapping - Report if a qid maps into a user namespace.
- *     @ns:  The user namespace to see if a value maps into.
- *     @qid: The kernel internal quota identifier to test.
- */
-static inline bool qid_has_mapping(struct user_namespace *ns, struct kqid qid)
-{
-       return from_kqid(ns, qid) != (qid_t) -1;
-}
-
 
 extern spinlock_t dq_data_lock;