From owner-freebsd-arch@FreeBSD.ORG Tue Oct 26 16:22:55 2004 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C0F0816A4CE for ; Tue, 26 Oct 2004 16:22:55 +0000 (GMT) Received: from mail2.speakeasy.net (mail2.speakeasy.net [216.254.0.202]) by mx1.FreeBSD.org (Postfix) with ESMTP id 871A943D49 for ; Tue, 26 Oct 2004 16:22:55 +0000 (GMT) (envelope-from john@baldwin.cx) Received: (qmail 11186 invoked from network); 26 Oct 2004 16:22:55 -0000 Received: from dsl027-160-063.atl1.dsl.speakeasy.net (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) encrypted SMTP for ; 26 Oct 2004 16:22:54 -0000 Received: from zion.baldwin.cx (zion.baldwin.cx [192.168.0.7]) by server.baldwin.cx (8.12.11/8.12.11) with ESMTP id i9QGMpOs007631; Tue, 26 Oct 2004 12:22:51 -0400 (EDT) (envelope-from john@baldwin.cx) Received: from zion.baldwin.cx (localhost [127.0.0.1]) by zion.baldwin.cx (8.12.10/8.12.10) with ESMTP id i9QGMp8h015020; Tue, 26 Oct 2004 12:22:51 -0400 (EDT) (envelope-from john@zion.baldwin.cx) Received: by zion.baldwin.cx (8.12.10/8.12.10/Submit) id i9QGMoEL015019; Tue, 26 Oct 2004 12:22:50 -0400 (EDT) (envelope-from john) From: John Baldwin To: freebsd-arch@FreeBSD.org Date: Tue, 26 Oct 2004 11:53:12 -0400 User-Agent: KMail/1.6 References: <59920.1098481368@critter.freebsd.dk> In-Reply-To: <59920.1098481368@critter.freebsd.dk> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200410261153.12982.jhb@FreeBSD.org> X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on server.baldwin.cx cc: Poul-Henning Kamp Subject: Re: REVIEW: handling kldload/kldunload of GEOM classes properly. X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2004 16:22:56 -0000 On Friday 22 October 2004 05:42 pm, Poul-Henning Kamp wrote: > There are a number of system calls which starts events running in > GEOM and which for consistency should not return to userland until > those events have completed and GEOM has settled down. > > The typical example would be a shell-script doing: > > kldload md > mdconfig bla bla > > > Examples of such syscalls are: > > open(2) & close(2): can cause spoils and retastes > > mount(2)/umount(2): acts as open/close. > > (any other syscall doing a VOP_OPEN/VOP_CLOSE on a diskdevice.) > > ioctl(2): directed configuration can do almost anything. > > kldload(2)/kldunload(2): can load/unload GEOm classes. > > The last one is the most tricky one: The crude solution is to always > wait for geom to settle before returning to userland from kldload(2), > but there is no point in waiting for GEOM if you loaded a USB > serial driver and doing so would increase the risk of cascade > failures. > > A further complication is that we should not wait for geom to settle > until after we have dropped Giant again because the geom events > might need to grab giant to do their job. Just a note on this: If you sleep in your waiting function (i.e. call msleep() or cv_wait()), then Giant will be dropped automatically so that you don't need to worry about events needing Giant. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/