Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 May 2003 01:33:09 +0200
From:      "Simon L. Nielsen" <simon@nitro.dk>
To:        freebsd-current@freebsd.org
Subject:   Coredump in disklabel with md device
Message-ID:  <20030506233309.GE86292@nitro.dk>

next in thread | raw e-mail | index | archive | help

--OROCMA9jn6tkzFBc
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hello

While trying to make a patch for docs/51897 and testing it I'm making
bsdlabel/disklabel coredump :

# dd if=3D/dev/zero of=3Dsomebackingfile bs=3D1k count=3D10k
# mdconfig -a -t vnode -f somebackingfile -u 0
# disklabel -w md0
# disklabel -e md0

I then add :

  d:    *       0       4.2BSD

and get a floating exception coredump. It seems the memory device
is reporting a sector size of 0 (if I read the code right) :

0x0804ad88 in getasciipartspec (tp=3D0x0, lp=3D0xbfbff9d0, part=3D134540284=
, lineno=3D5) at bsdlabel.c:999
999                             if (pp->p_size < 1024*1024*1024 / lp->d_sec=
size) {
(gdb) bt
#0  0x0804ad88 in getasciipartspec (tp=3D0x0, lp=3D0xbfbff9d0, part=3D13454=
0284, lineno=3D5) at bsdlabel.c:999
#1  0x0804aa37 in getasciilabel (f=3D0x2816c6c0, lp=3D0xbfbff9d0) at bsdlab=
el.c:879
#2  0x08049f2f in edit () at bsdlabel.c:562
#3  0x0804934a in main (argc=3D1, argv=3D0xbfbffb74) at bsdlabel.c:234
#4  0x08049065 in _start ()
(gdb) print lp->d_secsize
$1 =3D 0

100% reproduceable on :
FreeBSD ford.nitro.dk 5.1-BETA FreeBSD 5.1-BETA #3: Tue May  6 22:49:47 CES=
T 2003     FreeBSD@trillian.nitro.dk:/usr/obj/data/FreeBSD/clean-CURRENT/sy=
s/GENERIC  i386

If I hack bsdlabel to force 512 byte sectors (like below) everything
seems to work fine (I can newfs and mount the new device).

%%%
Index: bsdlabel.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /data/FreeBSD/ncvs/src/sbin/bsdlabel/bsdlabel.c,v
retrieving revision 1.90
diff -u -r1.90 bsdlabel.c
--- bsdlabel.c	4 May 2003 19:27:22 -0000	1.90
+++ bsdlabel.c	7 May 2003 01:29:13 -0000
@@ -992,6 +992,10 @@
 			pp->p_frag =3D v / pp->p_fsize;
 			NXTNUM(pp->p_cpg);
 		} else {
+			/* HACK: Check for odd sectorsize e.g. from md devices */
+			if(lp->d_secsize =3D=3D 0)
+				lp->d_secsize =3D 512;
+
 			/*
 			 * FIX! poor attempt at adaptive
 			 */
%%%

--=20
Simon L. Nielsen

--OROCMA9jn6tkzFBc
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (FreeBSD)

iD8DBQE+uEY18kocFXgPTRwRAq5HAJwIpJQHY+6ASbSUpUXlMc5WWsfOnACg23OI
WYvnNE1C0Or3I+9YIlyvbuI=
=Gh74
-----END PGP SIGNATURE-----

--OROCMA9jn6tkzFBc--



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