From owner-freebsd-current@FreeBSD.ORG Sun Feb 22 21:32:04 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0BD9C16A4CE for ; Sun, 22 Feb 2004 21:32:04 -0800 (PST) Received: from cvsup.no.freebsd.org (c2h5oh.idi.ntnu.no [129.241.103.69]) by mx1.FreeBSD.org (Postfix) with ESMTP id 66D3243D1D for ; Sun, 22 Feb 2004 21:32:03 -0800 (PST) (envelope-from Tor.Egge@cvsup.no.freebsd.org) Received: from localhost (localhost [127.0.0.1])i1N5W137050370; Mon, 23 Feb 2004 05:32:02 GMT (envelope-from Tor.Egge@cvsup.no.freebsd.org) Date: Mon, 23 Feb 2004 05:31:57 +0000 (GMT) Message-Id: <20040223.053157.71126882.Tor.Egge@cvsup.no.freebsd.org> To: phk@phk.freebsd.dk From: Tor Egge In-Reply-To: <67154.1077401562@critter.freebsd.dk> References: <67154.1077401562@critter.freebsd.dk> X-Mailer: Mew version 2.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Multipart/Mixed; boundary="--Next_Part(Mon_Feb_23_05:31:57_2004_026)--" Content-Transfer-Encoding: 7bit cc: current@freebsd.org Subject: Re: CAUTION! device megapatch committed. X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Feb 2004 05:32:04 -0000 ----Next_Part(Mon_Feb_23_05:31:57_2004_026)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit This caused my laptop to panic during boot until I applied the enclosed patch. I found two problems: 1. cdevs put on the free list are never removed from that list even if they are returned from allocdev(). The KASSERT at line 490 of kern_conf.c triggered when creating a device for /dev/ad0 due to the structure already having a name (devstat). 2. ugen0 and ums0 were detached during probing of ata0-master. The major numbers were given back to the system by fini_cdevsw(). When the devices were reattached later during the boot the system didn't try to allocate a new major number (D_INIT was already set in the cdevsws, thus no call to prep_cdevsw()) and I got another panic. - Tor Egge ----Next_Part(Mon_Feb_23_05:31:57_2004_026)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="conffix.diff" Index: sys/kern/kern_conf.c =================================================================== RCS file: /home/ncvs/src/sys/kern/kern_conf.c,v retrieving revision 1.146 diff -u -r1.146 kern_conf.c --- sys/kern/kern_conf.c 21 Feb 2004 21:57:26 -0000 1.146 +++ sys/kern/kern_conf.c 23 Feb 2004 04:26:58 -0000 @@ -287,6 +287,7 @@ if (LIST_FIRST(&dev_free)) { si = LIST_FIRST(&dev_free); + LIST_REMOVE(si, si_hash); /* XXX: Please add locking here */ } else if (stashed >= DEVT_STASH) { MALLOC(si, struct cdev *, sizeof(*si), M_DEVT, M_USE_RESERVE | M_ZERO | M_WAITOK); @@ -399,7 +400,10 @@ reserved_majors[devsw->d_maj] = 0; devsw->d_maj = MAJOR_AUTO; devsw->d_flags &= ~D_ALLOCMAJ; - } + } else if (devsw->d_maj == 0 && (devsw->d_flags & D_INIT) != 0) + devsw->d_maj = 256; /* XXX: More tty_cons.c magic */ + /* Need to call prep_cdevsw() later to allocate new major */ + devsw->d_flags &= ~D_INIT; } static void ----Next_Part(Mon_Feb_23_05:31:57_2004_026)----