From owner-freebsd-geom@FreeBSD.ORG Sat Sep 21 23:48:17 2013 Return-Path: Delivered-To: geom@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id E08A12CF for ; Sat, 21 Sep 2013 23:48:17 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id A68B82F56 for ; Sat, 21 Sep 2013 23:48:17 +0000 (UTC) Received: from nine.des.no (smtp.des.no [194.63.250.102]) by smtp-int.des.no (Postfix) with ESMTP id ABEEE67A5 for ; Sat, 21 Sep 2013 23:48:16 +0000 (UTC) Received: by nine.des.no (Postfix, from userid 1001) id BA8AC665; Sun, 22 Sep 2013 01:47:17 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: geom@freebsd.org Subject: Disable tasting through sysctl Date: Sun, 22 Sep 2013 01:47:17 +0200 Message-ID: <86fvsxd9fe.fsf@nine.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: freebsd-geom@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: GEOM-specific discussions and implementations List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Sep 2013 23:48:17 -0000 The patch below is a workaround for the "bouncing geom" problem that occurs primarily with labels. Say da0p1 and da1p1 are labeled "mir0" and "mir1" respectively, so they exist both as /dev/da[01]p1 and as /dev/gpt/mir[01]. Create a mirror on top of gpt/mir[01], then stop the mirror. GEOM won't retaste gpt/root[01], but it will see and taste da[01]p1, and the mirror will immediately reappear. The patch adds a sysctl which can be used to temporarily disable tasting so you can stop the mirror and safely disconnect the disks. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no Index: sys/geom/geom_int.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/geom/geom_int.h (revision 255780) +++ sys/geom/geom_int.h (working copy) @@ -75,6 +75,7 @@ /* geom_kern.c / geom_kernsim.c */ void g_init(void); extern int g_shutdown; +extern int g_notaste; =20 /* geom_ctl.c */ void g_ctl_init(void); Index: sys/geom/geom_kern.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/geom/geom_kern.c (revision 255780) +++ sys/geom/geom_kern.c (working copy) @@ -66,6 +66,7 @@ int g_debugflags; int g_collectstats =3D 1; int g_shutdown; +int g_notaste; =20 /* * G_UP and G_DOWN are the two threads which push I/O through the @@ -208,6 +209,9 @@ SYSCTL_INT(_kern_geom, OID_AUTO, debugflags, CTLFLAG_RW, &g_debugflags, 0, "Set various trace levels for GEOM debugging"); =20 +SYSCTL_INT(_kern_geom, OID_AUTO, notaste, CTLFLAG_RW, + &g_notaste, 0, "Prevent GEOM tasting"); + SYSCTL_INT(_kern_geom, OID_AUTO, collectstats, CTLFLAG_RW, &g_collectstats, 0, "Control statistics collection on GEOM providers and consumers"); Index: sys/geom/geom_subr.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/geom/geom_subr.c (revision 255780) +++ sys/geom/geom_subr.c (working copy) @@ -271,7 +271,7 @@ g_topology_assert(); if (flag =3D=3D EV_CANCEL) /* XXX: can't happen ? */ return; - if (g_shutdown) + if (g_shutdown || g_notaste) return; =20 hh =3D arg; @@ -540,6 +540,8 @@ cp->geom->attrchanged !=3D NULL) cp->geom->attrchanged(cp, "GEOM::media"); } + if (g_notaste) + return; LIST_FOREACH(mp, &g_classes, class) { if (mp->taste =3D=3D NULL) continue;