From ijliao@FreeBSD.csie.NCTU.edu.tw  Mon Jul 29 22:42:18 2002
Return-Path: <ijliao@FreeBSD.csie.NCTU.edu.tw>
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 2540937B400
	for <freebsd-gnats-submit@freebsd.org>; Mon, 29 Jul 2002 22:42:18 -0700 (PDT)
Received: from FreeBSD.csie.NCTU.edu.tw (freebsd.csie.nctu.edu.tw [140.113.17.209])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 0DBE143E3B
	for <freebsd-gnats-submit@freebsd.org>; Mon, 29 Jul 2002 22:42:16 -0700 (PDT)
	(envelope-from ijliao@FreeBSD.csie.NCTU.edu.tw)
Received: (from root@localhost)
	by FreeBSD.csie.NCTU.edu.tw (8.12.5/8.12.3) id g6U5hHop099606
	for freebsd-gnats-submit@freebsd.org; Tue, 30 Jul 2002 13:43:17 +0800 (CST)
	(envelope-from ijliao@FreeBSD.csie.NCTU.edu.tw)
Received: from FreeBSD.csie.NCTU.edu.tw (localhost [127.0.0.1])
	by FreeBSD.csie.NCTU.edu.tw (8.12.5/8.12.3av) with ESMTP id g6U5hGtt099596
	(version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO)
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 30 Jul 2002 13:43:16 +0800 (CST)
	(envelope-from ijliao@FreeBSD.csie.NCTU.edu.tw)
Received: (from ijliao@localhost)
	by FreeBSD.csie.NCTU.edu.tw (8.12.5/8.12.5/Submit) id g6U5hGx9099595;
	Tue, 30 Jul 2002 13:43:16 +0800 (CST)
Message-Id: <200207300543.g6U5hGx9099595@FreeBSD.csie.NCTU.edu.tw>
Date: Tue, 30 Jul 2002 13:43:16 +0800 (CST)
From: Ying-Chieh Liao <ijliao@csie.nctu.edu.tw>
Reply-To: Ying-Chieh Liao <ijliao@csie.nctu.edu.tw>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: newfs core dump (args : -b 262144 -f 32768)
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         41145
>Category:       bin
>Synopsis:       newfs core dump (args : -b 262144 -f 32768)
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jul 29 22:50:01 PDT 2002
>Closed-Date:    Mon Feb 24 01:18:01 PST 2003
>Last-Modified:  Mon Feb 24 01:18:01 PST 2003
>Originator:     Ying-Chieh Liao
>Release:        FreeBSD 4.6-STABLE i386
>Organization:
NCTU CSIE
>Environment:
System: FreeBSD FreeBSD.csie.NCTU.edu.tw 4.6-STABLE FreeBSD 4.6-STABLE #3: Fri Jun 28 18:37:58 CST 2002 root@FreeBSD.csie.NCTU.edu.tw:/freebsd/...../usr.obj/freebsd/source/FreeBSD-4/src/sys/FREEBSD i386

/var/run/dmesg.boot :

Copyright (c) 1992-2002 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
	The Regents of the University of California. All rights reserved.
FreeBSD 4.6-STABLE #3: Fri Jun 28 18:37:58 CST 2002
    root@FreeBSD.csie.NCTU.edu.tw:/freebsd/...../usr.obj/freebsd/source/FreeBSD-4/src/sys/FREEBSD
Timecounter "i8254"  frequency 1193182 Hz
CPU: Pentium III/Pentium III Xeon/Celeron (1129.76-MHz 686-class CPU)
  Origin = "GenuineIntel"  Id = 0x6b1  Stepping = 1
  Features=0x383fbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR,SSE>
real memory  = 2147483648 (2097152K bytes)
avail memory = 2088763392 (2039808K bytes)
Programming 16 pins in IOAPIC #0
IOAPIC #0 intpin 2 -> irq 0
Programming 16 pins in IOAPIC #1
FreeBSD/SMP: Multiprocessor motherboard
 cpu0 (BSP): apic id:  0, version: 0x00040011, at 0xfee00000
 cpu1 (AP):  apic id:  1, version: 0x00040011, at 0xfee00000
 io0 (APIC): apic id:  4, version: 0x000f0011, at 0xfec00000
 io1 (APIC): apic id:  5, version: 0x000f0011, at 0xfec01000
