aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/quota_global.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ocfs2/quota_global.c')
-rw-r--r--fs/ocfs2/quota_global.c43
1 files changed, 26 insertions, 17 deletions
diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c
index 0a86e302655f..332a281f217e 100644
--- a/fs/ocfs2/quota_global.c
+++ b/fs/ocfs2/quota_global.c
@@ -95,7 +95,7 @@ static void ocfs2_global_mem2diskdqb(void *dp, struct dquot *dquot)
95 struct ocfs2_global_disk_dqblk *d = dp; 95 struct ocfs2_global_disk_dqblk *d = dp;
96 struct mem_dqblk *m = &dquot->dq_dqb; 96 struct mem_dqblk *m = &dquot->dq_dqb;
97 97
98 d->dqb_id = cpu_to_le32(dquot->dq_id); 98 d->dqb_id = cpu_to_le32(from_kqid(&init_user_ns, dquot->dq_id));
99 d->dqb_use_count = cpu_to_le32(OCFS2_DQUOT(dquot)->dq_use_count); 99 d->dqb_use_count = cpu_to_le32(OCFS2_DQUOT(dquot)->dq_use_count);
100 d->dqb_ihardlimit = cpu_to_le64(m->dqb_ihardlimit); 100 d->dqb_ihardlimit = cpu_to_le64(m->dqb_ihardlimit);
101 d->dqb_isoftlimit = cpu_to_le64(m->dqb_isoftlimit); 101 d->dqb_isoftlimit = cpu_to_le64(m->dqb_isoftlimit);
@@ -112,11 +112,14 @@ static int ocfs2_global_is_id(void *dp, struct dquot *dquot)
112{ 112{
113 struct ocfs2_global_disk_dqblk *d = dp; 113 struct ocfs2_global_disk_dqblk *d = dp;
114 struct ocfs2_mem_dqinfo *oinfo = 114 struct ocfs2_mem_dqinfo *oinfo =
115 sb_dqinfo(dquot->dq_sb, dquot->dq_type)->dqi_priv; 115 sb_dqinfo(dquot->dq_sb, dquot->dq_id.type)->dqi_priv;
116 116
117 if (qtree_entry_unused(&oinfo->dqi_gi, dp)) 117 if (qtree_entry_unused(&oinfo->dqi_gi, dp))
118 return 0; 118 return 0;
119 return le32_to_cpu(d->dqb_id) == dquot->dq_id; 119
120 return qid_eq(make_kqid(&init_user_ns, dquot->dq_id.type,
121 le32_to_cpu(d->dqb_id)),
122 dquot->dq_id);
120} 123}
121 124
122struct qtree_fmt_operations ocfs2_global_ops = { 125struct qtree_fmt_operations ocfs2_global_ops = {
@@ -475,7 +478,7 @@ int __ocfs2_sync_dquot(struct dquot *dquot, int freeing)
475{ 478{
476 int err, err2; 479 int err, err2;
477 struct super_block *sb = dquot->dq_sb; 480 struct super_block *sb = dquot->dq_sb;
478 int type = dquot->dq_type; 481 int type = dquot->dq_id.type;
479 struct ocfs2_mem_dqinfo *info = sb_dqinfo(sb, type)->dqi_priv; 482 struct ocfs2_mem_dqinfo *info = sb_dqinfo(sb, type)->dqi_priv;
480 struct ocfs2_global_disk_dqblk dqblk; 483 struct ocfs2_global_disk_dqblk dqblk;
481 s64 spacechange, inodechange; 484 s64 spacechange, inodechange;
@@ -504,7 +507,8 @@ int __ocfs2_sync_dquot(struct dquot *dquot, int freeing)
504 olditime = dquot->dq_dqb.dqb_itime; 507 olditime = dquot->dq_dqb.dqb_itime;
505 oldbtime = dquot->dq_dqb.dqb_btime; 508 oldbtime = dquot->dq_dqb.dqb_btime;
506 ocfs2_global_disk2memdqb(dquot, &dqblk); 509 ocfs2_global_disk2memdqb(dquot, &dqblk);
507 trace_ocfs2_sync_dquot(dquot->dq_id, dquot->dq_dqb.dqb_curspace, 510 trace_ocfs2_sync_dquot(from_kqid(&init_user_ns, dquot->dq_id),
511 dquot->dq_dqb.dqb_curspace,
508 (long long)spacechange, 512 (long long)spacechange,
509 dquot->dq_dqb.dqb_curinodes, 513 dquot->dq_dqb.dqb_curinodes,
510 (long long)inodechange); 514 (long long)inodechange);
@@ -555,8 +559,8 @@ int __ocfs2_sync_dquot(struct dquot *dquot, int freeing)
555 err = ocfs2_qinfo_lock(info, freeing); 559 err = ocfs2_qinfo_lock(info, freeing);
556 if (err < 0) { 560 if (err < 0) {
557 mlog(ML_ERROR, "Failed to lock quota info, losing quota write" 561 mlog(ML_ERROR, "Failed to lock quota info, losing quota write"
558 " (type=%d, id=%u)\n", dquot->dq_type, 562 " (type=%d, id=%u)\n", dquot->dq_id.type,
559 (unsigned)dquot->dq_id); 563 (unsigned)from_kqid(&init_user_ns, dquot->dq_id));
560 goto out; 564 goto out;
561 } 565 }
562 if (freeing) 566 if (freeing)
@@ -591,9 +595,10 @@ static int ocfs2_sync_dquot_helper(struct dquot *dquot, unsigned long type)
591 struct ocfs2_super *osb = OCFS2_SB(sb); 595 struct ocfs2_super *osb = OCFS2_SB(sb);
592 int status = 0; 596 int status = 0;
593 597
594 trace_ocfs2_sync_dquot_helper(dquot->dq_id, dquot->dq_type, 598 trace_ocfs2_sync_dquot_helper(from_kqid(&init_user_ns, dquot->dq_id),
599 dquot->dq_id.type,
595 type, sb->s_id); 600 type, sb->s_id);
596 if (type != dquot->dq_type) 601 if (type != dquot->dq_id.type)
597 goto out; 602 goto out;
598 status = ocfs2_lock_global_qf(oinfo, 1); 603 status = ocfs2_lock_global_qf(oinfo, 1);
599 if (status < 0) 604 if (status < 0)
@@ -643,7 +648,8 @@ static int ocfs2_write_dquot(struct dquot *dquot)
643 struct ocfs2_super *osb = OCFS2_SB(dquot->dq_sb); 648 struct ocfs2_super *osb = OCFS2_SB(dquot->dq_sb);
644 int status = 0; 649 int status = 0;
645 650
646 trace_ocfs2_write_dquot(dquot->dq_id, dquot->dq_type); 651 trace_ocfs2_write_dquot(from_kqid(&init_user_ns, dquot->dq_id),
652 dquot->dq_id.type);
647 653
648 handle = ocfs2_start_trans(osb, OCFS2_QWRITE_CREDITS); 654 handle = ocfs2_start_trans(osb, OCFS2_QWRITE_CREDITS);
649 if (IS_ERR(handle)) { 655 if (IS_ERR(handle)) {
@@ -677,11 +683,12 @@ static int ocfs2_release_dquot(struct dquot *dquot)
677{ 683{
678 handle_t *handle; 684 handle_t *handle;
679 struct ocfs2_mem_dqinfo *oinfo = 685 struct ocfs2_mem_dqinfo *oinfo =
680 sb_dqinfo(dquot->dq_sb, dquot->dq_type)->dqi_priv; 686 sb_dqinfo(dquot->dq_sb, dquot->dq_id.type)->dqi_priv;
681 struct ocfs2_super *osb = OCFS2_SB(dquot->dq_sb); 687 struct ocfs2_super *osb = OCFS2_SB(dquot->dq_sb);
682 int status = 0; 688 int status = 0;
683 689
684 trace_ocfs2_release_dquot(dquot->dq_id, dquot->dq_type); 690 trace_ocfs2_release_dquot(from_kqid(&init_user_ns, dquot->dq_id),
691 dquot->dq_id.type);
685 692
686 mutex_lock(&dquot->dq_lock); 693 mutex_lock(&dquot->dq_lock);
687 /* Check whether we are not racing with some other dqget() */ 694 /* Check whether we are not racing with some other dqget() */
@@ -691,7 +698,7 @@ static int ocfs2_release_dquot(struct dquot *dquot)
691 if (status < 0) 698 if (status < 0)
692 goto out; 699 goto out;
693 handle = ocfs2_start_trans(osb, 700 handle = ocfs2_start_trans(osb,
694 ocfs2_calc_qdel_credits(dquot->dq_sb, dquot->dq_type)); 701 ocfs2_calc_qdel_credits(dquot->dq_sb, dquot->dq_id.type));
695 if (IS_ERR(handle)) { 702 if (IS_ERR(handle)) {
696 status = PTR_ERR(handle); 703 status = PTR_ERR(handle);
697 mlog_errno(status); 704 mlog_errno(status);
@@ -733,13 +740,14 @@ static int ocfs2_acquire_dquot(struct dquot *dquot)
733 int ex = 0; 740 int ex = 0;
734 struct super_block *sb = dquot->dq_sb; 741 struct super_block *sb = dquot->dq_sb;
735 struct ocfs2_super *osb = OCFS2_SB(sb); 742 struct ocfs2_super *osb = OCFS2_SB(sb);
736 int type = dquot->dq_type; 743 int type = dquot->dq_id.type;
737 struct ocfs2_mem_dqinfo *info = sb_dqinfo(sb, type)->dqi_priv; 744 struct ocfs2_mem_dqinfo *info = sb_dqinfo(sb, type)->dqi_priv;
738 struct inode *gqinode = info->dqi_gqinode; 745 struct inode *gqinode = info->dqi_gqinode;
739 int need_alloc = ocfs2_global_qinit_alloc(sb, type); 746 int need_alloc = ocfs2_global_qinit_alloc(sb, type);
740 handle_t *handle; 747 handle_t *handle;
741 748
742 trace_ocfs2_acquire_dquot(dquot->dq_id, type); 749 trace_ocfs2_acquire_dquot(from_kqid(&init_user_ns, dquot->dq_id),
750 type);
743 mutex_lock(&dquot->dq_lock); 751 mutex_lock(&dquot->dq_lock);
744 /* 752 /*
745 * We need an exclusive lock, because we're going to update use count 753 * We need an exclusive lock, because we're going to update use count
@@ -821,12 +829,13 @@ static int ocfs2_mark_dquot_dirty(struct dquot *dquot)
821 int sync = 0; 829 int sync = 0;
822 int status; 830 int status;
823 struct super_block *sb = dquot->dq_sb; 831 struct super_block *sb = dquot->dq_sb;
824 int type = dquot->dq_type; 832 int type = dquot->dq_id.type;
825 struct ocfs2_mem_dqinfo *oinfo = sb_dqinfo(sb, type)->dqi_priv; 833 struct ocfs2_mem_dqinfo *oinfo = sb_dqinfo(sb, type)->dqi_priv;
826 handle_t *handle; 834 handle_t *handle;
827 struct ocfs2_super *osb = OCFS2_SB(sb); 835 struct ocfs2_super *osb = OCFS2_SB(sb);
828 836
829 trace_ocfs2_mark_dquot_dirty(dquot->dq_id, type); 837 trace_ocfs2_mark_dquot_dirty(from_kqid(&init_user_ns, dquot->dq_id),
838 type);
830 839
831 /* In case user set some limits, sync dquot immediately to global 840 /* In case user set some limits, sync dquot immediately to global
832 * quota file so that information propagates quicker */ 841 * quota file so that information propagates quicker */