Re: [Patch -mm 0/3] RFC: module unloading vs. release function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 16 Apr 2007 15:38:52 -0400 (EDT),
Alan Stern <[email protected]> wrote:

> On Mon, 16 Apr 2007, Dmitry Torokhov wrote:

> > Unfortunately all this "wait for refcount in module's exit" schemas
> > lead to the following deadlock:
> > 
> >         rmmod my_module < /path/to/some/file/incrementing/my/refcount
> 
> (Note that this problem will be a lot harder to provoke once Tejun's
> changes to sysfs are in place.  But it will still be possible, unless we 
> make similar changes to all the other filesystems as well.)
> 
> There are three possible approaches to this problem:
> 
>      1. Ignore it, as we do now.  If someone actually tries running your
> 	example above, an oops will result when the kobject's release
> 	method is called after my_module has been unloaded from memory.
> 
>      2. Do what Cornelia suggested, and allow the example to deadlock.
> 
>      3. Change the module code so that rmmod can return _before_ the
> 	module is actually unloaded from memory (but after the module's
> 	exit routine has completed).  This will lead to more problems.
> 	For example, what if someone tries to modprobe my_module back
> 	again before it has finished unloading?
> 
> My feeling is that either a deadlock or more complications with modprobe 
> would be preferable to an oops.  Your opinion may differ.

My current preference is 2. (obviously :)). I don't like 3. too much
(too complicated code), but I think it would still be better than 1.
(And I agree, this will be harder to trigger with Tejun's patches.)

> 
> (Also, doing this might be a good way to expose a lot of hidden 
> refcounting bugs.  They will become very obvious when rmmod hangs.)

Good point.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux