Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 183207

Summary: kernel BUG at fs/ext3/namei.c:384! invalid opcode: 0000 [#1]
Product: Gentoo Linux Reporter: Dekel Amrani <dekela>
Component: [OLD] Core systemAssignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers <kernel>
Status: VERIFIED NEEDINFO    
Severity: normal CC: duaneg
Priority: High    
Version: unspecified   
Hardware: x86   
OS: Linux   
URL: http://bugzilla.kernel.org/show_bug.cgi?id=6628
Whiteboard: linux-2.6.22.9
Package list:
Runtime testing required: ---
Attachments: ext3-gracefully-handle-corrupt-htree.patch
fuzz_dir_index.c

Description Dekel Amrani 2007-06-26 01:38:18 UTC
From dmesg:
Jun 26 03:42:54 monster [  404.495590] EXT3-fs warning (device sda1): dx_probe: Unrecognised inode hash code 232
Jun 26 03:42:59 monster [  409.251566] EXT3-fs warning (device sda1): dx_probe: Unrecognised inode hash code 68
Jun 26 03:42:59 monster [  409.390031] Assertion failure in dx_probe() at fs/ext3/namei.c:384: "dx_get_limit(entries) == dx_root_limit(dir, root->info.info_length)"
Jun 26 03:42:59 monster [  409.391006] ------------[ cut here ]------------
Jun 26 03:42:59 monster [  409.391010] kernel BUG at fs/ext3/namei.c:384!
Jun 26 03:42:59 monster [  409.391013] invalid opcode: 0000 [#1]
Jun 26 03:42:59 monster [  409.391014] PREEMPT SMP 
Jun 26 03:42:59 monster [  409.391017] Modules linked in: fuse snd_seq snd_pcm_oss snd_mixer_oss vboxdrv it87 hwmon_vid hwmon i2c_isa snd_usb_audio snd_hda_intel snd_hda_codec snd_pcm snd_timer snd_usb_lib snd_rawmidi snd_seq_device snd_hwdep snd snd_page_alloc soundcore nvidia(P)
Jun 26 03:42:59 monster [  409.391039] CPU:    0
Jun 26 03:42:59 monster [  409.391040] EIP:    0060:[<c0192585>]    Tainted: P       VLI
Jun 26 03:42:59 monster [  409.391042] EFLAGS: 00010296   (2.6.21-gentoo-r2 #2)
Jun 26 03:42:59 monster [  409.391047] EIP is at dx_probe+0x175/0x2c9
Jun 26 03:42:59 monster [  409.391050] eax: 00000090   ebx: d9115018   ecx: f4769070   edx: 00000000
Jun 26 03:42:59 monster [  409.391054] esi: d90c0a98   edi: d909f378   ebp: 00000000   esp: f5b9fe54
Jun 26 03:42:59 monster [  409.391057] ds: 007b   es: 007b   fs: 00d8  gs: 0033  ss: 0068
Jun 26 03:42:59 monster [  409.391060] Process updatedb (pid: 8586, ti=f5b9e000 task=f6eb2030 task.ti=f5b9e000)
Jun 26 03:42:59 monster [  409.391063] Stack: c03aad33 c03526dc c03ab3cc 00000180 c03ab51e dfe463c0 f783eb00 d90c0a98 
Jun 26 03:42:59 monster [  409.391071]        fffffff2 00000000 f64cb900 f40aa600 d90c0a98 00000000 c0193713 f5b9fea8 
Jun 26 03:42:59 monster [  409.391078]        f5b9fed4 f7a9a000 00000000 f40aa600 d90c0a98 00000000 f5b9ff30 c015c850 
Jun 26 03:42:59 monster [  409.391086] Call Trace:
Jun 26 03:42:59 monster [  409.391090]  [<c0193713>] ext3_htree_fill_tree+0x99/0x1ba
Jun 26 03:42:59 monster [  409.391095]  [<c015c850>] generic_permission+0x4c/0xbd
Jun 26 03:42:59 monster [  409.391103]  [<c018cdf0>] ext3_readdir+0x1d1/0x5a5
Jun 26 03:42:59 monster [  409.391107]  [<c01603a9>] filldir+0x0/0xb9
Jun 26 03:42:59 monster [  409.391114]  [<c01596e2>] sys_fstat64+0x1e/0x23
Jun 26 03:42:59 monster [  409.391119]  [<c01604ac>] vfs_readdir+0x4a/0x74
Jun 26 03:42:59 monster [  409.391123]  [<c01603a9>] filldir+0x0/0xb9
Jun 26 03:42:59 monster [  409.391128]  [<c01606ec>] sys_getdents+0x5f/0x9f
Jun 26 03:42:59 monster [  409.391133]  [<c0102658>] sysenter_past_esp+0x5d/0x81
Jun 26 03:42:59 monster [  409.391139]  =======================


Reproducible: Always

Steps to Reproduce:
1.
2.
3.
Dosent appear to have any impact on system stability.


Expected Results:  
no errors

emerge --info
monster dekela # emerge --info
Portage 2.1.3_rc5 (default-linux/x86/2007.0/desktop, gcc-4.1.2, glibc-2.5-r3, 2.6.21-gentoo-r2 i686)
=================================================================
System uname: 2.6.21-gentoo-r2 i686 Intel(R) Core(TM)2 CPU 6400 @ 2.13GHz
Gentoo Base System release 1.12.10
Timestamp of tree: Tue, 26 Jun 2007 01:00:10 +0000
ccache version 2.4 [enabled]
dev-java/java-config: 1.3.7, 2.0.33-r1
dev-lang/python:     2.4.4-r4
dev-python/pycrypto: 2.0.1-r5
dev-util/ccache:     2.4-r7
sys-apps/sandbox:    1.2.18.1
sys-devel/autoconf:  2.13, 2.61
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.17
sys-devel/gcc-config: 1.3.16
sys-devel/libtool:   1.5.24
virtual/os-headers:  2.6.21
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=prescott -pipe -O2 -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb /var/bind"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/gconf /etc/revdep-rebuild /etc/splash /etc/terminfo"
CXXFLAGS="-march=prescott -pipe -O2 -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="ccache distlocks metadata-transfer sandbox sfperms strict unmerge-orphans"
GENTOO_MIRRORS="http://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo/"
LANG="en_US.utf-8"
LC_ALL="en_US.utf-8"
LINGUAS="en he"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/layman/sunrise /usr/local/layman/custom-kernels /usr/local/layman/musicbrainz /usr/local/layman/portato /usr/local/layman/xeffects /usr/local/overlays"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="3dnow 3dnowext 7zip X aac ac3 acl acpi aiglx alsa artworkextra asf audiofile avahi avi bash-completion berkdb bitmap-fonts cairo cdr cli cpufreq cracklib crypt cups dbus divxaac dri dts dvd dvdr dvdread emboss encode esd evo faad ffmpeg firefox fortran freetype fuse galago gdbm gif glitz gnome gstreamer gtk gtk2 gtkhtml hal iconv irc isdnlog jpeg kerberos keyring libg++ libnotify lm_sensors logitech-mouse mad matroska midi mikmod mmx mmxext mp3 mpeg mplayer mudflap ncurses nls nptl nptlonly nsplugin nvidia ogg oggvorbis opengl openmp oss pam pcre pdf perl plugins png pppd python qt3support quicktime rar readline real reflection samba sdl session spell spl sse sse2 ssl startup-notification svg svga symlink tcpd threads thunar-vfs tiff truetype truetype-fonts type1-fonts unicode vorbis win32codecs wma x86 xanim xcomposite xine xml xorg xscreensaver xv xvid zip zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" CAMERAS="konica minolta" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en he" USERLAND="GNU" VIDEO_CARDS="nvidia"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LDFLAGS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

monster dekela #
Comment 1 Mike Pagano gentoo-dev 2007-06-26 11:27:02 UTC
Question: 
Do you dual boot?
Do you use Ext2IFS drivers in windows to access this hard drive?

Trying to determine if this is a similar issue I found on the net.
Comment 2 Daniel Drake (RETIRED) gentoo-dev 2007-06-29 02:41:48 UTC
Was this a one-time error or is it reproducible?
Comment 3 Dekel Amrani 2007-07-01 19:19:06 UTC
(In reply to comment #2)
> Was this a one-time error or is it reproducible?
> 

Reproducible.. After ever boot.

And yes I do use ext driver in windows.
And I dual boot.. Could it be corrupted fs?

Dekel
Oh and by the way its: 2.6.21-r2
Comment 4 Mike Pagano gentoo-dev 2007-07-03 11:32:36 UTC
Here's a similar bug from the Ubuntu folks:

https://bugs.launchpad.net/ubuntu/+source/linux-source-2.6.20/+bug/109177

They reporter points the finger out a corrupt file system, but they do not offer any solution.  

Another (maybe related?) reference from upstream kernel bugzilla, but also with no solution:

http://bugzilla.kernel.org/show_bug.cgi?id=6628



Comment 5 Daniel Drake (RETIRED) gentoo-dev 2007-07-10 13:28:57 UTC
Please post "tune2fs -l /dev/sda1" output
Comment 6 Duane Griffin 2007-07-22 23:12:34 UTC
I think I've managed to fix this. The ext3 code already has provision for falling back to a linear scan if it detects a corrupt directory index, so all that is required is for the dx_probe function to fail and return the appropriate error instead of asserting.

I'll attach the proposed patch, source code for a utility to reproduce the problem, and a recipe for doing so. Please let me know if it stops the BUG for you. Note that you will still see a warning in your log about the corruption. The FS can be fixed by running "/sbin/fsck.ext3 -f" on it.

I'll send this upstream once I have confirmation that it works for someone else.
Comment 7 Duane Griffin 2007-07-22 23:14:36 UTC
Created attachment 125707 [details, diff]
ext3-gracefully-handle-corrupt-htree.patch

Fall back to linear directory scan instead of asserting if a corrupt directory index is found
Comment 8 Duane Griffin 2007-07-22 23:19:40 UTC
Created attachment 125708 [details]
fuzz_dir_index.c

Source code for a utility to corrupt a directory hash. Run it with -c or -e to corrupt the entry count and/or entry limit respectively. Run it with -L1 to corrupt a (randomly selected) indirect index or -L0 (default) to corrupt the directory root.

DO NOT USE THIS ON A FILESYSTEM YOU CARE ABOUT!

Corruption can be corrected by running "/sbin/fsck.ext3 -f <fs>".
Comment 9 Duane Griffin 2007-07-22 23:22:14 UTC
To create a test filesystem do the following:

# Create an empty FS
dd if=/dev/zero of=test-fs.ext3 count=100 bs=1M
/sbin/mkfs.ext3 -F -m0 -b1024 -i1024 -j -Osparse_super,dir_index test-fs.ext3

# Fill a directory with lots of files
mkdir mnt
mount -oloop test-fs.ext3 mnt
mkdir mnt/a
for n in `seq 0 100000` ; do touch mnt/a/file-$n ; done
umount mnt
rmdir mnt

# Ensure it uses hash indexed directories
/sbin/e2fsck -f -v -D test-fs.ext3
Comment 10 Daniel Drake (RETIRED) gentoo-dev 2007-08-05 22:21:57 UTC
Dekel, have you had time to try Duane's patch?
Comment 11 Maarten Bressers (RETIRED) gentoo-dev 2007-09-18 19:21:03 UTC
See comment #10. Please reopen if you have tested the patch.
Comment 12 Duane Griffin 2007-09-19 17:18:09 UTC
FYI: something very similar to the patch here has just been accepted into the -mm tree. It should make its way into mainline soon. Not sure whether it will be going into .23 or .24, though.

The final version of the patch is here:
http://marc.info/?l=linux-kernel&m=118947590719691
Comment 13 Duane Griffin 2007-09-27 11:12:01 UTC
The patch has been added to 2.6.22.9 and 2.6.23.