From owner-svn-src-stable@freebsd.org Sat Oct 7 23:06:51 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 646A6E444AE; Sat, 7 Oct 2017 23:06:51 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E0C3C7111C; Sat, 7 Oct 2017 23:06:50 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v97N6nJT032105; Sat, 7 Oct 2017 23:06:49 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v97N6nt1032104; Sat, 7 Oct 2017 23:06:49 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201710072306.v97N6nt1032104@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 7 Oct 2017 23:06:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r324402 - stable/11/sys/geom/mirror X-SVN-Group: stable-11 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: stable/11/sys/geom/mirror X-SVN-Commit-Revision: 324402 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Oct 2017 23:06:51 -0000 Author: ngie Date: Sat Oct 7 23:06:49 2017 New Revision: 324402 URL: https://svnweb.freebsd.org/changeset/base/324402 Log: MFC r305508: r305508 (by markj): 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. Modified: stable/11/sys/geom/mirror/g_mirror.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/geom/mirror/g_mirror.c ============================================================================== --- stable/11/sys/geom/mirror/g_mirror.c Sat Oct 7 22:59:09 2017 (r324401) +++ stable/11/sys/geom/mirror/g_mirror.c Sat Oct 7 23:06:49 2017 (r324402) @@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -665,6 +666,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); @@ -937,6 +939,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, @@ -1331,6 +1340,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).", @@ -1356,6 +1368,9 @@ g_mirror_sync_request(struct bio *bp) off_t offset; 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,