Skip to content

Commit b57283e

Browse files
author
Darrick J. Wong
committed
xfs: force swapext to a realtime file to use the file content exchange ioctl
xfs_swap_extent_rmap does not use log items to track the overall progress of an attempt to swap the extent mappings between two files. If the system crashes in the middle of swapping a partially written realtime extent, the mapping will be left in an inconsistent state wherein a file can point to multiple extents on the rt volume. The new file range exchange functionality handles this correctly, so all callers must upgrade to that. Signed-off-by: Darrick J. Wong <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]>
1 parent e464d8e commit b57283e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

fs/xfs/xfs_bmap_util.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1532,6 +1532,18 @@ xfs_swap_extents(
15321532
goto out_unlock;
15331533
}
15341534

1535+
/*
1536+
* The rmapbt implementation is unable to resume a swapext operation
1537+
* after a crash if the allocation unit size is larger than a block.
1538+
* This (deprecated) interface will not be upgraded to handle this
1539+
* situation. Defragmentation must be performed with the commit range
1540+
* ioctl.
1541+
*/
1542+
if (XFS_IS_REALTIME_INODE(ip) && xfs_has_rtgroups(ip->i_mount)) {
1543+
error = -EOPNOTSUPP;
1544+
goto out_unlock;
1545+
}
1546+
15351547
error = xfs_qm_dqattach(ip);
15361548
if (error)
15371549
goto out_unlock;

0 commit comments

Comments
 (0)