mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Andrea Arcangeli <andrea@suse.de>
Cc: linux-kernel@vger.kernel.org, akpm@osdl.org
Subject: Re: module unload deadlock
Date: Wed, 18 Feb 2004 14:29:21 +1100	[thread overview]
Message-ID: <20040218041527.052222C510@lists.samba.org> (raw)
In-Reply-To: Your message of "Tue, 17 Feb 2004 18:26:46 BST." <20040217172646.GT4478@dualathlon.random>

In message <20040217172646.GT4478@dualathlon.random> you write:
> I've got bugreports for a deadlock due semaphore recursion in the module
> unload code of 2.6.
> 
> You considered the recursion issue for the ->init but not for the
> ->exit.

I considered it, but no cleanup called request_module which I
(reluctantly, as it made the locking non-trivial) dropped the lock
around init.

> the actual module doing request_modules in the cleanup handler is
> parport_pc, calling parport_enumerate (it calls it for another reason,
> and parport enumerate is told to load up a lowlevel driver if none was
> present, that's worthless for the unload routine but it's useful for all
> other calls of parport_enumerate). It's uncertain if other drivers
> triggers this deadlock.

Well, that's pretty stupid, but I think this should be fixed in the
module code for a practical reason: the number of oopses or hangs in
rmmod functions.  Bad enough that the module is useless: stopping
other module operations is very suboptimal.

> Comments?

Patch seems OK to me.  I'd prefer it to go via the -mm tree though to
shake things out in case I've missed something.

Thanks,
Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.


Name: Drop Lock Around Module Exit
Status: Experimental
From: Andrea Arcangeli <andrea@suse.de>

Turns out parport can do request_module from its exit function.  We
should drop lock anyway, because too many module exit functions oops
or hang anyway, rendering all module ops useless.

--- SLES/kernel/module.c.~1~	2004-02-12 17:24:42.000000000 +0100
+++ SLES/kernel/module.c	2004-02-17 18:08:05.519670280 +0100
@@ -732,7 +732,9 @@ sys_delete_module(const char __user *nam
 		wait_for_zero_refcount(mod);
 
 	/* Final destruction now noone is using it. */
+	up(&module_mutex);
 	mod->exit();
+	down(&module_mutex);
 	free_module(mod);
 
  out:


  reply	other threads:[~2004-02-18  4:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-17 17:26 Andrea Arcangeli
2004-02-18  3:29 ` Rusty Russell [this message]
2004-02-18  4:35   ` viro
2004-02-18 15:40     ` Andrea Arcangeli
2004-02-18 16:46       ` viro
2004-02-18 17:24         ` Andrea Arcangeli
2004-02-18 17:37           ` viro
2004-02-18 17:57             ` Andrea Arcangeli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040218041527.052222C510@lists.samba.org \
    --to=rusty@rustcorp.com.au \
    --cc=akpm@osdl.org \
    --cc=andrea@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®