Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Apr 2002 02:17:36 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Joerg Wunsch <joerg_wunsch@uriah.heep.sax.de>
Cc:        freebsd-current@freebsd.org, "Crist J. Clark" <crist.clark@attbi.com>, <bde@freebsd.org>
Subject:   Re: disklabel(8) floppy panic
Message-ID:  <20020403015713.E6933-100000@gamplex.bde.org>
In-Reply-To: <200204012113.g31LDKt02333@uriah.heep.sax.de>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020403015713.E6933-100000>