Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4919d42a authored by Darrick J. Wong's avatar Darrick J. Wong
Browse files

xfs: only cancel cow blocks when truncating the data fork



In xfs_itruncate_extents, only cancel cow blocks and clear the reflink
flag if we were asked to truncate the data fork.  Attr fork blocks
cannot be shared, so this makes no sense.

Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
parent a1f69417
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -1602,13 +1602,15 @@ xfs_itruncate_extents(
			goto out;
	}

	if (whichfork == XFS_DATA_FORK) {
		/* Remove all pending CoW reservations. */
	error = xfs_reflink_cancel_cow_blocks(ip, &tp, first_unmap_block,
			last_block, true);
		error = xfs_reflink_cancel_cow_blocks(ip, &tp,
				first_unmap_block, last_block, true);
		if (error)
			goto out;

		xfs_itruncate_clear_reflink_flags(ip);
	}

	/*
	 * Always re-log the inode so that our permanent transaction can keep