aboutsummaryrefslogtreecommitdiffstats
path: root/fs/quota
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-09-16 06:11:50 -0400
committerEric W. Biederman <ebiederm@xmission.com>2012-09-18 04:01:40 -0400
commitaca645a6a54e001e004f1f1e0eafd94f994bb1b3 (patch)
tree6e143c0077f22d5f3487d67408e7015805f74a69 /fs/quota
parent431f19744d15531825cdbc8e771b43854b0d005b (diff)
userns: Modify dqget to take struct kqid
Modify dqget to take struct kqid instead of a type and an identifier pair. Modify the callers of dqget in ocfs2 and dquot to take generate a struct kqid so they can continue to call dqget. The conversion to create struct kqid should all be the final conversions that are needed in those code paths. Cc: Jan Kara <jack@suse.cz> Cc: Mark Fasheh <mfasheh@suse.com> Cc: Joel Becker <jlbec@evilplan.org> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'fs/quota')
-rw-r--r--fs/quota/dquot.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 80d337822462..53e377a59b05 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -829,8 +829,10 @@ static struct dquot *get_empty_dquot(struct super_block *sb, int type)
829 * a) checking for quota flags under dq_list_lock and 829 * a) checking for quota flags under dq_list_lock and
830 * b) getting a reference to dquot before we release dq_list_lock 830 * b) getting a reference to dquot before we release dq_list_lock
831 */ 831 */
832struct dquot *dqget(struct super_block *sb, unsigned int id, int type) 832struct dquot *dqget(struct super_block *sb, struct kqid qid)
833{ 833{
834 unsigned int type = qid.type;
835 unsigned int id = from_kqid(&init_user_ns, qid);
834 unsigned int hashent = hashfn(sb, id, type); 836 unsigned int hashent = hashfn(sb, id, type);
835 struct dquot *dquot = NULL, *empty = NULL; 837 struct dquot *dquot = NULL, *empty = NULL;
836 838
@@ -1390,7 +1392,6 @@ static int dquot_active(const struct inode *inode)
1390 */ 1392 */
1391static void __dquot_initialize(struct inode *inode, int type) 1393static void __dquot_initialize(struct inode *inode, int type)
1392{ 1394{
1393 unsigned int id = 0;
1394 int cnt; 1395 int cnt;
1395 struct dquot *got[MAXQUOTAS]; 1396 struct dquot *got[MAXQUOTAS];
1396 struct super_block *sb = inode->i_sb; 1397 struct super_block *sb = inode->i_sb;
@@ -1403,18 +1404,19 @@ static void __dquot_initialize(struct inode *inode, int type)
1403 1404
1404 /* First get references to structures we might need. */ 1405 /* First get references to structures we might need. */
1405 for (cnt = 0; cnt < MAXQUOTAS; cnt++) { 1406 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
1407 struct kqid qid;
1406 got[cnt] = NULL; 1408 got[cnt] = NULL;
1407 if (type != -1 && cnt != type) 1409 if (type != -1 && cnt != type)
1408 continue; 1410 continue;
1409 switch (cnt) { 1411 switch (cnt) {
1410 case USRQUOTA: 1412 case USRQUOTA:
1411 id = inode->i_uid; 1413 qid = make_kqid_uid(inode->i_uid);
1412 break; 1414 break;
1413 case GRPQUOTA: 1415 case GRPQUOTA:
1414 id = inode->i_gid; 1416 qid = make_kqid_gid(inode->i_gid);
1415 break; 1417 break;
1416 } 1418 }
1417 got[cnt] = dqget(sb, id, cnt); 1419 got[cnt] = dqget(sb, qid);
1418 } 1420 }
1419 1421
1420 down_write(&sb_dqopt(sb)->dqptr_sem); 1422 down_write(&sb_dqopt(sb)->dqptr_sem);
@@ -1898,9 +1900,9 @@ int dquot_transfer(struct inode *inode, struct iattr *iattr)
1898 return 0; 1900 return 0;
1899 1901
1900 if (iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) 1902 if (iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid)
1901 transfer_to[USRQUOTA] = dqget(sb, iattr->ia_uid, USRQUOTA); 1903 transfer_to[USRQUOTA] = dqget(sb, make_kqid_uid(iattr->ia_uid));
1902 if (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid) 1904 if (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)
1903 transfer_to[GRPQUOTA] = dqget(sb, iattr->ia_gid, GRPQUOTA); 1905 transfer_to[GRPQUOTA] = dqget(sb, make_kqid_gid(iattr->ia_gid));
1904 1906
1905 ret = __dquot_transfer(inode, transfer_to); 1907 ret = __dquot_transfer(inode, transfer_to);
1906 dqput_all(transfer_to); 1908 dqput_all(transfer_to);
@@ -2381,7 +2383,7 @@ int dquot_get_dqblk(struct super_block *sb, struct kqid qid,
2381{ 2383{
2382 struct dquot *dquot; 2384 struct dquot *dquot;
2383 2385
2384 dquot = dqget(sb, qid.type, from_kqid(&init_user_ns, qid)); 2386 dquot = dqget(sb, qid);
2385 if (!dquot) 2387 if (!dquot)
2386 return -ESRCH; 2388 return -ESRCH;
2387 do_get_dqblk(dquot, di); 2389 do_get_dqblk(dquot, di);
@@ -2494,7 +2496,7 @@ int dquot_set_dqblk(struct super_block *sb, struct kqid qid,
2494 struct dquot *dquot; 2496 struct dquot *dquot;
2495 int rc; 2497 int rc;
2496 2498
2497 dquot = dqget(sb, qid.type, from_kqid(&init_user_ns, qid)); 2499 dquot = dqget(sb, qid);
2498 if (!dquot) { 2500 if (!dquot) {
2499 rc = -ESRCH; 2501 rc = -ESRCH;
2500 goto out; 2502 goto out;