Bug 22029

Summary: use of softdependencies leads to major filesystem inconsistencies
Product: Base System Reporter: weiss
Component: kernAssignee: Kirk McKusick <mckusick>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.1.1-RELEASE   
Hardware: Any   
OS: Any   

Description weiss 2000-10-16 18:30:01 UTC
After I enabled soft dependencies on a filesystem a stress test
leads repeatedly to major filesystem inconsistencies, which result
in kernel panics: `ffs_valloc: dup alloc'
An fsck run afterwards reveals `allocated frag marked free' messages
(about 20 or so).


Copyright (c) 1992-2000 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.1.1-RELEASE #0: Tue Sep 26 00:46:59 GMT 2000
    jkh@narf.osd.bsdi.com:/usr/src/sys/compile/GENERIC
Timecounter "i8254"  frequency 1193182 Hz
CPU: Pentium III/Pentium III Xeon/Celeron (701.59-MHz 686-class CPU)
  Origin = "GenuineIntel"  Id = 0x683  Stepping = 3
  Features=0x383fbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR,XMM>
real memory  = 536858624 (524276K bytes)
avail memory = 518610944 (506456K bytes)
Preloaded elf kernel "kernel" at 0xc0416000.
Pentium Pro MTRR support enabled
md0: Malloc disk
npx0: <math processor> on motherboard
npx0: INT 16 interface
pcib0: <Intel 82443BX (440 BX) host to PCI bridge> on motherboard
pci0: <PCI bus> on pcib0
pcib1: <Intel 82443BX (440 BX) PCI-PCI (AGP) bridge> at device 1.0 on pci0
pci1: <PCI bus> on pcib1
pci1: <ATI Mach64-GZ graphics accelerator> at 0.0 irq 11
isab0: <Intel 82371AB PCI to ISA bridge> at device 4.0 on pci0
isa0: <ISA bus> on isab0
atapci0: <Intel PIIX4 ATA33 controller> port 0xb800-0xb80f at device 4.1 on pci0
ata0: at 0x1f0 irq 14 on atapci0
ata1: at 0x170 irq 15 on atapci0
uhci0: <Intel 82371AB/EB (PIIX4) USB controller> port 0xb400-0xb41f at device 4.2 on pci0
uhci0: Invalid irq 255
uhci0: Please switch on USB support and switch PNP-OS to 'No' in BIOS
device_probe_and_attach: uhci0 attach returned 6
chip1: <Intel 82371AB Power management controller> port 0xe800-0xe80f at device 4.3 on pci0
pci0: <unknown card> (vendor=0x1385, dev=0x620a) at 9.0 irq 12
de0: <Digital 21140A Fast Ethernet> port 0xb000-0xb07f mem 0xe1000000-0xe100007f irq 10 at device 11.0 on pci0
de0: 21140A [10-100Mb/s] pass 2.2
de0: address 00:80:c8:f6:43:ea
fdc0: <NEC 72065B or clone> at port 0x3f0-0x3f5,0x3f7 irq 6 drq 2 on isa0
fdc0: FIFO enabled, 8 bytes threshold
fd0: <1440-KB 3.5" drive> on fdc0 drive 0
atkbdc0: <Keyboard controller (i8042)> at port 0x60,0x64 on isa0
atkbd0: <AT Keyboard> flags 0x1 irq 1 on atkbdc0
kbd0 at atkbd0
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>
sio0 at port 0x3f8-0x3ff irq 4 flags 0x10 on isa0
sio0: type 16550A
sio1 at port 0x2f8-0x2ff irq 3 on isa0
sio1: type 16550A
ppc0: <Parallel port> at port 0x378-0x37f irq 7 on isa0
ppc0: SMC-like chipset (ECP/EPP/PS2/NIBBLE) in COMPATIBLE mode
ppc0: FIFO with 16/16/9 bytes threshold
plip0: <PLIP network interface> on ppbus0
lpt0: <Printer> on ppbus0
lpt0: Interrupt-driven port
ppi0: <Parallel I/O> on ppbus0
ad0: 29314MB <IBM-DTLA-307030> [59560/16/63] at ata0-master using UDMA33
acd0: CDROM <CD-ROM 48X/AKU> at ata1-master using PIO4
Mounting root from ufs:/dev/ad0s1a

How-To-Repeat: Enable soft dependencies on a file system, disable fsck in /etc/fstab
and enable the force mount option for that file system. File system
is named <> in the following:

mkdir <>/newsrc <>/newsrc/xxx
cp -R /usr/src <>/newsrc & cp -R /usr/src <>/newsrc/xxx & sleep 20;
rm -rf <>/newsrc/src

wait 10 seconds and press the reset button. Doing this at most twice
gives you an inconsistent file system and a kernel panic during
the third run.
Comment 1 ps freebsd_committer freebsd_triage 2000-10-20 23:02:27 UTC
Responsible Changed
From-To: freebsd-bugs->mckusick

Kirk would like to look at this.
Comment 2 Kirk McKusick freebsd_committer freebsd_triage 2002-02-11 00:21:27 UTC
State Changed
From-To: open->closed

This problem is believed to be fixed by changes in the buffer cache 
code in recent months.