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>

index | next in thread | raw e-mail

[-- Attachment #1 --]
Hello

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

# dd if=/dev/zero of=somebackingfile bs=1k count=10k
# 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=0x0, lp=0xbfbff9d0, part=134540284, lineno=5) at bsdlabel.c:999
999                             if (pp->p_size < 1024*1024*1024 / lp->d_secsize) {
(gdb) bt
#0  0x0804ad88 in getasciipartspec (tp=0x0, lp=0xbfbff9d0, part=134540284, lineno=5) at bsdlabel.c:999
#1  0x0804aa37 in getasciilabel (f=0x2816c6c0, lp=0xbfbff9d0) at bsdlabel.c:879
#2  0x08049f2f in edit () at bsdlabel.c:562
#3  0x0804934a in main (argc=1, argv=0xbfbffb74) at bsdlabel.c:234
#4  0x08049065 in _start ()
(gdb) print lp->d_secsize
$1 = 0

100% reproduceable on :
FreeBSD ford.nitro.dk 5.1-BETA FreeBSD 5.1-BETA #3: Tue May  6 22:49:47 CEST 2003     FreeBSD@trillian.nitro.dk:/usr/obj/data/FreeBSD/clean-CURRENT/sys/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
===================================================================
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 = v / pp->p_fsize;
 			NXTNUM(pp->p_cpg);
 		} else {
+			/* HACK: Check for odd sectorsize e.g. from md devices */
+			if(lp->d_secsize == 0)
+				lp->d_secsize = 512;
+
 			/*
 			 * FIX! poor attempt at adaptive
 			 */
%%%

-- 
Simon L. Nielsen

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (FreeBSD)

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

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