Skip to content

Commit 86e5943

Browse files
committed
ocfs2: charge quota for reflinked blocks
When ocfs2 shares blocks from one file to another, it's necessary to charge that many blocks to the quota because ocfs2 tallies block charges according to the number of blocks mapped, not the number of physical blocks used. Without this patch, reflinking X blocks and then CoWing all of them causes quota usage to *decrease* by X as seen in generic/305. Signed-off-by: Darrick J. Wong <[email protected]>
1 parent aef73a6 commit 86e5943

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

fs/ocfs2/refcounttree.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3933,6 +3933,13 @@ static int ocfs2_add_refcounted_extent(struct inode *inode,
39333933
ret = ocfs2_increase_refcount(handle, ref_ci, ref_root_bh,
39343934
p_cluster, num_clusters,
39353935
meta_ac, dealloc);
3936+
if (ret) {
3937+
mlog_errno(ret);
3938+
goto out_commit;
3939+
}
3940+
3941+
ret = dquot_alloc_space_nodirty(inode,
3942+
ocfs2_clusters_to_bytes(osb->sb, num_clusters));
39363943
if (ret)
39373944
mlog_errno(ret);
39383945

0 commit comments

Comments
 (0)