Bug 154828 - [msdosfs] Unable to create directories on external USB HDD with large msdosfs [regression]
Summary: [msdosfs] Unable to create directories on external USB HDD with large msdosfs...
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-16 19:20 UTC by Frank Scheckenbach
Modified: 2024-02-21 01:31 UTC (History)
2 users (show)

See Also:


Attachments
Proposed fix (356 bytes, patch)
2024-02-19 07:55 UTC, Tomi Tapper
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Scheckenbach 2011-02-16 19:20:09 UTC
After a binary update from 8.2-RC2 to 8.2-RC3 I can no longer create
directories on my external USB HDD. The filesystem is fat32 and the
drive is manually mounted using "mount_msdosfs -o large".  Writing,
editing and deleting files is still possible. But even when I write
files to the HDD, dmesg reports errors
"g_vfs_done():da0s1[WRITE(offset=- ... , length=16384)]error = 5",
although, the files are correctly written. It is even possible to delete
directories but creating directories is impossible. The error does not
occur on any fat16/fat32 USB flash disk, nor did it occur before updating
to 8.2-RC3. Once the systems starts reporting these errors, it is
impossible to unmount the HDD, and if I force it to unmount the HDD
using "unmount -f" the systems freezes. Furthermore, these errors are
reported continuously, after writing once to the HDD, and do never stop.

The drive is working fine with other OSs and "fsck_msdosfs" reported a
clean filesystem.

#################################################
dmesg
#################################################

Copyright (c) 1992-2011 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 is a registered trademark of The FreeBSD Foundation.
FreeBSD 8.2-RC2 #0: Wed Jan 12 17:02:35 UTC 2011
    root@mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64
Timecounter "i8254" frequency 1193182 Hz quality 0
CPU: Genuine Intel(R) CPU           U2300  @ 1.20GHz (1197.01-MHz K8-class CPU)
  Origin = "GenuineIntel"  Id = 0x1067a  Family = 6  Model = 17  Stepping = 10
  Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
  Features2=0x400e3bd<SSE3,DTES64,MON,DS_CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,XSAVE>
  AMD Features=0x20100800<SYSCALL,NX,LM>
  AMD Features2=0x1<LAHF>
  TSC: P-state invariant
real memory  = 2147483648 (2048 MB)
avail memory = 2012815360 (1919 MB)
ACPI APIC Table: <PTLTD  	 APIC  >
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
FreeBSD/SMP: 1 package(s) x 2 core(s)
 cpu0 (BSP): APIC ID:  0
 cpu1 (AP): APIC ID:  1
