xfs: simulate per-AG reservations being critically low
authorDarrick J. Wong <darrick.wong@oracle.com>
Mon, 3 Oct 2016 16:11:51 +0000 (09:11 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Wed, 5 Oct 2016 23:26:31 +0000 (16:26 -0700)
Create an error injection point that enables us to simulate being
critically low on per-AG block reservations.  This should enable us to
simulate this specific ENOSPC condition so that we can test falling back
to a regular file copy.

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

index adf770f0d011836ba971d6ac9d8fc250b56d2ae5..e5ebc37704608a336dd8690d55f06389cd0173bd 100644 (file)
@@ -109,7 +109,9 @@ xfs_ag_resv_critical(
        trace_xfs_ag_resv_critical(pag, type, avail);
 
        /* Critically low if less than 10% or max btree height remains. */
-       return avail < orig / 10 || avail < XFS_BTREE_MAXLEVELS;
+       return XFS_TEST_ERROR(avail < orig / 10 || avail < XFS_BTREE_MAXLEVELS,
+                       pag->pag_mount, XFS_ERRTAG_AG_RESV_CRITICAL,
+                       XFS_RANDOM_AG_RESV_CRITICAL);
 }
 
 /*
index 8d8e1b07d295b9185f7477235cbd9215697470d4..05f8666733a09d3c6b23033d0f297d7491828d66 100644 (file)
@@ -95,7 +95,8 @@ extern void xfs_verifier_error(struct xfs_buf *bp);
 #define XFS_ERRTAG_REFCOUNT_CONTINUE_UPDATE            24
 #define XFS_ERRTAG_REFCOUNT_FINISH_ONE                 25
 #define XFS_ERRTAG_BMAP_FINISH_ONE                     26
-#define XFS_ERRTAG_MAX                                 27
+#define XFS_ERRTAG_AG_RESV_CRITICAL                    27
+#define XFS_ERRTAG_MAX                                 28
 
 /*
  * Random factors for above tags, 1 means always, 2 means 1/2 time, etc.
@@ -127,6 +128,7 @@ extern void xfs_verifier_error(struct xfs_buf *bp);
 #define XFS_RANDOM_REFCOUNT_CONTINUE_UPDATE            1
 #define XFS_RANDOM_REFCOUNT_FINISH_ONE                 1
 #define XFS_RANDOM_BMAP_FINISH_ONE                     1
+#define XFS_RANDOM_AG_RESV_CRITICAL                    4
 
 #ifdef DEBUG
 extern int xfs_error_test_active;