Preloaded elf kernel "kernel" at 0xc02ef000.
Pentium Pro MTRR support enabled
Using $PIR table, 10 entries at 0xc00f51c0
npx0: <math processor> on motherboard
npx0: INT 16 interface
pcib0: <ServerWorks NB6635 3.0LE host to PCI bridge> on motherboard
IOAPIC #1 intpin 6 -> irq 2
IOAPIC #1 intpin 4 -> irq 5
IOAPIC #1 intpin 5 -> irq 9
pci0: <PCI bus> on pcib0
pci0: <ATI Mach64-GR graphics accelerator> at 1.0 irq 2
fxp0: <Intel Pro 10/100B/100+ Ethernet> port 0xc400-0xc43f mem 0xfe800000-0xfe8fffff,0xfe9fe000-0xfe9fefff irq 5 at device 4.0 on pci0
fxp0: Ethernet address 00:e0:81:04:5c:72
inphy0: <i82555 10/100 media interface> on miibus0
inphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
fxp1: <Intel Pro 10/100B/100+ Ethernet> port 0xc000-0xc03f mem 0xfe600000-0xfe6fffff,0xfe9fd000-0xfe9fdfff irq 9 at device 5.0 on pci0
fxp1: Ethernet address 00:e0:81:04:5c:73
inphy1: <i82555 10/100 media interface> on miibus1
inphy1:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
isab0: <ServerWorks IB6566 PCI to ISA bridge> at device 15.0 on pci0
isa0: <ISA bus> on isab0
atapci0: <ServerWorks ROSB4 ATA33 controller> at device 15.1 on pci0
atapci0: ATA channel disabled by BIOS
pci0: <OHCI USB controller> at 15.2 irq 10
pcib1: <ServerWorks NB6635 3.0LE host to PCI bridge> on motherboard
IOAPIC #1 intpin 11 -> irq 11
IOAPIC #1 intpin 7 -> irq 15
pci1: <PCI bus> on pcib1
atapci1: <Promise TX2 ATA100 controller> port 0xef90-0xef9f,0xefa8-0xefab,0xefa0-0xefa7,0xefac-0xefaf,0xefe0-0xefe7 mem 0xfebfc000-0xfebfffff irq 11 at device 2.0 on pci1
ata2: at 0xefe0 on atapci1
ata3: at 0xefa0 on atapci1
pcib2: <PCI to PCI bridge (vendor=1044 device=a500)> at device 3.0 on pci1
pci2: <PCI bus> on pcib2
asr0: <Adaptec Caching SCSI RAID> mem 0xe0000000-0xefffffff irq 15 at device 3.1 on pci1
asr0: major=154
asr0: ADAPTEC 3210S FW Rev. 370F, 2 channel, 256 CCBs, Protocol I2O
orm0: <Option ROMs> at iomem 0xc0000-0xc7fff,0xc8000-0xc9fff,0xca000-0xcafff,0xcb000-0xcbfff,0xcc000-0xd1fff on isa0
atkbdc0: <Keyboard controller (i8042)> at port 0x60,0x64 on isa0
atkbd0: <AT Keyboard> flags 0x1 irq 1 on atkbdc0
kbd0 at atkbd0
psm0: <PS/2 Mouse> irq 12 on atkbdc0
psm0: model IntelliMouse, device ID 3
vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0
sc0: <System console> at flags 0x100 on isa0
sc0: VGA <16 virtual consoles, flags=0x300>
APIC_IO: Testing 8254 interrupt delivery
APIC_IO: Broken MP table detected: 8254 is not connected to IOAPIC #0 intpin 2
APIC_IO: routing 8254 via 8259 and IOAPIC #0 intpin 0
IP packet filtering initialized, divert enabled, rule-based forwarding enabled, default to accept, unlimited logging
SMP: AP CPU #1 Launched!
ad4: 76319MB <ST380020A> [155061/16/63] at ata2-master UDMA100
ad5: 76319MB <ST380020A> [155061/16/63] at ata2-slave UDMA100
ad6: 76319MB <ST380020A> [155061/16/63] at ata3-master UDMA100
Mounting root from ufs:/dev/da0s1a
da0 at asr0 bus 0 target 1 lun 0
da0: <ADAPTEC RAID-5 370F> Fixed Direct Access SCSI-2 device 
da0: Tagged Queueing Enabled
da0: 175012MB (358424576 512 byte sectors: 255H 63S/T 22310C)
da1 at asr0 bus 1 target 3 lun 0
da1: <RackForc e 0001> Fixed Direct Access SCSI-3 device 
da1: Tagged Queueing Enabled
da1: 534383MB (1094418415 512 byte sectors: 255H 63S/T 2588C)

