]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs: support error injection when freeing rt extents
authorDarrick J. Wong <djwong@kernel.org>
Tue, 7 Mar 2023 03:55:42 +0000 (19:55 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 22 Nov 2023 23:03:36 +0000 (15:03 -0800)
A handful of fstests expect to be able to test what happens when extent
free intents fail to actually free the extent.  Now that we're
supporting EFIs for realtime extents, add to xfs_rtfree_extent the same
injection point that exists in the regular extent freeing code.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
libxfs/xfs_rtbitmap.c

index 4f2c9744de3d6c89d177a9ec81f52a38b12753b7..36b0f02a26347a0b7654269f71064cb0627d89ee 100644 (file)
@@ -16,6 +16,7 @@
 #include "xfs_trans.h"
 #include "xfs_rtbitmap.h"
 #include "xfs_health.h"
+#include "xfs_errortag.h"
 
 /*
  * Realtime allocator bitmap functions shared with userspace.
@@ -1036,6 +1037,9 @@ xfs_rtfree_extent(
        ASSERT(mp->m_rbmip->i_itemp != NULL);
        ASSERT(xfs_isilocked(mp->m_rbmip, XFS_ILOCK_EXCL));
 
+       if (XFS_TEST_ERROR(false, mp, XFS_ERRTAG_FREE_EXTENT))
+               return -EIO;
+
        error = xfs_rtcheck_alloc_range(&args, start, len);
        if (error)
                return error;