All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] proc: print more information when removing non-empty directories
@ 2008-02-11 11:30 Alexey Dobriyan
  2008-02-11 15:33 ` Arjan van de Ven
  0 siblings, 1 reply; 2+ messages in thread
From: Alexey Dobriyan @ 2008-02-11 11:30 UTC (permalink / raw)
  To: akpm, arjan; +Cc: linux-kernel, devel

This usually saves one recompile to insert similar printk like below. :)

Sample nastygram:

remove_proc_entry: removing non-empty directory '/proc/foo', leaking at least 'bar'
------------[ cut here ]------------
WARNING: at fs/proc/generic.c:776 remove_proc_entry+0x18a/0x200()
Modules linked in: foo(-) container fan battery dock sbs ac sbshc backlight ipv6 loop af_packet amd_rng sr_mod i2c_amd8111 i2c_amd756 cdrom i2c_core button thermal processor
Pid: 3034, comm: rmmod Tainted: G   M     2.6.25-rc1 #5

Call Trace:
 [<ffffffff80231974>] warn_on_slowpath+0x64/0x90
 [<ffffffff80232a6e>] printk+0x4e/0x60
 [<ffffffff802d6c8a>] remove_proc_entry+0x18a/0x200
 [<ffffffff8045cd88>] mutex_lock_nested+0x1c8/0x2d0
 [<ffffffff8025f0f0>] __try_stop_module+0x0/0x40
 [<ffffffff8025effd>] sys_delete_module+0x14d/0x200
 [<ffffffff8045df3d>] lockdep_sys_exit_thunk+0x35/0x67
 [<ffffffff8031c307>] __up_read+0x27/0xa0
 [<ffffffff8045decc>] trace_hardirqs_on_thunk+0x35/0x3a
 [<ffffffff8020b6ab>] system_call_after_swapgs+0x7b/0x80

---[ end trace 10ef850597e89c54 ]---


Signed-off-by: Alexey Dobriyan <adobriyan@sw.ru>
---

 fs/proc/generic.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -769,7 +769,12 @@ continue_removing:
 		if (S_ISDIR(de->mode))
 			parent->nlink--;
 		de->nlink = 0;
-		WARN_ON(de->subdir);
+		if (de->subdir) {
+			printk(KERN_WARNING "%s: removing non-empty directory "
+			       "'%s/%s', leaking at least '%s'\n", __func__,
+			       de->parent->name, de->name, de->subdir->name);
+			WARN_ON(1);
+		}
 		if (atomic_dec_and_test(&de->count))
 			free_proc_entry(de);
 		break;


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

* Re: [PATCH] proc: print more information when removing non-empty directories
  2008-02-11 11:30 [PATCH] proc: print more information when removing non-empty directories Alexey Dobriyan
@ 2008-02-11 15:33 ` Arjan van de Ven
  0 siblings, 0 replies; 2+ messages in thread
From: Arjan van de Ven @ 2008-02-11 15:33 UTC (permalink / raw)
  To: Alexey Dobriyan; +Cc: akpm, linux-kernel, devel

Alexey Dobriyan wrote:
> This usually saves one recompile to insert similar printk like below. :)
> 
> Sample nastygram:


looks very useful to me!

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

end of thread, other threads:[~2008-02-11 15:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-11 11:30 [PATCH] proc: print more information when removing non-empty directories Alexey Dobriyan
2008-02-11 15:33 ` Arjan van de Ven

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.