Re: RE2: [OKS] Module removal

From: Alexander Viro (viro@math.psu.edu)
Date: Tue Jul 02 2002 - 17:23:12 EST


On Tue, 2 Jul 2002, Keith Owens wrote:

> Incrementing the use count at registration time is no good, it stops
> the module being unloaded. Operations are deregistered at rmmod time.
> Setting the use count at registration prevents rmmod from removing the
> module, so you cannot deregister the operations. Catch 22.

Right. So you should use try_inc_mod_count() before dereferencing the
registered pointers and treat failure as "not found".
 
> Module unload is not racy on UP without preempt. It is racy on SMP or
> with preempt. It used to be safe on SMP because almost everything was
> under the BKL, but that protection no longer exists.

<wry> You forgot "as long as nothing blocks". Which is more than brittle -
code changes routinely violate such warranties. </wry>

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



This archive was generated by hypermail 2b29 : Sun Jul 07 2002 - 22:00:09 EST