>Description:

We have a new RAID (SCSI-to-IDE, Maxtor 80G x 8, RAID5) on da1
when I run newfs with "-b 262144 -f 32768 -m 0", it core-dumped
but it's ok with "-b 65536 -f 8192 -m 0"

it is strange that I've run newfs -b 262144 on a vinum (80G x 3, RAID1)
and everything is ok

you can fetch core at
http://freebsd.csie.nctu.edu.tw/~ijliao/newfs.core

>How-To-Repeat:

newfs -b 262144 -f 32768 -m 0 /dev/da1s1e

>Fix:

	


>Release-Note:
>Audit-Trail:

From: Bruce Evans <bde@zeta.org.au>
To: Ying-Chieh Liao <ijliao@csie.nctu.edu.tw>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/41145: newfs core dump (args : -b 262144 -f 32768)
Date: Tue, 30 Jul 2002 19:59:22 +1000 (EST)

 On Tue, 30 Jul 2002, Ying-Chieh Liao wrote:
 
 > >Description:
 >
 > We have a new RAID (SCSI-to-IDE, Maxtor 80G x 8, RAID5) on da1
 > when I run newfs with "-b 262144 -f 32768 -m 0", it core-dumped
 > but it's ok with "-b 65536 -f 8192 -m 0"
 >
 > it is strange that I've run newfs -b 262144 on a vinum (80G x 3, RAID1)
 > and everything is ok
 
 There is a kernel limit of MAXBSIZE = 65536, so ufs filesystems with
 a block size larger than 65536 cannot be mounted in FreeBSD.  newfs
 and fsck_ffs use the same limit, so the cannot create or check such
 filesystems.  newfs tends to die trying since it doesn't check for the
 limit being exceeded and uses data structures that depend on it not
 being exceeded.  fsck_ffs tends to just not recognise such filesystems,
 since it checks the limit as part of its sanity check/search for the
 superblock.
 
 Bruce
 

