marook/tagfs

Program hangs when mountpoint and items directory are the same

Opened this issue · 3 comments

I made a directory /tmp/x with subdirectories /tmp/x/a and /tmp/x/b, which in turn contained simple index files. Then I issued a following command:
$ tagfs /tmp/x -i /tmp/x
And it hung. I couldn't terminate it even with killall -9 tagfs. Then I tried to rmmod -f fuse, and it worked. But few minutes later system hung completely.
I didn't investigate problem deeper yet.

Wow! Just wow! I'd expected some part of the chain to bail out.
What would be the correct behaviour?
Did you intend to shadow /tmp/x/*?
Shadowing is probably out of scope for tagfs. Unionfs or similar could be used if desired. But we certainly have to handle this problem. Grave Bug.

pitrp's ideas how to fix this thing: b804b5a

I can't reproduce the problem using MarSoft's command directly:
$ tagfs /tmp/x -i /tmp/x
fuse: mountpoint is not empty
fuse: if you are sure this is safe, use the 'nonempty' mount option
Traceback (most recent call last):
File "/home/marook/.local/bin/tagfs", line 41, in
sys.exit(main())
File "/home/marook/.local/lib/python/tagfs/tagfs.py", line 169, in main
return fs.main()
File "/usr/lib/python2.6/dist-packages/fuse.py", line 757, in main
main(**d)
fuse.FuseError: filesystem initialization failed

But when I slightly modify the call I can reproduce the problem:
$ tagfs -o nonempty /tmp/x -i /tmp/x

After the tagfs call returns everything seems normal at first. When I do a
$ ls /tmp
the call never returns.

So I do a
$ rmmod fuse
which can't remove the fuse module because it's still in use.

When I call
$ rmmod -f fuse
the fuse module is unloaded. But this seems to break my system. dmesg says me:

[15922.723773] Disabling lock debugging due to kernel taint
[15922.725710] fuse exit
[15922.725742] =============================================================================
[15922.727754] BUG fuse_inode: Objects remaining on kmem_cache_close()
[15922.729705] -----------------------------------------------------------------------------
[15922.729705] 
[15922.729705] INFO: Slab 0xc1b510c0 objects=18 used=1 fp=0xf3f87dc0 flags=0x40004080
[15922.729705] Pid: 9634, comm: rmmod Tainted: G  R        2.6.32-5-686 #1
[15922.729705] Call Trace:
[15922.729705]  [<c10ac7e4>] ? slab_err+0x65/0x7e
[15922.729705]  [<c10c1c4f>] ? find_inode+0x1b/0x56
[15922.729705]  [<c10130e5>] ? native_send_call_func_single_ipi+0x21/0x22
[15922.729705]  [<c105285f>] ? generic_exec_single+0x4f/0x66
[15922.729705]  [<c10ad359>] ? list_slab_objects+0x58/0xf6
[15922.729705]  [<c10ad322>] ? list_slab_objects+0x21/0xf6
[15922.729705]  [<c10acdcf>] ? deactivate_slab+0x90/0xa8
[15922.729705]  [<c10af4c8>] ? kmem_cache_destroy+0xbb/0x13f
[15922.729705]  [<f7e3e3cf>] ? fuse_exit+0x28/0x2e [fuse]
[15922.729705]  [<c1055a8f>] ? sys_delete_module+0x19f/0x20f
[15922.729705]  [<c10091a9>] ? init_fpu+0xaa/0x147
[15922.729705]  [<c126f65f>] ? do_page_fault+0x2f1/0x307
[15922.729705]  [<c10030fb>] ? sysenter_do_call+0x12/0x28
[15922.729705] INFO: Object 0xf3f86000 @offset=0
[15922.770408] SLUB fuse_inode: kmem_cache_destroy called for cache that still has objects.
[15922.772724] Pid: 9634, comm: rmmod Tainted: G  R        2.6.32-5-686 #1
[15922.775117] Call Trace:
[15922.777481]  [<c10af507>] ? kmem_cache_destroy+0xfa/0x13f
[15922.779941]  [<f7e3e3cf>] ? fuse_exit+0x28/0x2e [fuse]
[15922.782443]  [<c1055a8f>] ? sys_delete_module+0x19f/0x20f
[15922.784945]  [<c10091a9>] ? init_fpu+0xaa/0x147
[15922.784951]  [<c126f65f>] ? do_page_fault+0x2f1/0x307
[15922.784959]  [<c10030fb>] ? sysenter_do_call+0x12/0x28
[15922.788247] =============================================================================
[15922.788250] BUG fuse_request: Objects remaining on kmem_cache_close()
[15922.788252] -----------------------------------------------------------------------------
[15922.788254] 
[15922.788257] INFO: Slab 0xc1b0c340 objects=20 used=2 fp=0xf1d1ba90 flags=0x40004080
[15922.788262] Pid: 9634, comm: rmmod Tainted: G  R        2.6.32-5-686 #1
[15922.788265] Call Trace:
[15922.788270]  [<c10ac7e4>] ? slab_err+0x65/0x7e
[15922.788276]  [<c10f33d3>] ? release_sysfs_dirent+0x6d/0x81
[15922.788280]  [<c10130e5>] ? native_send_call_func_single_ipi+0x21/0x22
[15922.788284]  [<c105285f>] ? generic_exec_single+0x4f/0x66
[15922.788288]  [<c10ad359>] ? list_slab_objects+0x58/0xf6
[15922.788291]  [<c10ad322>] ? list_slab_objects+0x21/0xf6
[15922.788295]  [<c10acdcf>] ? deactivate_slab+0x90/0xa8
[15922.788298]  [<c10af4c8>] ? kmem_cache_destroy+0xbb/0x13f
[15922.788306]  [<c1055a8f>] ? sys_delete_module+0x19f/0x20f
[15922.788310]  [<c10091a9>] ? init_fpu+0xaa/0x147
[15922.788314]  [<c126f65f>] ? do_page_fault+0x2f1/0x307
[15922.788317]  [<c10030fb>] ? sysenter_do_call+0x12/0x28
[15922.788322] INFO: Object 0xf1d1a000 @offset=0
[15922.788325] INFO: Object 0xf1d1bdb0 @offset=7600
[15922.788327] =============================================================================
[15922.788329] BUG fuse_request: Objects remaining on kmem_cache_close()
[15922.788331] -----------------------------------------------------------------------------
[15922.788332] 
[15922.788335] INFO: Slab 0xc1a2d640 objects=20 used=3 fp=0xeadb3db0 flags=0x40004080
[15922.788338] Pid: 9634, comm: rmmod Tainted: G  R        2.6.32-5-686 #1
[15922.788340] Call Trace:
[15922.788343]  [<c10ac7e4>] ? slab_err+0x65/0x7e
[15922.788347]  [<c10ad359>] ? list_slab_objects+0x58/0xf6
[15922.788350]  [<c10ad322>] ? list_slab_objects+0x21/0xf6
[15922.788354]  [<c10acdcf>] ? deactivate_slab+0x90/0xa8
[15922.788358]  [<c10af4c8>] ? kmem_cache_destroy+0xbb/0x13f
[15922.788362]  [<c1055a8f>] ? sys_delete_module+0x19f/0x20f
[15922.788366]  [<c10091a9>] ? init_fpu+0xaa/0x147
[15922.788369]  [<c126f65f>] ? do_page_fault+0x2f1/0x307
[15922.788373]  [<c10030fb>] ? sysenter_do_call+0x12/0x28
[15922.788377] INFO: Object 0xeadb2000 @offset=0
[15922.788379] INFO: Object 0xeadb2190 @offset=400
[15922.788381] INFO: Object 0xeadb2960 @offset=2400
[15922.788384] SLUB fuse_request: kmem_cache_destroy called for cache that still has objects.
[15922.788387] Pid: 9634, comm: rmmod Tainted: G  R        2.6.32-5-686 #1
[15922.788389] Call Trace:
[15922.788392]  [<c10af507>] ? kmem_cache_destroy+0xfa/0x13f
[15922.788396]  [<c1055a8f>] ? sys_delete_module+0x19f/0x20f
[15922.788400]  [<c10091a9>] ? init_fpu+0xaa/0x147
[15922.788404]  [<c126f65f>] ? do_page_fault+0x2f1/0x307
[15922.788407]  [<c10030fb>] ? sysenter_do_call+0x12/0x28
[15948.725421] BUG: unable to handle kernel NULL pointer dereference at (null)
[15948.725543] IP: [<c10c65e4>] seq_escape+0x85/0xa3
[15948.725628] *pde = 00000000 
[15948.725682] Oops: 0000 [#1] SMP 
[15948.725746] last sysfs file: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/status
[15948.725917] Modules linked in: serpent cbc usb_storage aes_i586 aes_generic nls_utf8 isofs loop binfmt_misc parport_pc ppdev lp parport sco bridge stp bnep rfcomm l2cap crc16 nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack xt_tcpudp xt_mac iptable_filter ip_tables x_tables acpi_cpufreq cpufreq_userspace cpufreq_stats cpufreq_powersave cpufreq_conservative dm_crypt dm_mod snd_hda_codec_analog arc4 ecb snd_hda_intel iwl3945 i915 snd_hda_codec iwlcore drm_kms_helper thinkpad_acpi snd_hwdep drm mac80211 snd_pcm pcmcia snd_seq btusb led_class i2c_i801 i2c_algo_bit yenta_socket snd_timer snd_seq_device rsrc_nonstatic i2c_core pcmcia_core rng_core evdev cfg80211 bluetooth snd battery nvram button video soundcore snd_page_alloc processor pcspkr ac psmouse output rfkill serio_raw xfs exportfs sg sr_mod usbhid hid cdrom sd_mod crc_t10dif ata_generic ahci ata_piix uhci_hcd thermal libata e1000e thermal_sys ehci_hcd scsi_mod usbcore nls_base [last unloaded: fuse]
[15948.727826] 
[15948.727856] Pid: 1956, comm: gnome-settings- Tainted: G  R        (2.6.32-5-686 #1) 1951PRG
[15948.727977] EIP: 0060:[<c10c65e4>] EFLAGS: 00210286 CPU: 0
[15948.728060] EIP is at seq_escape+0x85/0xa3
[15948.728123] EAX: 00000000 EBX: c3f33200 ECX: c12fd66b EDX: ea90f000
[15948.728212] ESI: ea90e1fa EDI: eaa3d8a0 EBP: f6f64db0 ESP: f5aaff00
[15948.728303]  DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
[15948.728381] Process gnome-settings- (pid: 1956, ti=f5aae000 task=f5a32640 task.ti=f5aae000)
[15948.728502] Stack:
[15948.728535]  c12fd66b 00000000 ea90f000 c3f33200 eaa3d8a0 eaa3d8a0 f6f64db0 c10c3c84
[15948.728690] <0> c127f934 f6f64d80 c10c4020 f6f64d80 f68cd198 c127f934 eaa3d8a0 000001d9
[15948.728859] <0> f6f64db0 c10c69ec 00000400 b6826000 f2625680 eaa3d8c8 00000000 00000008
[15948.729035] Call Trace:
[15948.729077]  [<c10c3c84>] ? show_type+0x17/0x49
[15948.729090]  [<c10c4020>] ? show_vfsmnt+0x5f/0xd8
[15948.729090]  [<c10c69ec>] ? seq_read+0x28a/0x360
[15948.729090]  [<c10c6762>] ? seq_read+0x0/0x360
[15948.729090]  [<c10b36cc>] ? vfs_read+0x7b/0xd3
[15948.729090]  [<c10b37bc>] ? sys_read+0x3c/0x63
[15948.729090]  [<c10030fb>] ? sysenter_do_call+0x12/0x28
[15948.729090] Code: 03 88 46 01 8d 43 30 88 46 02 8d 45 30 c6 06 5c 88 46 03 83 c6 04 eb 0b 8b 47 04 89 47 0c 83 c8 ff eb 1e ff 44 24 04 8b 44 24 04 <0f> b6 28 89 ea 84 d2 74 06 3b 74 24 08 72 8e 2b 37 31 c0 89 77 
[15948.729090] EIP: [<c10c65e4>] seq_escape+0x85/0xa3 SS:ESP 0068:f5aaff00
[15948.729090] CR2: 0000000000000000
[15948.730442] ---[ end trace f8272c1b38241fdd ]---

When shutting down my computer the system hangs and doesen't respond anymore. But no kernel panic.