kernel warns BUG: at fs/inotify.c:172 set_dentry_child_flags()

Bug #104837 reported by Rich on 2007-04-09
30
Affects Status Importance Assigned to Milestone
Linux
Fix Released
High
Ubuntu
Undecided
Unassigned
Hardy
Undecided
Unassigned
linux (Ubuntu)
Medium
Tim Gardner
Hardy
Undecided
Unassigned
linux-source-2.6.20 (Ubuntu)
Medium
Unassigned
Hardy
Undecided
Unassigned

Bug Description

I was looking in dmesg for some other output (I thought my wireless card had stopped responding), and I noticed these gems.

[148978.156000] BUG: at fs/inotify.c:172 set_dentry_child_flags()
[148978.156000] [<c019fccf>] set_dentry_child_flags+0xcf/0x160
[148978.156000] [<c019fdb3>] remove_watch_no_event+0x53/0x60
[148978.156000] [<c019fed8>] inotify_remove_watch_locked+0x18/0x50
[148978.156000] [<c0176e91>] vfs_read+0x121/0x190
[148978.156000] [<c01a020c>] inotify_rm_wd+0x6c/0xb0
[148978.156000] [<c01a07a8>] sys_inotify_rm_watch+0x38/0x60
[148978.156000] [<c01031f0>] sysenter_past_esp+0x69/0xa9
[148978.156000] =======================
[148978.156000] BUG: at fs/inotify.c:172 set_dentry_child_flags()
[148978.156000] [<c019fccf>] set_dentry_child_flags+0xcf/0x160
[148978.156000] [<c01a0426>] inotify_add_watch+0xf6/0x100
[148978.156000] [<c01a0f41>] sys_inotify_add_watch+0x141/0x160
[148978.156000] [<c01a0175>] put_inotify_watch+0x35/0x60
[148978.156000] [<c01a0221>] inotify_rm_wd+0x81/0xb0
[148978.156000] [<c01031f0>] sysenter_past_esp+0x69/0xa9
[148978.156000] =======================

I haven't noticed any filesystem corruption.

Brian Murray (brian-murray) wrote :

