linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* FUSE kmemleak report
@ 2011-09-05 22:37 Sitsofe Wheeler
  2011-09-06 10:35 ` Catalin Marinas
  0 siblings, 1 reply; 4+ messages in thread
From: Sitsofe Wheeler @ 2011-09-05 22:37 UTC (permalink / raw)
  To: Miklos Szeredi; +Cc: fuse-devel, linux-kernel

Hi,

kmemleak is reporting that 32 bytes are being leaked by FUSE:

unreferenced object 0xe373b270 (size 32):
  comm "fusermount", pid 1207, jiffies 4294707026 (age 2675.187s)
  hex dump (first 32 bytes):
    01 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00  ................
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<b05517d7>] kmemleak_alloc+0x27/0x50
    [<b0196435>] kmem_cache_alloc+0xc5/0x180
    [<b02455be>] fuse_alloc_forget+0x1e/0x20
    [<b0245670>] fuse_alloc_inode+0xb0/0xd0
    [<b01b1a8c>] alloc_inode+0x1c/0x80
    [<b01b290f>] iget5_locked+0x8f/0x1a0
    [<b0246022>] fuse_iget+0x72/0x1a0
    [<b02461da>] fuse_get_root_inode+0x8a/0x90
    [<b02465cf>] fuse_fill_super+0x3ef/0x590
    [<b019e56f>] mount_nodev+0x3f/0x90
    [<b0244e95>] fuse_mount+0x15/0x20
    [<b019d1bc>] mount_fs+0x1c/0xc0
    [<b01b5811>] vfs_kern_mount+0x41/0x90
    [<b01b5af9>] do_kern_mount+0x39/0xd0
    [<b01b7585>] do_mount+0x2e5/0x660
    [<b01b7966>] sys_mount+0x66/0xa0

This leak report is consistent and happens once per boot on
3.1.0-rc5-dirty.

-- 
Sitsofe | http://sucs.org/~sits/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: FUSE kmemleak report
  2011-09-05 22:37 FUSE kmemleak report Sitsofe Wheeler
@ 2011-09-06 10:35 ` Catalin Marinas
  2011-09-06 11:43   ` Miklos Szeredi
  0 siblings, 1 reply; 4+ messages in thread
From: Catalin Marinas @ 2011-09-06 10:35 UTC (permalink / raw)
  To: Sitsofe Wheeler; +Cc: Miklos Szeredi, fuse-devel, linux-kernel

On 5 September 2011 23:37, Sitsofe Wheeler <sitsofe@yahoo.com> wrote:
> kmemleak is reporting that 32 bytes are being leaked by FUSE:
>
> unreferenced object 0xe373b270 (size 32):
>  comm "fusermount", pid 1207, jiffies 4294707026 (age 2675.187s)
>  hex dump (first 32 bytes):
>    01 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00  ................
>    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
>  backtrace:
>    [<b05517d7>] kmemleak_alloc+0x27/0x50
>    [<b0196435>] kmem_cache_alloc+0xc5/0x180
>    [<b02455be>] fuse_alloc_forget+0x1e/0x20
>    [<b0245670>] fuse_alloc_inode+0xb0/0xd0
>    [<b01b1a8c>] alloc_inode+0x1c/0x80
>    [<b01b290f>] iget5_locked+0x8f/0x1a0
>    [<b0246022>] fuse_iget+0x72/0x1a0
>    [<b02461da>] fuse_get_root_inode+0x8a/0x90
>    [<b02465cf>] fuse_fill_super+0x3ef/0x590
>    [<b019e56f>] mount_nodev+0x3f/0x90
>    [<b0244e95>] fuse_mount+0x15/0x20
>    [<b019d1bc>] mount_fs+0x1c/0xc0
>    [<b01b5811>] vfs_kern_mount+0x41/0x90
>    [<b01b5af9>] do_kern_mount+0x39/0xd0
>    [<b01b7585>] do_mount+0x2e5/0x660
>    [<b01b7966>] sys_mount+0x66/0xa0
>
> This leak report is consistent and happens once per boot on
> 3.1.0-rc5-dirty.

IIUC, kmemleak reports the fuse_forget_link that corresponds to the
root inode (allocated via fuse_fill_super). The root inode is later
freed (did the mount failed?) but not the forget link. I'm not
familiar with this code, so note exactly sure where the forget link
should have been freed.

-- 
Catalin

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: FUSE kmemleak report
  2011-09-06 10:35 ` Catalin Marinas
