[Devel] [PATCH RHEL7 COMMIT] Revert "ms/quota: Ensure qids map to the filesystem"

Konstantin Khorenko khorenko at virtuozzo.com
Fri Jul 21 11:00:34 MSK 2017


The commit is pushed to "branch-rh7-3.10.0-514.26.1.vz7.33.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-514.26.1.vz7.33.12
------>
commit e87ad8f11209ee1e0a3431767b833e40af13d716
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Fri Jul 21 11:57:07 2017 +0400

    Revert "ms/quota: Ensure qids map to the filesystem"
    
    This reverts commit 6e13100e43666b3ee691cb1eb46fce150d41e3dc.
    
    Temporary revert due to
    https://jira.sw.ru/browse/PSBM-68599
    
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 fs/quota/dquot.c      |  3 ---
 fs/quota/quota.c      | 12 ++++++------
 include/linux/quota.h | 10 ----------
 3 files changed, 6 insertions(+), 19 deletions(-)

diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index df89720..89089a9 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -825,9 +825,6 @@ struct dquot *dqget(struct super_block *sb, struct kqid qid)
 	unsigned int hashent = hashfn(sb, qid);
 	struct dquot *dquot = NULL, *empty = NULL;
 
-	if (!qid_has_mapping(sb->s_user_ns, qid))
-		return ERR_PTR(-EINVAL);
-
         if (!sb_has_quota_active(sb, qid.type))
 		return NULL;
 we_slept:
diff --git a/fs/quota/quota.c b/fs/quota/quota.c
index 3853373..6611d8c 100644
--- a/fs/quota/quota.c
+++ b/fs/quota/quota.c
@@ -140,7 +140,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)
@@ -166,7 +166,7 @@ static int quota_getnextquota(struct super_block *sb, int type, qid_t id,
 	if (!sb_has_nextdqblk(sb) || !sb->s_qcop->get_nextdqblk)
 		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_nextdqblk(sb, &qid, &fdq);
 	if (ret)
@@ -217,7 +217,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);
@@ -283,7 +283,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;
 	return sb->s_qcop->set_dqblk(sb, qid, &fdq);
 }
@@ -298,7 +298,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, &fdq);
 	if (!ret && copy_to_user(addr, &fdq, sizeof(fdq)))
@@ -321,7 +321,7 @@ static int quota_getnextxquota(struct super_block *sb, int type, qid_t id,
 	if (!sb_has_nextdqblk(sb) || !sb->s_qcop->get_nextdqblk)
 		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_nextdqblk(sb, &qid, &fdq);
 	if (ret)
diff --git a/include/linux/quota.h b/include/linux/quota.h
index e148af3..7e955f0 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -175,16 +175,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;
 


More information about the Devel mailing list