Date: Mon, 23 Feb 2004 05:31:57 +0000 (GMT) From: Tor Egge <Tor.Egge@cvsup.no.freebsd.org> To: phk@phk.freebsd.dk Cc: current@freebsd.org Subject: Re: CAUTION! device megapatch committed. Message-ID: <20040223.053157.71126882.Tor.Egge@cvsup.no.freebsd.org> In-Reply-To: <67154.1077401562@critter.freebsd.dk> References: <67154.1077401562@critter.freebsd.dk>
next in thread | previous in thread | raw e-mail | index | archive | help
----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)----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040223.053157.71126882.Tor.Egge>