From 09ac862397041fc484cd7294b15d41073aa78864 Mon Sep 17 00:00:00 2001
From: "Darrick J. Wong" <darrick.wong@oracle.com>
Date: Fri, 19 Jan 2018 08:56:04 -0800
Subject: [PATCH] xfs: call xfs_qm_dqattach before performing reflink
operations
Git-commit: 09ac862397041fc484cd7294b15d41073aa78864
Patch-mainline: v4.16-rc1
References: bsc#1132368, bsc#1132219
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>
Acked-by: Anthony Iliopoulos <ailiopoulos@suse.com>
---
fs/xfs/xfs_reflink.c | 5 +++++
1 file changed, 5 insertions(+)
--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -1286,6 +1286,11 @@
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);
/*