Thanks for taking the time to report this bug and helping to make Ubuntu better. Unfortunately we can't fix it, because your description doesn't yet have enough information.
Please include the following additional information, if you have not already done so (please pay attention to lspci's additional options), as required by the Ubuntu Kernel Team:
1. Please include the output of the command 'uname -a' in your next response. It should be one, long line of text which includes the exact kernel version you're running, as well as the CPU architecture.
2. Please run the command 'dmesg > dmesg.log' and attach the resulting file 'dmesg.log' to this bug report.
3. Please run the command 'sudo lspci -vvnn > lspci-vvnn.log' and attach the resulting file 'lspci-vvnn.log' to this bug report.
For your reference, the full description of procedures for kernel-related bug reports is available at https://wiki.ubuntu.com/KernelTeamBugPolicies . Thanks in advance!

Rich (rincebrain) wrote :

I haven't seen this reproduced in the time since, incidentally, so I haven't updated this report.

On April 9th, I was running the 2.6.20-14-generic kernel. I've attached a complete dmesg log from today, but I'm uncertain how helpful that will prove, since I haven't reproduced the bug on this kernel (2.6.20-15-generic).

I'm also going to attach the lspci output shortly.

Rich (rincebrain) wrote :
Brian Murray (brian-murray) wrote :

This bug report is being closed due to your last comment regarding this being fixed with the new kernel version. Thanks again for taking the time to report this bug and helping to make Ubuntu better. Feel free to submit any future bugs you may find.

Changed in linux-source-2.6.20:
status: Needs Info → Fix Released

I would like to reopen this bug. I am running kernel 2.6.20-15 and still see this behavior. The dmesg output is attached; lspci will follow shortly.

Changed in linux-source-2.6.20:
assignee: brian-murray → ubuntu-kernel-team
importance: Undecided → Medium
status: Fix Released → Confirmed
StephanBeal (sgbeal) wrote :

This bug still happens, but is not "reproducible" in the classic sense. It happens at some level lower than a non-kernel-hacker can see.
Yesterday i got the error 238 times in my /var/log/messages (attached)

uname -a
Linux owl 2.6.20-16-generic #2 SMP Thu Jun 7 20:19:32 UTC 2007 i686 GNU/Linux

lspci output will be attached.

StephanBeal (sgbeal) wrote :

lspci output is attached, as promised in the last comment...

Peter Funk (pf-artcom-gmbh) wrote :

I had the following today on a customer machine in Barcelona, Spain:

kernel: [1821218.318611] BUG: at fs/inotify.c:172 set_dentry_child_flags()
kernel: [1821218.318616]
kernel: [1821218.318617] Call Trace:
kernel: [1821218.318640] [set_dentry_child_flags+151/368] set_dentry_child_flags+0x97/0x170
kernel: [1821218.318646] [remove_watch_no_event+103/128] remove_watch_no_event+0x67/0x80
kernel: [1821218.318650] [inotify_remove_watch_locked+31/80] inotify_remove_watch_locked+0x1f/0x50
kernel: [1821218.318654] [inotify_rm_wd+150/208] inotify_rm_wd+0x96/0xd0
kernel: [1821218.318658] [sys_inotify_rm_watch+79/128] sys_inotify_rm_watch+0x4f/0x80
kernel: [1821218.318665] [system_call+126/131] system_call+0x7e/0x83

System is 2.6.20-15-server #2 SMP Sun Apr 15 06:22:36 UTC 2007 x86_64 GNU/Linux

Root filesystem is a default ext3, but there is also a software RAID5 on /dev/md0
(2.3 Terabyte formatted with SGI XFS) attached. Don't know if this matters.

Regards, Peter
--
Peter Funk, Oldenburger Str.86, D-27777 Ganderkesee, Germany; office:
ArtCom GmbH, Lise-Meitner-Str. 5, D-28359 Bremen, Germany, tel: +49-421-20419-0

Luka Renko (lure) wrote :

I get very similar error on Hardy with 2.6.24-4 kernel when running kde4:

[29030.741624] WARNING: at /build/buildd/linux-2.6.24/fs/inotify.c:172 set_dentry_child_flags()
[29030.741638] Pid: 5928, comm: kded4 Not tainted 2.6.24-3-generic #1
[29030.741664] [<c01b204f>] set_dentry_child_flags+0xcf/0x160
[29030.741693] [<c01b2130>] remove_watch_no_event+0x50/0x60
[29030.741707] [<c01b2248>] inotify_remove_watch_locked+0x18/0x50
[29030.741720] [<c018860e>] vfs_write+0x11e/0x140
[29030.741733] [<c01b25ac>] inotify_rm_wd+0x6c/0xb0
[29030.741750] [<c01b2bc8>] sys_inotify_rm_watch+0x38/0x60
[29030.741764] [<c01053a2>] sysenter_past_esp+0x6b/0xa9
[29030.741786] [<c0300000>] km_new_mapping+0x10/0x70
[29030.741806] =======================
[29030.741939] WARNING: at /build/buildd/linux-2.6.24/fs/inotify.c:172 set_dentry_child_flags()
[29030.741946] Pid: 5928, comm: kded4 Not tainted 2.6.24-3-generic #1
[29030.741966] [<c01b204f>] set_dentry_child_flags+0xcf/0x160
[29030.741989] [<c01b28c2>] inotify_add_watch+0xe2/0xf0
[29030.742008] [<c01b3333>] sys_inotify_add_watch+0x153/0x180
[29030.742027] [<c01b2515>] put_inotify_watch+0x35/0x60
[29030.742046] [<c01b2515>] put_inotify_watch+0x35/0x60
[29030.742058] [<c01b25c1>] inotify_rm_wd+0x81/0xb0
[29030.742078] [<c01053a2>] sysenter_past_esp+0x6b/0xa9
[29030.742099] [<c0300000>] km_new_mapping+0x10/0x70
[29030.742117] =======================

Is it possible that this is user-space problem (like kde4 calling system call with wrong options)?

Luka Renko (lure) wrote :
Luka Renko (lure) wrote :
Luka Renko (lure) wrote :

This should be linked as upstream bug, but I cannot add it properly as bug tracke: :-(

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

Just adding a note that starting with the Hardy kernel the source package is now just 'linux' not 'linux-source-2.6.24'. I've opened a new 'linux' task and have re-assigned to the kernel team. I also added the upstream watch. Thanks!

Changed in linux:
assignee: nobody → ubuntu-kernel-team
importance: Undecided → Medium
status: New → Triaged
Changed in linux:
status: Unknown → Confirmed
Changed in linux-source-2.6.24:
status: New → Invalid
Changed in linux:
status: Confirmed → Fix Released
Rich (rincebrain) wrote :

This is fixed in 2.6.25, has anyone backported the fix, or is it just "Fix released" because the upstream kernel has a fix?

Gnuton (antonio-aloisio) wrote :

I'm using kubuntu-kde4 hardy heron and i've some error like this:
[ 192.827941] WARNING: at /build/buildd/linux-2.6.24/fs/inotify.c:172 set_dentry_child_flags()
[ 192.827957] Pid: 5706, comm: plasma Not tainted 2.6.24-16-generic #1
[ 192.828001] [<c01b76af>] set_dentry_child_flags+0xcf/0x160
[ 192.828028] [<c01b7790>] remove_watch_no_event+0x50/0x60
[ 192.828038] [<c01b78a8>] inotify_remove_watch_locked+0x18/0x50
[ 192.828046] [<c018d9bc>] vfs_read+0x11c/0x170
[ 192.828056] [<c01b7c0c>] inotify_rm_wd+0x6c/0xb0
[ 192.828067] [<c01b8228>] sys_inotify_rm_watch+0x38/0x60
[ 192.828077] [<c01043c2>] sysenter_past_esp+0x6b/0xa9
[ 192.828103] =======================
[ 192.828146] WARNING: at /build/buildd/linux-2.6.24/fs/inotify.c:172 set_dentry_child_flags()
[ 192.828152] Pid: 5706, comm: plasma Not tainted 2.6.24-16-generic #1
[ 192.828158] [<c01b76af>] set_dentry_child_flags+0xcf/0x160
[ 192.828175] [<c01b7f22>] inotify_add_watch+0xe2/0xf0
[ 192.828189] [<c01b89a3>] sys_inotify_add_watch+0x153/0x180
[ 192.828203] [<c01b7b75>] put_inotify_watch+0x35/0x60
[ 192.828218] [<c01b7b75>] put_inotify_watch+0x35/0x60
[ 192.828282] [<c01b7c21>] inotify_rm_wd+0x81/0xb0
[ 192.828299] [<c01043c2>] sysenter_past_esp+0x6b/0xa9
[ 192.828324] =======================

Some time my system freeze also.

Hi Rich,

It doesn't look like the patches have been backported to Hardy (I'll include the upstream git commit id's below). However, they do appear to be available in the upcoming Intrepid kernel. Care to maybe give the Intrepid kernel a test? It was most recently rebased with the upstream 2.6.25 kernel and is currently available in the following PPA:

https://edge.launchpad.net/~kernel-ppa/+archive

If you are not familiar with how to install packages from a PPA basically do the following . . .

Create the file /etc/apt/sources.list.d/kernel-ppa.list to include the following two lines:

deb http://ppa.launchpad.net/kernel-ppa/ubuntu hardy main
deb-src http://ppa.launchpad.net/kernel-ppa/ubuntu hardy main

Then run the command: sudo apt-get update

You should then be able to install the linux-image-2.6.25 kernel package. After you've finished testing you can remove the kernel-ppa.list file and run 'sudo apt-get update' once more. Please let us know your results.

And just for reference, the git commit id's and descriptions are as follows:

commit d599e36a9ea85432587f4550acc113cd7549d12a

Author: Nick Piggin <email address hidden>

Date: Wed Feb 6 01:37:28 2008 -0800

    inotify: fix race

    There is a race between setting an inode's children's "parent watched" flag

    when placing the first watch on a parent, and instantiating new children of

    that parent: a child could miss having its flags set by

    set_dentry_child_flags, but then inotify_d_instantiate might still see

    !inotify_inode_watched.

    The solution is to set_dentry_child_flags after adding the watch. Locking i

    taken care of, because both set_dentry_child_flags and inotify_d_instantiate

    hold dcache_lock and child->d_locks.

commit 0d71bd5993b630a989d15adc2562a9ffe41cd26d

Author: Nick Piggin <email address hidden>

Date: Wed Feb 6 01:37:29 2008 -0800

    inotify: remove debug code

    The inotify debugging code is supposed to verify that the

    DCACHE_INOTIFY_PARENT_WATCHED scalability optimisation does not result in

    notifications getting lost nor extra needless locking generated.

    Unfortunately there are also some races in the debugging code. And it isn't

    very good at finding problems anyway. So remove it for now.

Rich (rincebrain) wrote :

Unfortunately, I haven't been able to trigger this bug in a long time. I don't know that I'll be able to test this.

Tim Gardner (timg-tpi) wrote :

This bug is not eligible for a Hardy SRU update until there is a test that can trigger this race often enough to decide that a patch actually fixes it.

Changed in linux:
status: Triaged → Won't Fix
Geoff123 (gsking1) wrote :

I just experienced this also. dmesg and lspci outputs are attached.

Linux blaster 2.6.24-19-rt #1 SMP PREEMPT RT Wed Jun 4 18:50:11 UTC 2008 i686 GNU/Linux

Geoff123 (gsking1) wrote :

lspci output attached

Tim Gardner (timg-tpi) wrote :

SRU Justification

Impact: There is a race between setting an inode's children's "parent watched" flag when placing the first watch on a parent, and instantiating new children of that parent: a child could miss having its flags set by set_dentry_child_flags, but then inotify_d_instantiate might still see !inotify_inode_watched.

Patch Description: The solution is to set_dentry_child_flags after adding the watch. Locking is taken care of, because both set_dentry_child_flags and inotify_d_instantiate hold dcache_lock and child->d_locks.

Patches: http://kernel.ubuntu.com/git?p=ubuntu/ubuntu-hardy.git;a=commit;h=ab67a74144886e464f5b905558876145e711f17a, http://kernel.ubuntu.com/git?p=ubuntu/ubuntu-hardy.git;a=commit;h=670dcd8597ed0aa7f68d05d384226bdb81b0e956

Test Case: See bug description.

Steve Langasek (vorlon) wrote :

Accepted into -proposed, please test and give feedback here. Please see https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in linux:
status: New → Fix Committed
Changed in linux-source-2.6.20:
status: New → Fix Committed
Martin Pitt (pitti) wrote :

Tentatively closing the Feisty task, I don't see any work going on here.

Changed in linux-source-2.6.20:
status: Fix Committed → Invalid
status: Confirmed → Invalid
Steve Beattie (sbeattie) wrote :

Would it be possible to get a testcase for this bug? Something that could reproduce it even sporadically would be useful. Thanks!

Martin Pitt (pitti) wrote :

linux 2.6.24-21 copied to hardy-updates.

Changed in linux:
status: Fix Committed → Fix Released

The above patches are already in Intrepid. Changing status for Fix Committed to Fix Released.

Changed in linux:
status: Fix Committed → Fix Released

Per a decision made by the Ubuntu Kernel Team, bugs will longer be assigned to the ubuntu-kernel-team in Launchpad as part of the bug triage process. The ubuntu-kernel-team is being unassigned from this bug report. Refer to https://wiki.ubuntu.com/KernelTeamBugPolicies for more information. Thanks.

Changed in linux:
importance: Unknown → High
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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