diff options
author | Mark Johnston <markj@FreeBSD.org> | 2016-09-06 23:35:48 +0000 |
---|---|---|
committer | Mark Johnston <markj@FreeBSD.org> | 2016-09-06 23:35:48 +0000 |
commit | 40c5032d32033f34a5bd1bfe42cff9f1ef16e29b (patch) | |
tree | 8550b0fa34a646e50a5ffe0080690d2f456419aa /sys/geom | |
parent | b2fd098e58a21229a3b7b6b4b40cc99e44937fa3 (diff) | |
download | src-40c5032d32033f34a5bd1bfe42cff9f1ef16e29b.tar.gz src-40c5032d32033f34a5bd1bfe42cff9f1ef16e29b.zip |
Add some fail points to gmirror.
These are useful for testing changes to I/O error handling, and for
reproducing existing bugs in a controlled manner. The fail points are
g_mirror_regular_request_read
g_mirror_regular_request_write
g_mirror_sync_request_read
g_mirror_sync_request_write
g_mirror_metadata_write
They all effectively allow one to inject an error value into the bio_error
field of a corresponding BIO request as it is being completed.
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
Notes
Notes:
svn path=/head/; revision=305508
Diffstat (limited to 'sys/geom')
-rw-r--r-- | sys/geom/mirror/g_mirror.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/sys/geom/mirror/g_mirror.c b/sys/geom/mirror/g_mirror.c index b8924b0ab3d7..a8ad857e237d 100644 --- a/sys/geom/mirror/g_mirror.c +++ b/sys/geom/mirror/g_mirror.c @@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/systm.h> +#include <sys/fail.h> #include <sys/kernel.h> #include <sys/module.h> #include <sys/limits.h> @@ -646,6 +647,7 @@ g_mirror_write_metadata(struct g_mirror_disk *disk, else mirror_metadata_encode(md, sector); } + KFAIL_POINT_ERROR(DEBUG_FP, g_mirror_metadata_write, error); if (error == 0) error = g_write_data(cp, offset, sector, length); free(sector, M_MIRROR); @@ -914,6 +916,13 @@ g_mirror_regular_request(struct bio *bp) g_topology_unlock(); } + if (bp->bio_cmd == BIO_READ) + KFAIL_POINT_ERROR(DEBUG_FP, g_mirror_regular_request_read, + bp->bio_error); + else if (bp->bio_cmd == BIO_WRITE) + KFAIL_POINT_ERROR(DEBUG_FP, g_mirror_regular_request_write, + bp->bio_error); + pbp->bio_inbed++; KASSERT(pbp->bio_inbed <= pbp->bio_children, ("bio_inbed (%u) is bigger than bio_children (%u).", pbp->bio_inbed, @@ -1308,6 +1317,9 @@ g_mirror_sync_request(struct bio *bp) { struct g_consumer *cp; + KFAIL_POINT_ERROR(DEBUG_FP, g_mirror_sync_request_read, + bp->bio_error); + if (bp->bio_error != 0) { G_MIRROR_LOGREQ(0, bp, "Synchronization request failed (error=%d).", @@ -1334,6 +1346,9 @@ g_mirror_sync_request(struct bio *bp) void *data; int i; + KFAIL_POINT_ERROR(DEBUG_FP, g_mirror_sync_request_write, + bp->bio_error); + if (bp->bio_error != 0) { G_MIRROR_LOGREQ(0, bp, "Synchronization request failed (error=%d).", |