svn commit: r357876 - in stable/12: etc/mtree sys/geom sys/geom/multipath tests/sys/geom/class tests/sys/geom/class/multipath

Alan Somers asomers at FreeBSD.org
Thu Feb 13 20:32:06 UTC 2020


Author: asomers
Date: Thu Feb 13 20:32:05 2020
New Revision: 357876
URL: https://svnweb.freebsd.org/changeset/base/357876

Log:
  MFC r355431:
  
  gmultipath: add ATF tests
  
  Add ATF tests for most gmultipath operations. Add some dtrace probes too,
  primarily for configuration changes that happen in response to provider
  errors.
  
  PR:		178473
  Sponsored by:	Axcient
  Differential Revision:	https://reviews.freebsd.org/D22235

Added:
  stable/12/tests/sys/geom/class/multipath/
     - copied from r355431, head/tests/sys/geom/class/multipath/
Modified:
  stable/12/etc/mtree/BSD.tests.dist
  stable/12/sys/geom/geom_subr.c
  stable/12/sys/geom/multipath/g_multipath.c
  stable/12/tests/sys/geom/class/Makefile
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/etc/mtree/BSD.tests.dist
==============================================================================
--- stable/12/etc/mtree/BSD.tests.dist	Thu Feb 13 20:23:55 2020	(r357875)
+++ stable/12/etc/mtree/BSD.tests.dist	Thu Feb 13 20:32:05 2020	(r357876)
@@ -744,6 +744,8 @@
                 ..
                 mirror
                 ..
+                multipath
+                ..
                 nop
                 ..
                 part

Modified: stable/12/sys/geom/geom_subr.c
==============================================================================
--- stable/12/sys/geom/geom_subr.c	Thu Feb 13 20:23:55 2020	(r357875)
+++ stable/12/sys/geom/geom_subr.c	Thu Feb 13 20:32:05 2020	(r357876)
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/mutex.h>
 #include <sys/errno.h>
 #include <sys/sbuf.h>
+#include <sys/sdt.h>
 #include <geom/geom.h>
 #include <geom/geom_int.h>
 #include <machine/stdarg.h>
@@ -64,6 +65,8 @@ __FBSDID("$FreeBSD$");
 #ifdef KDB
 #include <sys/kdb.h>
 #endif
+
+SDT_PROVIDER_DEFINE(geom);
 
 struct class_list_head g_classes = LIST_HEAD_INITIALIZER(g_classes);
 static struct g_tailq_head geoms = TAILQ_HEAD_INITIALIZER(geoms);

Modified: stable/12/sys/geom/multipath/g_multipath.c
==============================================================================
--- stable/12/sys/geom/multipath/g_multipath.c	Thu Feb 13 20:23:55 2020	(r357875)
+++ stable/12/sys/geom/multipath/g_multipath.c	Thu Feb 13 20:32:05 2020	(r357876)
@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/mutex.h>
 #include <sys/bio.h>
 #include <sys/sbuf.h>
+#include <sys/sdt.h>
 #include <sys/sysctl.h>
 #include <sys/kthread.h>
 #include <sys/malloc.h>
@@ -61,6 +62,14 @@ static u_int g_multipath_exclusive = 1;
 SYSCTL_UINT(_kern_geom_multipath, OID_AUTO, exclusive, CTLFLAG_RW,
     &g_multipath_exclusive, 0, "Exclusively open providers");
 
+SDT_PROVIDER_DECLARE(geom);
+SDT_PROBE_DEFINE2(geom, multipath, config, restore, "char*", "char*");
+SDT_PROBE_DEFINE2(geom, multipath, config, remove, "char*", "char*");
+SDT_PROBE_DEFINE2(geom, multipath, config, disconnect, "char*", "char*");
+SDT_PROBE_DEFINE3(geom, multipath, config, fail, "char*", "char*", "int");
+SDT_PROBE_DEFINE2(geom, multipath, config, taste, "char*", "char*");
+SDT_PROBE_DEFINE2(geom, multipath, io, restart, "struct bio*", "struct bio*");
+
 static enum {
 	GKT_NIL,
 	GKT_RUN,
@@ -146,6 +155,8 @@ g_multipath_fault(struct g_consumer *cp, int cause)
 			printf("GEOM_MULTIPATH: "
 			    "all paths in %s were marked FAIL, restore %s\n",
 			    sc->sc_name, lcp->provider->name);
+			SDT_PROBE2(geom, multipath, config, restore,
+			    sc->sc_name, lcp->provider->name);
 			lcp->index &= ~MP_FAIL;
 		}
 	}
