All of lore.kernel.org
 help / color / mirror / Atom feed
From: Allison Henderson <allison.henderson@oracle.com>
To: linux-xfs@vger.kernel.org
Subject: [PATCH v17 01/12] xfs: add error injection for per-AG resv failure
Date: Fri, 16 Apr 2021 02:18:03 -0700	[thread overview]
Message-ID: <20210416091814.2041-2-allison.henderson@oracle.com> (raw)
In-Reply-To: <20210416091814.2041-1-allison.henderson@oracle.com>

From: Gao Xiang <hsiangkao@redhat.com>

Source kernel commit: 2b92faed551173f065ee2a8cf087dc76cf40303b

per-AG resv failure after fixing up freespace is hard to test in an
effective way, so directly add an error injection path to observe
such error handling path works as expected.

Signed-off-by: Gao Xiang <hsiangkao@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
---
 io/inject.c           | 1 +
 libxfs/xfs_ag_resv.c  | 6 +++++-
 libxfs/xfs_errortag.h | 4 +++-
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/io/inject.c b/io/inject.c
index 9a401a1..0be1fd6 100644
--- a/io/inject.c
+++ b/io/inject.c
@@ -57,6 +57,7 @@ error_tag(char *name)
 		{ XFS_ERRTAG_BUF_IOERROR,		"buf_ioerror" },
 		{ XFS_ERRTAG_REDUCE_MAX_IEXTENTS,	"reduce_max_iextents" },
 		{ XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTENT,	"bmap_alloc_minlen_extent" },
+		{ XFS_ERRTAG_AG_RESV_FAIL,		"ag_resv_fail"},
 		{ XFS_ERRTAG_MAX,			NULL }
 	};
 	int	count;
diff --git a/libxfs/xfs_ag_resv.c b/libxfs/xfs_ag_resv.c
index 530455a..9dc5bf2 100644
--- a/libxfs/xfs_ag_resv.c
+++ b/libxfs/xfs_ag_resv.c
@@ -210,7 +210,11 @@ __xfs_ag_resv_init(
 		ASSERT(0);
 		return -EINVAL;
 	}
-	error = xfs_mod_fdblocks(mp, -(int64_t)hidden_space, true);
+
+	if (XFS_TEST_ERROR(false, mp, XFS_ERRTAG_AG_RESV_FAIL))
+		error = -ENOSPC;
+	else
+		error = xfs_mod_fdblocks(mp, -(int64_t)hidden_space, true);
 	if (error) {
 		trace_xfs_ag_resv_init_error(pag->pag_mount, pag->pag_agno,
 				error, _RET_IP_);
diff --git a/libxfs/xfs_errortag.h b/libxfs/xfs_errortag.h
index 6ca9084..a23a52e 100644
--- a/libxfs/xfs_errortag.h
+++ b/libxfs/xfs_errortag.h
@@ -58,7 +58,8 @@
 #define XFS_ERRTAG_BUF_IOERROR				35
 #define XFS_ERRTAG_REDUCE_MAX_IEXTENTS			36
 #define XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTENT		37
-#define XFS_ERRTAG_MAX					38
+#define XFS_ERRTAG_AG_RESV_FAIL				38
+#define XFS_ERRTAG_MAX					39
 
 /*
  * Random factors for above tags, 1 means always, 2 means 1/2 time, etc.
@@ -101,5 +102,6 @@
 #define XFS_RANDOM_BUF_IOERROR				XFS_RANDOM_DEFAULT
 #define XFS_RANDOM_REDUCE_MAX_IEXTENTS			1
 #define XFS_RANDOM_BMAP_ALLOC_MINLEN_EXTENT		1
+#define XFS_RANDOM_AG_RESV_FAIL				1
 
 #endif /* __XFS_ERRORTAG_H_ */
-- 
2.7.4


  reply	other threads:[~2021-04-16  9:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-16  9:18 [PATCH v17 00/12] xfsprogs: Delay Ready Attributes Allison Henderson
2021-04-16  9:18 ` Allison Henderson [this message]
2021-04-16  9:18 ` [PATCH v17 02/12] xfsprogs: Reverse apply 72b97ea40d Allison Henderson
2021-04-16  9:18 ` [PATCH v17 03/12] xfsprogs: Add xfs_attr_node_remove_cleanup Allison Henderson
2021-04-16  9:18 ` [PATCH v17 04/12] xfsprogs: Hoist xfs_attr_set_shortform Allison Henderson
2021-04-16  9:18 ` [PATCH v17 05/12] xfsprogs: Add helper xfs_attr_set_fmt Allison Henderson
2021-04-16  9:18 ` [PATCH v17 06/12] xfsprogs: Separate xfs_attr_node_addname and xfs_attr_node_addname_clear_incomplete Allison Henderson
2021-04-16  9:18 ` [PATCH v17 07/12] xfsprogs: Add helper xfs_attr_node_addname_find_attr Allison Henderson
2021-04-16  9:18 ` [PATCH v17 08/12] xfsprogs: Hoist xfs_attr_node_addname Allison Henderson
2021-04-16  9:18 ` [PATCH v17 09/12] xfsprogs: Hoist xfs_attr_leaf_addname Allison Henderson
2021-04-16  9:18 ` [PATCH v17 10/12] xfsprogs: Hoist node transaction handling Allison Henderson
2021-04-16  9:18 ` [PATCH v17 11/12] xfsprogs: Add delay ready attr remove routines Allison Henderson
2021-04-16  9:18 ` [PATCH v17 12/12] xfsprogs: Add delay ready attr set routines Allison Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210416091814.2041-2-allison.henderson@oracle.com \
    --to=allison.henderson@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.