@ 2011-09-06 11:43   ` Miklos Szeredi
  2011-09-06 22:42     ` Sitsofe Wheeler
  0 siblings, 1 reply; 4+ messages in thread
From: Miklos Szeredi @ 2011-09-06 11:43 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: Sitsofe Wheeler, fuse-devel, linux-kernel

Catalin Marinas <catalin.marinas@arm.com> writes:

> On 5 September 2011 23:37, Sitsofe Wheeler <sitsofe@yahoo.com> wrote:
>> kmemleak is reporting that 32 bytes are being leaked by FUSE:
>>
>> unreferenced object 0xe373b270 (size 32):
>>  comm "fusermount", pid 1207, jiffies 4294707026 (age 2675.187s)
>>  hex dump (first 32 bytes):
>>    01 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00  ................
>>    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
>>  backtrace:
>>    [<b05517d7>] kmemleak_alloc+0x27/0x50
>>    [<b0196435>] kmem_cache_alloc+0xc5/0x180
>>    [<b02455be>] fuse_alloc_forget+0x1e/0x20
>>    [<b0245670>] fuse_alloc_inode+0xb0/0xd0
>>    [<b01b1a8c>] alloc_inode+0x1c/0x80
>>    [<b01b290f>] iget5_locked+0x8f/0x1a0
>>    [<b0246022>] fuse_iget+0x72/0x1a0
>>    [<b02461da>] fuse_get_root_inode+0x8a/0x90
>>    [<b02465cf>] fuse_fill_super+0x3ef/0x590
>>    [<b019e56f>] mount_nodev+0x3f/0x90
>>    [<b0244e95>] fuse_mount+0x15/0x20
>>    [<b019d1bc>] mount_fs+0x1c/0xc0
>>    [<b01b5811>] vfs_kern_mount+0x41/0x90
>>    [<b01b5af9>] do_kern_mount+0x39/0xd0
>>    [<b01b7585>] do_mount+0x2e5/0x660
>>    [<b01b7966>] sys_mount+0x66/0xa0
>>
>> This leak report is consistent and happens once per boot on
>> 3.1.0-rc5-dirty.
>
> IIUC, kmemleak reports the fuse_forget_link that corresponds to the
> root inode (allocated via fuse_fill_super). The root inode is later
> freed (did the mount failed?) but not the forget link. I'm not
> familiar with this code, so note exactly sure where the forget link
> should have been freed.

Sitsofe, thanks for the report.

Could you please try the patch below?

Thanks,
Miklos


diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 168a80f..5cb8614 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -258,10 +258,14 @@ void fuse_queue_forget(struct fuse_conn *fc, struct fuse_forget_link *forget,
 	forget->forget_one.nlookup = nlookup;
 
 	spin_lock(&fc->lock);
-	fc->forget_list_tail->next = forget;
-	fc->forget_list_tail = forget;
-	wake_up(&fc->waitq);
-	kill_fasync(&fc->fasync, SIGIO, POLL_IN);
+	if (fc->connected) {
+		fc->forget_list_tail->next = forget;
+		fc->forget_list_tail = forget;
+		wake_up(&fc->waitq);
+		kill_fasync(&fc->fasync, SIGIO, POLL_IN);
+	} else {
+		kfree(forget);
+	}
 	spin_unlock(&fc->lock);
 }
 

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: FUSE kmemleak report
  2011-09-06 11:43   ` Miklos Szeredi
@ 2011-09-06 22:42     ` Sitsofe Wheeler
  0 siblings, 0 replies; 4+ messages in thread
From: Sitsofe Wheeler @ 2011-09-06 22:42 UTC (permalink / raw)
  To: Miklos Szeredi; +Cc: Catalin Marinas, fuse-devel, linux-kernel

On Tue, Sep 06, 2011 at 01:43:27PM +0200, Miklos Szeredi wrote:
> 
> Sitsofe, thanks for the report.
> 
> Could you please try the patch below?

You're welcome. The patch resolves the leak for me on 3.1.0-rc5 on
Ubuntu 10.04 using GNOME 2.30.2 (I could previously reproduce it my
logging in as one user, logging out, logging in as another user and then
as root doing echo scan > /sys/kernel/debug/kmemleak ).

Tested-by: Sitsofe Wheeler <sitsofe@yahoo.com>

-- 
Sitsofe | http://sucs.org/~sits/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-09-06 22:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-05 22:37 FUSE kmemleak report Sitsofe Wheeler
2011-09-06 10:35 ` Catalin Marinas
2011-09-06 11:43   ` Miklos Szeredi
2011-09-06 22:42     ` Sitsofe Wheeler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).