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 47aea2e82c268f4bbf9c25c1c1c6f3821c11caa3..bcc2ad4f0899714621f6de37cb55c4a84ea885e5 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);
 
        /*