Skip to content

Commit 0db22d7

Browse files
Christoph Hellwigcmaiolino
authored andcommitted
xfs: document another racy GC case in xfs_zoned_map_extent
Besides blocks being invalidated, there is another case when the original mapping could have changed between querying the rmap for GC and calling xfs_zoned_map_extent. Document it there as it took us quite some time to figure out what is going on while developing the multiple-GC protection fix. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Hans Holmberg <[email protected]> Reviewed-by: Damien Le Moal <[email protected]> Reviewed-by: Carlos Maiolino <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Carlos Maiolino <[email protected]>
1 parent 83bac56 commit 0db22d7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

fs/xfs/xfs_zone_alloc.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,14 @@ xfs_zoned_map_extent(
246246
* If a data write raced with this GC write, keep the existing data in
247247
* the data fork, mark our newly written GC extent as reclaimable, then
248248
* move on to the next extent.
249+
*
250+
* Note that this can also happen when racing with operations that do
251+
* not actually invalidate the data, but just move it to a different
252+
* inode (XFS_IOC_EXCHANGE_RANGE), or to a different offset inside the
253+
* inode (FALLOC_FL_COLLAPSE_RANGE / FALLOC_FL_INSERT_RANGE). If the
254+
* data was just moved around, GC fails to free the zone, but the zone
255+
* becomes a GC candidate again as soon as all previous GC I/O has
256+
* finished and these blocks will be moved out eventually.
249257
*/
250258
if (old_startblock != NULLFSBLOCK &&
251259
old_startblock != data.br_startblock)

0 commit comments

Comments
 (0)