Kernel crashes (hangs system) upon physical removal of mounted ext3/4 drives

Bug #734139 reported by Rocko
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Linux
Fix Released
Medium
linux (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

For me, kernels after 2.6.35 have a problem where removing one or more ext3 or ext4 drives occasionally hangs the system. Initially I thought the problem was introduced in 2.6.37 but I have also reproduced this in 2.6.36.

The test cases most likely to reproduce this seem to be:

1. Suspend with drives mounted via a USB hub, then remove the USB hub cable, and resume.

2. Running Ubuntu in VirtualBox, remove and replace an external USB drive using the USB menu on the status bar (ie near the bottom right), leaving enough time for Ubuntu to mount the drive before removing it (and of course not unmounting the drive first).

3. Remove and insert (multiple times) an SD card formatted with an ext4 file system.

It seems that the crash is more likely to occur if there are multiple drives attached (I typically have 4-5 drives attached via a 7-in-1 USB hub).

Initially I found this bug in Maverick using either Ubuntu mainline or kernels I built myself, but I have now reproduced the hang in Natty with the second test case (ie with Natty running in a VM).

Getting a syslog is problematic because the hang is serious enough to stop all I/O, so nothing is written to the official /var/log/syslog file. The only way I have got a log is to suspend from a tty console with:

echo 8 > /proc/sys/kernel/printk
/etc/acpi/sleep.sh force

and to take a photo of the resulting log that appears. Often the log is incomplete.

I have seen this happen on a second PC, and have run RAM tests on my main PC to try and rule out hardware issues.

In my testing I haven't ever managed to reproduce the crash if I unmount the USB drives before removing them.

I have reported upstream at: https://bugzilla.kernel.org/show_bug.cgi?id=25832 and what logs I have managed to capture are attached there. It seems that the crash occurs due to an unhandled page fault in an interrupt.

Comment https://bugzilla.kernel.org/show_bug.cgi?id=25832#c30 shows a means of simulating a USB removal without physically removing the drive, which provides a third test case.

ProblemType: Bug
DistroRelease: Ubuntu 11.04
Package: linux-image (not installed)
Regression: Yes
Reproducible: Yes
ProcVersionSignature: Ubuntu 2.6.38-6.34-generic 2.6.38-rc7
Uname: Linux 2.6.38-6-generic i686
AlsaVersion: Advanced Linux Sound Architecture Driver Version 1.0.23.
AplayDevices:
 **** List of PLAYBACK Hardware Devices ****
 card 0: I82801AAICH [Intel 82801AA-ICH], device 0: Intel ICH [Intel 82801AA-ICH]
   Subdevices: 1/1
   Subdevice #0: subdevice #0
Architecture: i386
AudioDevicesInUse:
 USER PID ACCESS COMMAND
 /dev/snd/controlC0: rocko 1437 F.... pulseaudio
CRDA: Error: [Errno 2] No such file or directory
Card0.Amixer.info:
 Card hw:0 'I82801AAICH'/'Intel 82801AA-ICH with STAC9700,83,84 at irq 5'
   Mixer name : 'SigmaTel STAC9700,83,84'
   Components : 'AC97a:83847600'
   Controls : 34
   Simple ctrls : 24
Date: Sun Mar 13 11:37:57 2011
HibernationDevice: RESUME=UUID=5c2c0283-459c-4809-a8d1-5e0bb43f21f8
InstallationMedia: Ubuntu 10.10 "Maverick Meerkat" - Alpha i386 (20100602.2)
IwConfig:
 lo no wireless extensions.

 eth3 no wireless extensions.
Lsusb:
 Bus 002 Device 002: ID 80ee:0021
 Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
 Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
MachineType: innotek GmbH VirtualBox
ProcEnviron:
 LANGUAGE=en_AU:en
 LANG=en_AU.UTF-8
 SHELL=/bin/bash
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-2.6.38-6-generic root=UUID=c7586c69-5914-406e-ab3d-a671796fed2d ro quiet splash vt.handoff=7
RelatedPackageVersions:
 linux-restricted-modules-2.6.38-6-generic N/A
 linux-backports-modules-2.6.38-6-generic N/A
 linux-firmware 1.48
RfKill:

SourcePackage: linux
UpgradeStatus: Upgraded to natty on 2011-03-09 (3 days ago)
dmi.bios.date: 12/01/2006
dmi.bios.vendor: innotek GmbH
dmi.bios.version: VirtualBox
dmi.modalias: dmi:bvninnotekGmbH:bvrVirtualBox:bd12/01/2006:svninnotekGmbH:pnVirtualBox:pvr1.2:
dmi.product.name: VirtualBox
dmi.product.version: 1.2
dmi.sys.vendor: innotek GmbH

Revision history for this message
Rocko (rockorequin) wrote :
Rocko (rockorequin)
summary: - Kernel crashes (hangs system) upon physical removal of mounted USB drive
+ Kernel crashes (hangs system) upon physical removal of mounted ext3/4
+ drives
description: updated
Brad Figg (brad-figg)
Changed in linux (Ubuntu):
status: New → Confirmed
Revision history for this message
Rocko (rockorequin) wrote :

Following on from the bugzilla report, the attached patch (against the 3.1 kernel, but at the very least the the patch to fs/ext4/super.c works against 3.0.4) fixes the problems for ext4 drives.

Revision history for this message
Rocko (rockorequin) wrote :

And this is the equivalent patch for kernel 3.0.4.

penalvch (penalvch)
tags: added: patch
Changed in linux (Ubuntu):
importance: Undecided → Medium
Changed in linux:
importance: Unknown → Medium
status: Unknown → Confirmed
Revision history for this message
Brad Figg (brad-figg) wrote :

@Rocko,

This bug was fixed in Oneiric 3.0.0-13.21.

Changed in linux (Ubuntu):
status: Confirmed → Fix Released
Changed in linux:
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.