From owner-freebsd-current Tue Apr 2 8:17:10 2002 Delivered-To: freebsd-current@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id 0883637B400; Tue, 2 Apr 2002 08:17:03 -0800 (PST) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id CAA21966; Wed, 3 Apr 2002 02:16:41 +1000 Date: Wed, 3 Apr 2002 02:17:36 +1000 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Joerg Wunsch Cc: freebsd-current@freebsd.org, "Crist J. Clark" , Subject: Re: disklabel(8) floppy panic In-Reply-To: <200204012113.g31LDKt02333@uriah.heep.sax.de> Message-ID: <20020403015713.E6933-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Mon, 1 Apr 2002, Joerg Wunsch wrote: > fdioctl() historically attempted to determine the "raw" partition > (`c') of the device in order to read the label. However, the floppy > driver never really supported UFS-style partitions anyway. This ended > up in selecting the wrong device for reading the label, which was a > not-so-fatal error before the last floppy driver rewrite (it actually > selected the fdX.1480 device then, which was obviously benign for 3.5" > drives). However, now it hits an unitialized device which becomes Yikes. > fatal in readdisklabel() by attempting an indirect call to the > strategy routine that hasn't been entered in the struct dev passed > down. > The call to dkmodpart() entered in rev. 1.64 of fd.c, so i'm Cc'ing > Bruce for a comment whether the fix below is indeed TRT. > > Index: sys/isa/fd.c > =================================================================== > RCS file: /home/ncvs/src/sys/isa/fd.c,v > retrieving revision 1.224 > diff -u -r1.224 fd.c > --- isa/fd.c 18 Dec 2001 22:16:33 -0000 1.224 > +++ isa/fd.c 1 Apr 2002 20:56:22 -0000 > @@ -2704,7 +2704,7 @@ > fdt = fd->ft; > lp->d_secpercyl = fdt->size / fdt->tracks; > lp->d_type = DTYPE_FLOPPY; > - if (readdisklabel(dkmodpart(dev, RAW_PART), lp) != NULL) > + if (readdisklabel(dev, lp) != NULL) > error = EINVAL; > else > *(struct disklabel *)addr = *lp; > I think this is the right fix. The `dk' macros don't apply to the floppy driver since it doesn't use the disk or diskslice layer. This one probably escaped from my version which optionally uses the diskslice layer. Sorry. You probably remmeber the "Trick diskerr()" stuff. That was for related things. I had to fix this better for the slice case. The problem is that dkmodpart() gives a half-baked device struct. It used to just modify the minor number, and everything that deals with the minor number handled weird ones reasonably. Even fd handled them as reasonably as possible (fdX.1480 was perfect GIGO). BTW, device cloning seems to work wrong for fd: %%% Script started on Wed Apr 3 02:16:43 2002 ttyp1:bde@besplex:/tmp> ls /dev/fd0c ls: /dev/fd0c: No such file or directory ttyp1:bde@besplex:/tmp> ls /dev/fd0c /dev/fd0c@ ttyp1:bde@besplex:/tmp> exit Script done on Wed Apr 3 02:16:55 2002 %%% Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message