@@ -217,6 +228,8 @@ g_mpd(void *arg, int flags __unused)
 	if (cp->provider) {
 		printf("GEOM_MULTIPATH: %s removed from %s\n",
 		    cp->provider->name, gp->name);
+		SDT_PROBE2(geom, multipath, config, remove,
+		    gp->name, cp->provider->name);
 		g_detach(cp);
 	}
 	g_destroy_consumer(cp);
@@ -234,6 +247,8 @@ g_multipath_orphan(struct g_consumer *cp)
 	g_topology_assert();
 	printf("GEOM_MULTIPATH: %s in %s was disconnected\n",
 	    cp->provider->name, cp->geom->name);
+	SDT_PROBE2(geom, multipath, config, disconnect,
+	    cp->geom->name, cp->provider->name);
 	sc = cp->geom->softc;
 	cnt = (uintptr_t *)&cp->private;
 	mtx_lock(&sc->sc_mtx);
@@ -411,6 +426,8 @@ g_multipath_done_error(struct bio *bp)
 	if ((cp->index & MP_FAIL) == 0) {
 		printf("GEOM_MULTIPATH: Error %d, %s in %s marked FAIL\n",
 		    bp->bio_error, pp->name, sc->sc_name);
+		SDT_PROBE3(geom, multipath, config, fail,
+		    sc->sc_name, pp->name, bp->bio_error);
 		g_multipath_fault(cp, MP_FAIL);
 	}
 	(*cnt)--;
@@ -426,6 +443,7 @@ g_multipath_done_error(struct bio *bp)
 	 */
 	if (pbp->bio_children < (uintptr_t)pbp->bio_driver1) {
 		pbp->bio_inbed++;
+		SDT_PROBE2(geom, multipath, io, restart, bp, pbp);
 		g_destroy_bio(bp);
 		g_multipath_start(pbp);
 	} else {
@@ -831,6 +849,7 @@ g_multipath_taste(struct g_class *mp, struct g_provide
 		return (NULL);
 	if (g_multipath_debug)
 		printf("MULTIPATH: %s/%s\n", md.md_name, md.md_uuid);
+	SDT_PROBE2(geom, multipath, config, taste, md.md_name, md.md_uuid);
 
 	/*
 	 * Let's check if such a device already is present. We check against
@@ -1230,8 +1249,12 @@ g_multipath_ctl_fail(struct gctl_req *req, struct g_cl
 				name, sc->sc_name, fail ? "FAIL" : "OK");
 			if (fail) {
 				g_multipath_fault(cp, MP_FAIL);
+				SDT_PROBE3(geom, multipath, config, fail,
+				    sc->sc_name, cp->provider->name, 0);
 			} else {
 				cp->index &= ~MP_FAIL;
+				SDT_PROBE2(geom, multipath, config, restore,
+				    sc->sc_name, cp->provider->name);
 			}
 		}
 	}
@@ -1277,6 +1300,8 @@ g_multipath_ctl_remove(struct gctl_req *req, struct g_
 			found = 1;
 			printf("GEOM_MULTIPATH: removing %s from %s\n",
 			    cp->provider->name, cp->geom->name);
+			SDT_PROBE2(geom, multipath, config, remove,
+			    cp->geom->name, cp->provider->name);
 			sc->sc_ndisks--;
 			g_multipath_fault(cp, MP_LOST);
 			cnt = (uintptr_t *)&cp->private;

Modified: stable/12/tests/sys/geom/class/Makefile
==============================================================================
--- stable/12/tests/sys/geom/class/Makefile	Thu Feb 13 20:23:55 2020	(r357875)
+++ stable/12/tests/sys/geom/class/Makefile	Thu Feb 13 20:32:05 2020	(r357876)
@@ -8,6 +8,7 @@ TESTS_SUBDIRS+=	concat
 TESTS_SUBDIRS+=	eli
 TESTS_SUBDIRS+=	gate
 TESTS_SUBDIRS+=	mirror
+TESTS_SUBDIRS+=	multipath
 TESTS_SUBDIRS+=	nop
 TESTS_SUBDIRS+=	part
 TESTS_SUBDIRS+=	raid3


More information about the svn-src-all mailing list