diff options
Diffstat (limited to 'fs/ocfs2')
-rw-r--r-- | fs/ocfs2/quota_global.c | 43 | ||||
-rw-r--r-- | fs/ocfs2/quota_local.c | 11 |
2 files changed, 32 insertions, 22 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 | ||
122 | struct qtree_fmt_operations ocfs2_global_ops = { | 125 | struct 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 */ |
diff --git a/fs/ocfs2/quota_local.c b/fs/ocfs2/quota_local.c index 020f0ba29ee5..27fe7ee4874c 100644 --- a/fs/ocfs2/quota_local.c +++ b/fs/ocfs2/quota_local.c | |||
@@ -883,7 +883,8 @@ static void olq_set_dquot(struct buffer_head *bh, void *private) | |||
883 | dqblk = (struct ocfs2_local_disk_dqblk *)(bh->b_data | 883 | dqblk = (struct ocfs2_local_disk_dqblk *)(bh->b_data |
884 | + ol_dqblk_block_offset(sb, od->dq_local_off)); | 884 | + ol_dqblk_block_offset(sb, od->dq_local_off)); |
885 | 885 | ||
886 | dqblk->dqb_id = cpu_to_le64(od->dq_dquot.dq_id); | 886 | dqblk->dqb_id = cpu_to_le64(from_kqid(&init_user_ns, |
887 | od->dq_dquot.dq_id)); | ||
887 | spin_lock(&dq_data_lock); | 888 | spin_lock(&dq_data_lock); |
888 | dqblk->dqb_spacemod = cpu_to_le64(od->dq_dquot.dq_dqb.dqb_curspace - | 889 | dqblk->dqb_spacemod = cpu_to_le64(od->dq_dquot.dq_dqb.dqb_curspace - |
889 | od->dq_origspace); | 890 | od->dq_origspace); |
@@ -893,7 +894,7 @@ static void olq_set_dquot(struct buffer_head *bh, void *private) | |||
893 | trace_olq_set_dquot( | 894 | trace_olq_set_dquot( |
894 | (unsigned long long)le64_to_cpu(dqblk->dqb_spacemod), | 895 | (unsigned long long)le64_to_cpu(dqblk->dqb_spacemod), |
895 | (unsigned long long)le64_to_cpu(dqblk->dqb_inodemod), | 896 | (unsigned long long)le64_to_cpu(dqblk->dqb_inodemod), |
896 | od->dq_dquot.dq_id); | 897 | from_kqid(&init_user_ns, od->dq_dquot.dq_id)); |
897 | } | 898 | } |
898 | 899 | ||
899 | /* Write dquot to local quota file */ | 900 | /* Write dquot to local quota file */ |
@@ -902,7 +903,7 @@ int ocfs2_local_write_dquot(struct dquot *dquot) | |||
902 | struct super_block *sb = dquot->dq_sb; | 903 | struct super_block *sb = dquot->dq_sb; |
903 | struct ocfs2_dquot *od = OCFS2_DQUOT(dquot); | 904 | struct ocfs2_dquot *od = OCFS2_DQUOT(dquot); |
904 | struct buffer_head *bh; | 905 | struct buffer_head *bh; |
905 | struct inode *lqinode = sb_dqopt(sb)->files[dquot->dq_type]; | 906 | struct inode *lqinode = sb_dqopt(sb)->files[dquot->dq_id.type]; |
906 | int status; | 907 | int status; |
907 | 908 | ||
908 | status = ocfs2_read_quota_phys_block(lqinode, od->dq_local_phys_blk, | 909 | status = ocfs2_read_quota_phys_block(lqinode, od->dq_local_phys_blk, |
@@ -1223,7 +1224,7 @@ static void olq_alloc_dquot(struct buffer_head *bh, void *private) | |||
1223 | int ocfs2_create_local_dquot(struct dquot *dquot) | 1224 | int ocfs2_create_local_dquot(struct dquot *dquot) |
1224 | { | 1225 | { |
1225 | struct super_block *sb = dquot->dq_sb; | 1226 | struct super_block *sb = dquot->dq_sb; |
1226 | int type = dquot->dq_type; | 1227 | int type = dquot->dq_id.type; |
1227 | struct inode *lqinode = sb_dqopt(sb)->files[type]; | 1228 | struct inode *lqinode = sb_dqopt(sb)->files[type]; |
1228 | struct ocfs2_quota_chunk *chunk; | 1229 | struct ocfs2_quota_chunk *chunk; |
1229 | struct ocfs2_dquot *od = OCFS2_DQUOT(dquot); | 1230 | struct ocfs2_dquot *od = OCFS2_DQUOT(dquot); |
@@ -1277,7 +1278,7 @@ out: | |||
1277 | int ocfs2_local_release_dquot(handle_t *handle, struct dquot *dquot) | 1278 | int ocfs2_local_release_dquot(handle_t *handle, struct dquot *dquot) |
1278 | { | 1279 | { |
1279 | int status; | 1280 | int status; |
1280 | int type = dquot->dq_type; | 1281 | int type = dquot->dq_id.type; |
1281 | struct ocfs2_dquot *od = OCFS2_DQUOT(dquot); | 1282 | struct ocfs2_dquot *od = OCFS2_DQUOT(dquot); |
1282 | struct super_block *sb = dquot->dq_sb; | 1283 | struct super_block *sb = dquot->dq_sb; |
1283 | struct ocfs2_local_disk_chunk *dchunk; | 1284 | struct ocfs2_local_disk_chunk *dchunk; |