summaryrefslogtreecommitdiffstats
path: root/fs/xfs/libxfs/xfs_ag_resv.c
diff options
context:
space:
mode:
authorGao Xiang <hsiangkao@redhat.com>2021-03-24 03:05:39 +0100
committerDarrick J. Wong <djwong@kernel.org>2021-03-26 00:47:53 +0100
commit2b92faed551173f065ee2a8cf087dc76cf40303b (patch)
tree4eb4799a6dfa0e6a8ff58e6288dc9d3344c7e617 /fs/xfs/libxfs/xfs_ag_resv.c
parentxfs: support shrinking unused space in the last AG (diff)
downloadlinux-2b92faed551173f065ee2a8cf087dc76cf40303b.tar.xz
linux-2b92faed551173f065ee2a8cf087dc76cf40303b.zip
xfs: add error injection for per-AG resv failure
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>
Diffstat (limited to 'fs/xfs/libxfs/xfs_ag_resv.c')
-rw-r--r--fs/xfs/libxfs/xfs_ag_resv.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/xfs/libxfs/xfs_ag_resv.c b/fs/xfs/libxfs/xfs_ag_resv.c
index fdfe6dc0d307..6c5f8d10589c 100644
--- a/fs/xfs/libxfs/xfs_ag_resv.c
+++ b/fs/xfs/libxfs/xfs_ag_resv.c
@@ -211,7 +211,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_);