From owner-freebsd-stable Sat Nov 17 2:43:28 2001 Delivered-To: freebsd-stable@freebsd.org Received: from emmi.physik.TU-Berlin.DE (emmi.physik.TU-Berlin.DE [130.149.160.103]) by hub.freebsd.org (Postfix) with ESMTP id 473AD37B405 for ; Sat, 17 Nov 2001 02:43:23 -0800 (PST) Received: (from ibex@localhost) by emmi.physik.TU-Berlin.DE (8.11.6/8.11.6) id fAHAhCk56502; Sat, 17 Nov 2001 11:43:12 +0100 (CET) (envelope-from ibex) Date: Sat, 17 Nov 2001 11:43:12 +0100 From: Dirk Froemberg To: "Kenneth D. Merry" Cc: Poul-Henning Kamp , stable@FreeBSD.ORG Subject: Re: kernel panic if using SCSI CDROM as root device Message-ID: <20011117114312.A56372@physik.TU-Berlin.DE> References: <20011115152226.A35113@panzer.kdm.org> <5832.1005863617@critter.freebsd.dk> <20011115154058.A35230@panzer.kdm.org> <20011116075743.A96224@physik.TU-Berlin.DE> <20011116213802.A44758@panzer.kdm.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20011116213802.A44758@panzer.kdm.org>; from ken@kdm.org on Fri, Nov 16, 2001 at 09:38:02PM -0700 Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hi Kenneth! On Fri, Nov 16, 2001 at 09:38:02PM -0700, Kenneth D. Merry wrote: > On Fri, Nov 16, 2001 at 07:57:43 +0100, Dirk Froemberg wrote: > > On Thu, Nov 15, 2001 at 03:40:58PM -0700, Kenneth D. Merry wrote: > > > On Thu, Nov 15, 2001 at 23:33:37 +0100, Poul-Henning Kamp wrote: > > > > In message <20011115152226.A35113@panzer.kdm.org>, "Kenneth D. Merry" writes: > > > > >On Thu, Nov 15, 2001 at 23:11:16 +0100, Dirk Froemberg wrote: > > > > >> On Thu, Nov 15, 2001 at 02:56:15PM -0700, Kenneth D. Merry wrote: > > > > >> > [...] > > > > > [...] > > > > >Poul-Henning, any idea why this might be blowing up? It looks like the > > > > >slice pointer isn't initialized for some reason. > > > > > > > > Has the disk actually been opened ? > > > > > > Good question, I dunno. > > > > > > You'd figure this stuff would work, since the CD installation process boots > > > off of a CD. > > > > > > But of course Dirk may be using the new El Torito boot code that enables > > > non-emulation booting. (i.e. you're not booting off of a floppy image > > > anymore) Is that what you're using Dirk? > > > > No... The CD image is created with > > > > mkisofs -U -R -b cdboot/boot.flp -c cdboot/boot.catalog -o /var/tmp/bootable.iso /usr/CDROM > > > > boot.flp is a copy of 4.4-RELEASE's floppy with a GENERIC kernel on > > it. > > Ahh. > > > The iso image can be fetched from > > > > ftp://ftp.todo.de/pub/FreeBSD/CD-ROM-images/bootable.iso.bz2 > > > > if someone likes to look at it. > > > > (it's about 45 MB) > > I might, but I have an idea of what may be going on here. > > > > That would change things around somewhat, since the ISO9660 code would now > > > be running the root device where before it was probably the msdos > > > filesystem code. > > > > > > > I have fixed some instances where some of the boot-glue would issue > > > > ioctl' calls to disks which were not yet opened, that used to work, > > > > despite being a gross error. > > > > > > Yeah, I can certainly see how that could cause problems. > > Even though you're booting off a floppy, the root filesystem in this case > is ISO9660. > > After looking through the stack trace from your previous mail: > > db> trace > dsioctl(c0900b80,40046304,c03e1e28,1,c090e844) at dsioctl+0x42 > diskioctl(c0900b80,40046304,c03e1e28,1,c0355b60) at diskioctl+0x6f > iso_get_ssector(c0900b80,c0355b60,0,c0909e00,c0355b60) at iso_get_ssector+0x2e > iso_mountroot(c0909e00,c0355b60,c03e1fb0,c0900e80,c090df30) at iso_mountroot+0x47 > cd9660_mount(c0909e00,0,0,0,c0355b60) at cd9660_mount+0x2c > vfs_mountroot_try(c02dc78a) at vfs_mountroot_try+0x13d > vfs_mountroot(0,3dec00,3e6000,0,c0120670) at vfs_mountroot+0x3c > mi_startup(0,0,0,0,0) at mi_startup+0x68 > begin() at begin+0x47 > > It looks like Poul-Henning is probably right about the cause. > iso_mountroot() calls iso_get_ssector(), which issues > CDIOREADTOCHEADER and CDIOREADTOCENTRY ioctls. The thing is, the > device hasn't been opened yet -- it gets opened in iso_mountfs(), > which is called later in iso_mountroot(). > > So what needs to happen is we need to make sure the device is open > before iso_get_ssector() is called. That means we either need to do > the open in iso_mountroot(), or we need to move the call to > iso_get_ssector() into iso_mountfs(). > > I've attached a patch that does an open/close inside iso_mountroot(). > I'm open to opinions on whether the open/close should go there or > whether the iso_get_ssector() call should be moved into iso_mountfs(). > > I have only checked to see that this compiles on -stable. I don't > know whether this works. > > If you can test this out, we'll know whether this works. > > The reason the ATAPI cd driver doesn't blow up in this instance is > because it doesn't use the slice code, and evidently doesn't care if > its ioctl routine is called without it first having been opened. HURRAY! Great, it works 8-) After applying your patches I can use a ISO9660 filesystem as root on SCSI CDROMs. Thanks a lot for your efforts. If there is still anything to be done, just let me know. Regards Dirk -- Dirk Froemberg FreeBSD: The Power to Serve! http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message