xfs: call xfs_qm_dqattach before performing reflink operations
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 19 Jan 2018 16:56:04 +0000 (08:56 -0800)
committerDarrick J. Wong <darrick.wong@oracle.com>
Mon, 29 Jan 2018 15:27:22 +0000 (07:27 -0800)
Ensure that we've attached all the necessary dquots before performing
reflink operations so that quota accounting is accurate.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/xfs_reflink.c

index 47aea2e..bcc2ad4 100644 (file)
@@ -1295,6 +1295,11 @@ xfs_reflink_remap_range(
        if (ret <= 0)
                goto out_unlock;
 
+       /* Attach dquots to dest inode before changing block map */
+       ret = xfs_qm_dqattach(dest, 0);
+       if (ret)
+               goto out_unlock;
+
        trace_xfs_reflink_remap_range(src, pos_in, len, dest, pos_out);
 
        /*