OSDN Git Service

xfs: attach dquots before performing xfs_swap_extents
authorDarrick J. Wong <darrick.wong@oracle.com>
Sat, 9 Nov 2019 20:04:30 +0000 (12:04 -0800)
committerDarrick J. Wong <darrick.wong@oracle.com>
Mon, 11 Nov 2019 20:42:52 +0000 (12:42 -0800)
Make sure we attach dquots to both inodes before swapping their extents.
This was found via manual code inspection by looking for places where we
could call xfs_trans_mod_dquot without dquots attached to inodes, and
confirmed by instrumenting the kernel and running xfs/328.

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

index 9d731b7..2efd78a 100644 (file)
@@ -1569,6 +1569,14 @@ xfs_swap_extents(
                goto out_unlock;
        }
 
+       error = xfs_qm_dqattach(ip);
+       if (error)
+               goto out_unlock;
+
+       error = xfs_qm_dqattach(tip);
+       if (error)
+               goto out_unlock;
+
        error = xfs_swap_extent_flush(ip);
        if (error)
                goto out_unlock;