From: David Schultz <dschultz@uclink.Berkeley.EDU>
To: Bruce Evans <bde@zeta.org.au>
Cc: freebsd-gnats-submit@FreeBSD.org, ijliao@csie.nctu.edu.tw
Subject: Re: bin/41145: newfs core dump (args : -b 262144 -f 32768)
Date: Mon, 26 Aug 2002 07:23:53 -0700

 > There is a kernel limit of MAXBSIZE = 65536, so ufs filesystems with
 > a block size larger than 65536 cannot be mounted in FreeBSD.  newfs
 > and fsck_ffs use the same limit, so the cannot create or check such
 > filesystems.  newfs tends to die trying since it doesn't check for the
 > limit being exceeded and uses data structures that depend on it not
 > being exceeded.  fsck_ffs tends to just not recognise such filesystems,
 > since it checks the limit as part of its sanity check/search for the
 > superblock.
 
 There appears to be a deficiency in newfs's bounds checking code.
 The following (untested) patch improves the bounds checking,
 squelches a duplicate `increasing block size' diagnostic, and
 tweaks the docs.
 
 Note that it is still possible to kill newfs if you try hard,
 e.g. by specifying an unreasonable sector size.  But
 realistically, nobody fiddles with the sector size anyway, so
 carefully checking the block and fragment sizes should be
 sufficient to handle silly mistakes.  IMHO, the code would be much
 more maintainable if it quit when it encountered an invalid
 parameter, instead of trying to magically adjust everything.
 
 
 Index: mkfs.c
 ===================================================================
 RCS file: /home/ncvs/src/sbin/newfs/mkfs.c,v
 retrieving revision 1.61
 diff -u -r1.61 mkfs.c
 --- mkfs.c	2002/08/21 18:11:21	1.61
 +++ mkfs.c	2002/08/26 14:10:45
 @@ -193,7 +193,12 @@
  		    sblock.fs_fsize, sectorsize);
  		sblock.fs_fsize = sectorsize;
  	}
 -	if (sblock.fs_bsize < MINBSIZE) {
 +        if (sblock.fs_fsize > MAXBSIZE) {
 +		printf("decreasing fragment size from %d to MAXBSIZE (%d)\n",
 +		    sblock.fs_fsize, MAXBSIZE);
 +		sblock.fs_fsize = MAXBSIZE;
 +        }
 +	if (sblock.fs_bsize < MINBSIZE && sblock.fs_fsize <= MINBSIZE) {
  		printf("increasing block size from %d to minimum (%d)\n",
  		    sblock.fs_bsize, MINBSIZE);
  		sblock.fs_bsize = MINBSIZE;
 @@ -203,6 +208,11 @@
  		    sblock.fs_bsize, sblock.fs_fsize);
  		sblock.fs_bsize = sblock.fs_fsize;
  	}
 +	if (sblock.fs_bsize > MAXBSIZE) {
 +                printf("decreasing block size from %d to MAXBSIZE (%d)\n",
 +                    sblock.fs_bsize, MAXBSIZE);
 +                sblock.fs_bsize = MAXBSIZE;
 +        }
  	if (sblock.fs_fsize * MAXFRAG < sblock.fs_bsize) {
  		printf(
  		"increasing fragment size from %d to block size / %d (%d)\n",
 Index: newfs.8
 ===================================================================
 RCS file: /home/ncvs/src/sbin/newfs/newfs.8,v
 retrieving revision 1.55
 diff -u -r1.55 newfs.8
 --- newfs.8	2002/08/21 18:11:21	1.55
 +++ newfs.8	2002/08/26 14:10:45
 @@ -102,7 +102,7 @@
  The block size of the file system, in bytes.
  It must be a power of 2.
  The
 -default size is 16384 bytes, and the smallest allowable size is 4096 bytes.
 +default size is 16384 bytes, and the allowable range is 4096 to 65536 bytes.
  The optimal block:fragment ratio is 8:1.
  Other ratios are possible, but are not recommended,
  and may produce poor results.
 Index: newfs.c
 ===================================================================
 RCS file: /home/ncvs/src/sbin/newfs/newfs.c,v
 retrieving revision 1.63
 diff -u -r1.63 newfs.c
 --- newfs.c	2002/08/21 18:11:21	1.63
 +++ newfs.c	2002/08/26 14:10:45
 @@ -186,7 +186,8 @@
  				    optarg);
  			break;
  		case 'b':
 -			if ((bsize = atoi(optarg)) < MINBSIZE)
 +			if ((bsize = atoi(optarg)) < MINBSIZE ||
 +			    bsize > MAXBSIZE)
  				errx(1, "%s: bad block size", optarg);
  			break;
  		case 'c':
 @@ -204,7 +205,7 @@
  				    optarg);
  			break;
  		case 'f':
 -			if ((fsize = atoi(optarg)) <= 0)
 +			if ((fsize = atoi(optarg)) <= 0 || fsize > MAXBSIZE)
  				errx(1, "%s: bad fragment size", optarg);
  			break;
  		case 'g':
 
State-Changed-From-To: open->closed 
State-Changed-By: das 
State-Changed-When: Mon Feb 24 01:17:24 PST 2003 
State-Changed-Why:  
Fixed in src/sbin/newfs/newfs.c,v 1.66. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=41145 
>Unformatted:
