summaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_buf.c
diff options
context:
space:
mode:
authorBrian Foster <bfoster@redhat.com>2020-05-06 22:29:19 +0200
committerDarrick J. Wong <darrick.wong@oracle.com>2020-05-07 17:27:48 +0200
commit7376d74547344598008d00419eae0caa5f50f4f0 (patch)
treea7a8b53d8250f5211031d2c89f5ad76b61f41b67 /fs/xfs/xfs_buf.c
parentxfs: remove unused iflush stale parameter (diff)
downloadlinux-7376d74547344598008d00419eae0caa5f50f4f0.tar.xz
linux-7376d74547344598008d00419eae0caa5f50f4f0.zip
xfs: random buffer write failure errortag
Introduce an error tag to randomly fail async buffer writes. This is primarily to facilitate testing of the XFS error configuration mechanism. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Allison Collins <allison.henderson@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/xfs_buf.c')
-rw-r--r--fs/xfs/xfs_buf.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index 3918270f4eab..9d8841ac7375 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -1289,6 +1289,12 @@ xfs_buf_bio_end_io(
struct bio *bio)
{
struct xfs_buf *bp = (struct xfs_buf *)bio->bi_private;
+ struct xfs_mount *mp = bp->b_mount;
+
+ if (!bio->bi_status &&
+ (bp->b_flags & XBF_WRITE) && (bp->b_flags & XBF_ASYNC) &&
+ XFS_TEST_ERROR(false, mp, XFS_ERRTAG_BUF_IOERROR))
+ bio->bi_status = BLK_STS_IOERR;
/*
* don't overwrite existing errors - otherwise we can lose errors on