> What is to prevent a module from being unloaded in the window between the
> time that the OS has found the file operation for open (in get_fops() from
> fs/devices.c) and the time that the open routine executes MOD_INC_USE_COUNT?
Nothing protects. On UP system it is impossible, if open is correctly
written and does not sleep before incrementing count. On SMP - oops.
> It seems to me that either all opens have to use the same mutex as used for
> loading modules, or the modules have to put in some sort of protection to
> prevent this.
It will not help. After MOD_DEC_USE_COUNT dropped use count to zero,
module can be unloaded while pc on one cpu is still inside it.
The answer is: modules cannot be unloaded on an SMP system at all,
if you do not want to crash.
Alexey
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/