Bug 14868

Summary: flood of "don't try to register things with the same name in the same directory." on upgrade to 2.6.32
Product: File System Reporter: Rich Ercolani (rercola)
Component: NFSAssignee: Trond Myklebust (trondmy)
Status: CLOSED CODE_FIX    
Severity: normal CC: florian, randy.dunlap, rjw
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.32 Subsystem:
Regression: Yes Bisected commit-id:
Bug Depends on:    
Bug Blocks: 14230    
Attachments: dmesg from relevant system
2.6.31 .config
2.6.32 .config
NFS: Fix a umount race

Description Rich Ercolani 2009-12-24 02:44:28 UTC
Was running 2.6.31 vanilla on Fedora 10, upgraded to vanilla 2.6.32, dmesg started getting flooded with messages of the form [see attachment 1 [details]]:
------------[ cut here ]------------
WARNING: at fs/sysfs/dir.c:491 sysfs_add_one+0x100/0x117()
Hardware name:
sysfs: cannot create duplicate filename '/devices/virtual/bdi/0:32'
Modules linked in: autofs4 coretemp hwmon nfs lockd nfs_acl auth_rpcgss sunrpc cachefiles fscache ipv6 cpufreq_ondemand acpi_cpufreq freq_table kvm_intel kvm snd_hda_intel snd_hda_codec snd_seq_dummy snd_seq_oss snd_usb_audio snd_seq_midi_event snd_seq snd_usb_lib uvcvideo ppdev firewire_ohci firewire_core snd_pcm_oss snd_mixer_oss crc_itu_t pcspkr snd_rawmidi videodev v4l1_compat v4l2_compat_ioctl32 i2c_i801 snd_pcm i2c_core snd_seq_device usb_storage iTCO_wdt iTCO_vendor_support snd_hwdep snd_timer parport_pc snd parport e1000e i82975x_edac edac_core soundcore snd_page_alloc raid1 [last unloaded: scsi_wait_scan]
Pid: 20581, comm: mount.nfs Tainted: G        W  2.6.32-fun #1
...
---[ end trace b4d582dc9db911d1 ]---
kobject_add_internal failed for 0:32 with -EEXIST, don't try to register things with the same name in the same directory.
Pid: 20581, comm: mount.nfs Tainted: G        W  2.6.32-fun #1
...

The system is indeed using autofs, so I'd blame NFS-mounts  from FreeBSD for this, but it wasn't cropping up in 2.6.31.

I've also attached the .config for the 2.6.31 and 2.6.32 kernels, in case it's something stupid I missed.
Comment 1 Rich Ercolani 2009-12-24 02:45:35 UTC
Created attachment 24278 [details]
dmesg from relevant system

dmesg > floodlog.txt
Comment 2 Rich Ercolani 2009-12-24 02:45:53 UTC
Created attachment 24279 [details]
2.6.31 .config
Comment 3 Rich Ercolani 2009-12-24 02:46:06 UTC
Created attachment 24280 [details]
2.6.32 .config
Comment 4 Trond Myklebust 2009-12-31 01:22:47 UTC
On Thu, 2009-12-24 at 02:44 +0000, bugzilla-daemon@bugzilla.kernel.org
wrote: 
> http://bugzilla.kernel.org/show_bug.cgi?id=14868
> 
>            Summary: flood of "don't try to register things with the same
>                     name in the same directory." on upgrade to 2.6.32
>            Product: File System
>            Version: 2.5
>     Kernel Version: 2.6.32
>           Platform: All
>         OS/Version: Linux
>               Tree: Mainline
>             Status: NEW
>           Severity: normal
>           Priority: P1
>          Component: NFS
>         AssignedTo: trond.myklebust@fys.uio.no
>         ReportedBy: rercola@acm.jhu.edu
>         Regression: No
> 
> 
> Was running 2.6.31 vanilla on Fedora 10, upgraded to vanilla 2.6.32, dmesg
> started getting flooded with messages of the form [see attachment 1 [details]]:
> ------------[ cut here ]------------
> WARNING: at fs/sysfs/dir.c:491 sysfs_add_one+0x100/0x117()
> Hardware name:
> sysfs: cannot create duplicate filename '/devices/virtual/bdi/0:32'
> Modules linked in: autofs4 coretemp hwmon nfs lockd nfs_acl auth_rpcgss
> sunrpc
> cachefiles fscache ipv6 cpufreq_ondemand acpi_cpufreq freq_table kvm_intel
> kvm
> snd_hda_intel snd_hda_codec snd_seq_dummy snd_seq_oss snd_usb_audio
> snd_seq_midi_event snd_seq snd_usb_lib uvcvideo ppdev firewire_ohci
> firewire_core snd_pcm_oss snd_mixer_oss crc_itu_t pcspkr snd_rawmidi videodev
> v4l1_compat v4l2_compat_ioctl32 i2c_i801 snd_pcm i2c_core snd_seq_device
> usb_storage iTCO_wdt iTCO_vendor_support snd_hwdep snd_timer parport_pc snd
> parport e1000e i82975x_edac edac_core soundcore snd_page_alloc raid1 [last
> unloaded: scsi_wait_scan]
> Pid: 20581, comm: mount.nfs Tainted: G        W  2.6.32-fun #1
> ...
> ---[ end trace b4d582dc9db911d1 ]---
> kobject_add_internal failed for 0:32 with -EEXIST, don't try to register
> things
> with the same name in the same directory.
> Pid: 20581, comm: mount.nfs Tainted: G        W  2.6.32-fun #1
> ...
> 
> The system is indeed using autofs, so I'd blame NFS-mounts  from FreeBSD for
> this, but it wasn't cropping up in 2.6.31.

It appears to be due to the per-bdi thread changes in 2.6.32. The
support for anonymous devices has a problem in that sysfs and debugfs
directories and files can be kept open by other processes even after the
device number gets deallocated.

> I've also attached the .config for the 2.6.31 and 2.6.32 kernels, in case
> it's
> something stupid I missed.


Are you perhaps running some daemon or process that is
accessing /sys/devices/virtual/bdi/0:32 and keeping it open beyond the
lifetime of the NFS mount?

Trond
Comment 5 Rich Ercolani 2009-12-31 01:26:45 UTC
I, the system administrator, am not running anything that is persisting in that way that I know of.

I don't, at present, see any processes still living that are touching anything in /sys/devices/virtual; are there any obvious processes that I can check for, or any convenient way to monitor this? Would inotify do the right thing?
Comment 6 Trond Myklebust 2010-02-03 20:39:29 UTC
Created attachment 24901 [details]
NFS: Fix a umount race

Ensure that we unregister the bdi before kill_anon_super() calls
ida_remove() on our device name.
Comment 7 Trond Myklebust 2010-02-03 20:40:16 UTC
Does the above patch suffice to fix the bug?
Comment 8 Florian Mickler 2010-10-03 16:08:19 UTC
Ping?
Comment 9 Florian Mickler 2010-10-03 16:15:05 UTC
The above patch was merged for 2.6.33 and backported to 2.6.32.y.
Comment 10 Florian Mickler 2010-10-26 09:24:58 UTC
commit: 387c149b54b4321cbc790dadbd4f8eedb5a90468