ioapic0 <Version 2.0> irqs 0-23 on motherboard
kbd1 at kbdmux0
acpi0: <LENOVO CB-01> on motherboard
acpi0: [ITHREAD]
acpi0: Power Button (fixed)
acpi_hpet0: <High Precision Event Timer> iomem 0xfed00000-0xfed003ff on acpi0
Timecounter "HPET" frequency 14318180 Hz quality 900
Timecounter "ACPI-fast" frequency 3579545 Hz quality 1000
acpi_timer0: <24-bit timer at 3.579545MHz> port 0x408-0x40b on acpi0
cpu0: <ACPI CPU> on acpi0
cpu1: <ACPI CPU> on acpi0
acpi_ec0: <Embedded Controller: GPE 0x1c> port 0x62,0x66 on acpi0
acpi_lid0: <Control Method Lid Switch> on acpi0
acpi_button0: <Power Button> on acpi0
acpi_button1: <Sleep Button> on acpi0
pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
pci0: <ACPI PCI bus> on pcib0
vgapci0: <VGA-compatible display> port 0x1800-0x1807 mem 0xf0000000-0xf03fffff,0xd0000000-0xdfffffff irq 16 at device 2.0 on pci0
agp0: <Intel GM45 SVGA controller> on vgapci0
agp0: detected 32764k stolen memory
agp0: aperture size is 256M
vgapci1: <VGA-compatible display> mem 0xf0400000-0xf04fffff at device 2.1 on pci0
uhci0: <Intel 82801I (ICH9) USB controller> port 0x1820-0x183f irq 21 at device 26.0 on pci0
uhci0: [ITHREAD]
usbus0: <Intel 82801I (ICH9) USB controller> on uhci0
uhci1: <Intel 82801I (ICH9) USB controller> port 0x1840-0x185f irq 21 at device 26.1 on pci0
uhci1: [ITHREAD]
usbus1: <Intel 82801I (ICH9) USB controller> on uhci1
ehci0: <Intel 82801I (ICH9) USB 2.0 controller> mem 0xf0805800-0xf0805bff irq 20 at device 26.7 on pci0
ehci0: [ITHREAD]
usbus2: EHCI version 1.0
usbus2: <Intel 82801I (ICH9) USB 2.0 controller> on ehci0
hdac0: <Intel 82801I High Definition Audio Controller> mem 0xf0800000-0xf0803fff irq 22 at device 27.0 on pci0
hdac0: HDA Driver Revision: 20100226_0142
hdac0: [ITHREAD]
pcib1: <ACPI PCI-PCI bridge> irq 17 at device 28.0 on pci0
pci2: <ACPI PCI bus> on pcib1
re0: <RealTek 8168/8111 B/C/CP/D/DP/E PCIe Gigabit Ethernet> port 0x2000-0x20ff mem 0xf0904000-0xf0904fff,0xf0900000-0xf0903fff irq 16 at device 0.0 on pci2
re0: Using 1 MSI messages
re0: Chip rev. 0x28000000
re0: MAC rev. 0x00000000
miibus0: <MII bus> on re0
rgephy0: <RTL8169S/8110S/8211B media interface> PHY 1 on miibus0
rgephy0:  10baseT, 10baseT-FDX, 10baseT-FDX-flow, 100baseTX, 100baseTX-FDX, 100baseTX-FDX-flow, 1000baseT, 1000baseT-master, 1000baseT-FDX, 1000baseT-FDX-master, 1000baseT-FDX-flow, 1000baseT-FDX-flow-master, auto, auto-flow
re0: Ethernet address: 70:5a:b6:54:09:cb
re0: [FILTER]
pcib2: <ACPI PCI-PCI bridge> irq 16 at device 28.1 on pci0
pci3: <ACPI PCI bus> on pcib2
pci3: <network> at device 0.0 (no driver attached)
uhci2: <Intel 82801I (ICH9) USB controller> port 0x1860-0x187f irq 23 at device 29.0 on pci0
uhci2: [ITHREAD]
usbus3: <Intel 82801I (ICH9) USB controller> on uhci2
uhci3: <Intel 82801I (ICH9) USB controller> port 0x1880-0x189f irq 19 at device 29.1 on pci0
uhci3: [ITHREAD]
usbus4: <Intel 82801I (ICH9) USB controller> on uhci3
uhci4: <Intel 82801I (ICH9) USB controller> port 0x18a0-0x18bf irq 18 at device 29.2 on pci0
uhci4: [ITHREAD]
usbus5: <Intel 82801I (ICH9) USB controller> on uhci4
ehci1: <Intel 82801I (ICH9) USB 2.0 controller> mem 0xf0805c00-0xf0805fff irq 23 at device 29.7 on pci0
ehci1: [ITHREAD]
usbus6: EHCI version 1.0
usbus6: <Intel 82801I (ICH9) USB 2.0 controller> on ehci1
pcib3: <ACPI PCI-PCI bridge> at device 30.0 on pci0
pci4: <ACPI PCI bus> on pcib3
isab0: <PCI-ISA bridge> at device 31.0 on pci0
isa0: <ISA bus> on isab0
atapci0: <Intel AHCI controller> port 0x1818-0x181f,0x180c-0x180f,0x1810-0x1817,0x1808-0x180b,0x18c0-0x18df mem 0xf0805000-0xf08057ff irq 19 at device 31.2 on pci0
atapci0: [ITHREAD]
atapci0: AHCI v1.20 controller with 4 3Gbps ports, PM not supported
ata2: <ATA channel 0> on atapci0
ata2: [ITHREAD]
ata3: <ATA channel 1> on atapci0
ata3: [ITHREAD]
ata4: <ATA channel 4> on atapci0
ata4: [ITHREAD]
pci0: <serial bus, SMBus> at device 31.3 (no driver attached)
pci0: <dasp> at device 31.6 (no driver attached)
acpi_tz0: <Thermal Zone> on acpi0
atrtc0: <AT realtime clock> port 0x70-0x77 irq 8 on acpi0
atrtc0: Warning: Couldn't map I/O.
battery0: <ACPI Control Method Battery> on acpi0
acpi_acad0: <AC Adapter> on acpi0
atkbdc0: <Keyboard controller (i8042)> port 0x60,0x64 irq 1 on acpi0
atkbd0: <AT Keyboard> irq 1 on atkbdc0
kbd0 at atkbd0
atkbd0: [GIANT-LOCKED]
atkbd0: [ITHREAD]
psm0: <PS/2 Mouse> irq 12 on atkbdc0
psm0: [GIANT-LOCKED]
psm0: [ITHREAD]
psm0: model IntelliMouse, device ID 3
orm0: <ISA Option ROMs> at iomem 0xd0000-0xd0fff,0xdc000-0xdffff,0xe0000-0xe17ff on isa0
sc0: <System console> at flags 0x100 on isa0
sc0: VGA <16 virtual consoles, flags=0x300>
vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0
ppc0: cannot reserve I/O port range
est0: <Enhanced SpeedStep Frequency Control> on cpu0
p4tcc0: <CPU Frequency Thermal Control> on cpu0
est1: <Enhanced SpeedStep Frequency Control> on cpu1
p4tcc1: <CPU Frequency Thermal Control> on cpu1
Timecounters tick every 1.000 msec
usbus0: 12Mbps Full Speed USB v1.0
usbus1: 12Mbps Full Speed USB v1.0
usbus2: 480Mbps High Speed USB v2.0
usbus3: 12Mbps Full Speed USB v1.0
usbus4: 12Mbps Full Speed USB v1.0
usbus5: 12Mbps Full Speed USB v1.0
usbus6: 480Mbps High Speed USB v2.0
ad4: 238475MB <Seagate ST9250315AS 0010LVM1> at ata2-master UDMA100 SATA 1.5Gb/s
ugen0.1: <Intel> at usbus0
uhub0: <Intel UHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus0
ugen1.1: <Intel> at usbus1
uhub1: <Intel UHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus1
ugen2.1: <Intel> at usbus2
uhub2: <Intel EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus2
ugen3.1: <Intel> at usbus3
uhub3: <Intel UHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus3
ugen4.1: <Intel> at usbus4
uhub4: <Intel UHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus4
ugen5.1: <Intel> at usbus5
uhub5: <Intel UHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus5
ugen6.1: <Intel> at usbus6
uhub6: <Intel EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus6
hdac0: HDA Codec #0: Realtek ALC272
hdac0: HDA Codec #2: Intel G45 HDMI
pcm0: <HDA Realtek ALC272 PCM #0 Analog> at cad 0 nid 1 on hdac0
pcm1: <HDA Intel G45 HDMI PCM #0 HDMI> at cad 2 nid 1 on hdac0
SMP: AP CPU #1 Launched!
GEOM: ad4: partition 4 does not start on a track boundary.
GEOM: ad4: partition 4 does not end on a track boundary.
uhub0: 2 ports with 2 removable, self powered
uhub1: 2 ports with 2 removable, self powered
uhub3: 2 ports with 2 removable, self powered
uhub4: 2 ports with 2 removable, self powered
uhub5: 2 ports with 2 removable, self powered
Root mount waiting for: usbus6 usbus2
Root mount waiting for: usbus6 usbus2
uhub2: 4 ports with 4 removable, self powered
Root mount waiting for: usbus6 usbus2
uhub6: 6 ports with 6 removable, self powered
ugen2.2: <Sonix Technology Co., Ltd.> at usbus2
Root mount waiting for: usbus6 usbus2
ugen6.2: <vendor 0x05e3> at usbus6
uhub7: <vendor 0x05e3 USB2.0 Hub, class 9/0, rev 2.00/77.60, addr 2> on usbus6
ugen0.2: <TouchStrip> at usbus0
uhub7: 4 ports with 4 removable, self powered
ugen2.3: <vendor 0x05e3> at usbus2
uhub8: <vendor 0x05e3 USB2.0 Hub, class 9/0, rev 2.00/77.60, addr 3> on usbus2
Root mount waiting for: usbus6 usbus2
ugen6.3: <vendor 0x05af> at usbus6
ukbd0: <vendor 0x05af USB Keyboard, class 0/0, rev 1.10/1.01, addr 3> on usbus6
kbd2 at ukbd0
uhub8: 4 ports with 4 removable, self powered
uhid0: <vendor 0x05af USB Keyboard, class 0/0, rev 1.10/1.01, addr 3> on usbus6
Root mount waiting for: usbus6 usbus2
ugen2.4: <Formac Elektronik GmbH> at usbus2
umass0: <Interface0> on usbus2
umass0:  SCSI over Bulk-Only; quirks = 0x0000
ugen6.4: <Logitech> at usbus6
ums0: <Logitech USB-PS/2 Optical Mouse, class 0/0, rev 2.00/27.20, addr 4> on usbus6
ums0: 8 buttons and [XYZT] coordinates ID=0
umass0:1:0:-1: Attached to scbus1
Trying to mount root from ufs:/dev/ad4s4a
da0 at umass-sim0 bus 0 scbus1 target 0 lun 0
da0: <Ext Hard Disk > Fixed Direct Access SCSI-4 device 
da0: 40.000MB/s transfers
da0: 1430799MB (2930277168 512 byte sectors: 255H 63S/T 182401C)
ugen3.2: <Broadcom Corp> at usbus3
ipfw2 (+ipv6) initialized, divert loadable, nat loadable, rule-based forwarding disabled, default to deny, logging disabled
re0: link state changed to UP
re0: promiscuous mode enabled
re0: promiscuous mode disabled
re0: promiscuous mode enabled
drm0: <Mobile Intel\M-B\M-. GM45 Express Chipset> on vgapci0
info: [drm] MSI enabled 1 message(s)
vgapci0: child drm0 requested pci_enable_busmaster
info: [drm] AGP at 0xd0000000 256MB
info: [drm] Initialized i915 1.6.0 20080730
drm0: [ITHREAD]

How-To-Repeat: Simply by writing to the HDD or trying to create a directory.
Comment 1 Hans Petter Selasky 2011-02-17 07:48:44 UTC
Hi,

There has not been any significant changes in the USB area. I suspect that the 
failure is due to changes in other layers like CAM/SCSI/GEOM.

--HPS
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2011-02-28 04:07:34 UTC
Responsible Changed
From-To: freebsd-usb->freebsd-fs

hselasky thinks this is unrelated to usb.
Comment 3 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:00:43 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 4 Tomi Tapper 2024-02-19 07:55:06 UTC
Created attachment 248592 [details]
Proposed fix
Comment 5 Tomi Tapper 2024-02-19 07:56:20 UTC
This is caused by integer overflow in msdosfs_mkdir where the block number for the new directory is stored as int which overflows at 1 TiB.
Comment 6 Mark Johnston freebsd_committer freebsd_triage 2024-02-21 01:31:36 UTC
(In reply to wenej27156 from comment #5)
Good find!  How would you like to be credited in the commit?