aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/quota.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/gfs2/quota.c')
-rw-r--r--fs/gfs2/quota.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index a3bde91645c2..b3115392d68f 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -1469,7 +1469,7 @@ static int gfs2_quota_get_xstate(struct super_block *sb,
1469 return 0; 1469 return 0;
1470} 1470}
1471 1471
1472static int gfs2_get_dqblk(struct super_block *sb, int type, qid_t id, 1472static int gfs2_get_dqblk(struct super_block *sb, struct kqid qid,
1473 struct fs_disk_quota *fdq) 1473 struct fs_disk_quota *fdq)
1474{ 1474{
1475 struct gfs2_sbd *sdp = sb->s_fs_info; 1475 struct gfs2_sbd *sdp = sb->s_fs_info;
@@ -1477,20 +1477,21 @@ static int gfs2_get_dqblk(struct super_block *sb, int type, qid_t id,
1477 struct gfs2_quota_data *qd; 1477 struct gfs2_quota_data *qd;
1478 struct gfs2_holder q_gh; 1478 struct gfs2_holder q_gh;
1479 int error; 1479 int error;
1480 int type;
1480 1481
1481 memset(fdq, 0, sizeof(struct fs_disk_quota)); 1482 memset(fdq, 0, sizeof(struct fs_disk_quota));
1482 1483
1483 if (sdp->sd_args.ar_quota == GFS2_QUOTA_OFF) 1484 if (sdp->sd_args.ar_quota == GFS2_QUOTA_OFF)
1484 return -ESRCH; /* Crazy XFS error code */ 1485 return -ESRCH; /* Crazy XFS error code */
1485 1486
1486 if (type == USRQUOTA) 1487 if (qid.type == USRQUOTA)
1487 type = QUOTA_USER; 1488 type = QUOTA_USER;
1488 else if (type == GRPQUOTA) 1489 else if (qid.type == GRPQUOTA)
1489 type = QUOTA_GROUP; 1490 type = QUOTA_GROUP;
1490 else 1491 else
1491 return -EINVAL; 1492 return -EINVAL;
1492 1493
1493 error = qd_get(sdp, type, id, &qd); 1494 error = qd_get(sdp, type, from_kqid(&init_user_ns, qid), &qd);
1494 if (error) 1495 if (error)
1495 return error; 1496 return error;
1496 error = do_glock(qd, FORCE, &q_gh); 1497 error = do_glock(qd, FORCE, &q_gh);
@@ -1500,7 +1501,7 @@ static int gfs2_get_dqblk(struct super_block *sb, int type, qid_t id,
1500 qlvb = (struct gfs2_quota_lvb *)qd->qd_gl->gl_lvb; 1501 qlvb = (struct gfs2_quota_lvb *)qd->qd_gl->gl_lvb;
1501 fdq->d_version = FS_DQUOT_VERSION; 1502 fdq->d_version = FS_DQUOT_VERSION;
1502 fdq->d_flags = (type == QUOTA_USER) ? FS_USER_QUOTA : FS_GROUP_QUOTA; 1503 fdq->d_flags = (type == QUOTA_USER) ? FS_USER_QUOTA : FS_GROUP_QUOTA;
1503 fdq->d_id = id; 1504 fdq->d_id = from_kqid(&init_user_ns, qid);
1504 fdq->d_blk_hardlimit = be64_to_cpu(qlvb->qb_limit) << sdp->sd_fsb2bb_shift; 1505 fdq->d_blk_hardlimit = be64_to_cpu(qlvb->qb_limit) << sdp->sd_fsb2bb_shift;
1505 fdq->d_blk_softlimit = be64_to_cpu(qlvb->qb_warn) << sdp->sd_fsb2bb_shift; 1506 fdq->d_blk_softlimit = be64_to_cpu(qlvb->qb_warn) << sdp->sd_fsb2bb_shift;
1506 fdq->d_bcount = be64_to_cpu(qlvb->qb_value) << sdp->sd_fsb2bb_shift; 1507 fdq->d_bcount = be64_to_cpu(qlvb->qb_value) << sdp->sd_fsb2bb_shift;
@@ -1514,7 +1515,7 @@ out:
1514/* GFS2 only supports a subset of the XFS fields */ 1515/* GFS2 only supports a subset of the XFS fields */
1515#define GFS2_FIELDMASK (FS_DQ_BSOFT|FS_DQ_BHARD|FS_DQ_BCOUNT) 1516#define GFS2_FIELDMASK (FS_DQ_BSOFT|FS_DQ_BHARD|FS_DQ_BCOUNT)
1516 1517
1517static int gfs2_set_dqblk(struct super_block *sb, int type, qid_t id, 1518static int gfs2_set_dqblk(struct super_block *sb, struct kqid qid,
1518 struct fs_disk_quota *fdq) 1519 struct fs_disk_quota *fdq)
1519{ 1520{
1520 struct gfs2_sbd *sdp = sb->s_fs_info; 1521 struct gfs2_sbd *sdp = sb->s_fs_info;
@@ -1526,11 +1527,12 @@ static int gfs2_set_dqblk(struct super_block *sb, int type, qid_t id,
1526 int alloc_required; 1527 int alloc_required;
1527 loff_t offset; 1528 loff_t offset;
1528 int error; 1529 int error;
1530 int type;
1529 1531
1530 if (sdp->sd_args.ar_quota == GFS2_QUOTA_OFF) 1532 if (sdp->sd_args.ar_quota == GFS2_QUOTA_OFF)
1531 return -ESRCH; /* Crazy XFS error code */ 1533 return -ESRCH; /* Crazy XFS error code */
1532 1534
1533 switch(type) { 1535 switch(qid.type) {
1534 case USRQUOTA: 1536 case USRQUOTA:
1535 type = QUOTA_USER; 1537 type = QUOTA_USER;
1536 if (fdq->d_flags != FS_USER_QUOTA) 1538 if (fdq->d_flags != FS_USER_QUOTA)
@@ -1547,10 +1549,10 @@ static int gfs2_set_dqblk(struct super_block *sb, int type, qid_t id,
1547 1549
1548 if (fdq->d_fieldmask & ~GFS2_FIELDMASK) 1550 if (fdq->d_fieldmask & ~GFS2_FIELDMASK)
1549 return -EINVAL; 1551 return -EINVAL;
1550 if (fdq->d_id != id) 1552 if (fdq->d_id != from_kqid(&init_user_ns, qid))
1551 return -EINVAL; 1553 return -EINVAL;
1552 1554
1553 error = qd_get(sdp, type, id, &qd); 1555 error = qd_get(sdp, type, from_kqid(&init_user_ns, qid), &qd);
1554 if (error) 1556 if (error)
1555 return error; 1557 return error;
1556 1558