Commit:     e14af7eeb47ea96c52741c5e5fa010d33daf6973
Parent:     21aa9280b9f4e9e68d3fa8990df6c9d7fd71f994
Author:     Arjan van de Ven <[EMAIL PROTECTED]>
AuthorDate: Fri Jan 25 21:08:33 2008 +0100
Committer:  Ingo Molnar <[EMAIL PROTECTED]>
CommitDate: Fri Jan 25 21:08:33 2008 +0100

    debug: track and print last unloaded module in the oops trace
    Based on a suggestion from Andi:
     In various cases, the unload of a module may leave some bad state around
     that causes a kernel crash AFTER a module is unloaded; and it's then hard
     to find which module caused that.
    This patch tracks the last unloaded module, and prints this as part of the
    module list in the oops trace.
    Right now, only the last 1 module is tracked; I expect that this is enough
    for the vast majority of cases where this information matters; if it turns
    out that tracking more is important, we can always extend it to that.
    [ [EMAIL PROTECTED]: build fix ]
    Signed-off-by: Arjan van de Ven <[EMAIL PROTECTED]>
    Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>
 kernel/module.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/kernel/module.c b/kernel/module.c
index 5bbf225..1bb4c5e 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -496,6 +496,8 @@ static struct module_attribute modinfo_##field = {          
+static char last_unloaded_module[MODULE_NAME_LEN+1];
 /* Init the unload section of the module. */
 static void module_unload_init(struct module *mod)
@@ -719,6 +721,8 @@ sys_delete_module(const char __user *name_user, unsigned 
int flags)
+       /* Store the name of the last unloaded module for diagnostic purposes */
+       sprintf(last_unloaded_module, mod->name);
@@ -2503,6 +2507,8 @@ void print_modules(void)
        printk("Modules linked in:");
        list_for_each_entry(mod, &modules, list)
                printk(" %s%s", mod->name, module_flags(mod, buf));
+       if (last_unloaded_module[0])
+               printk(" [last unloaded: %s]", last_unloaded_module);
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to