Re: pre-patch-2.1.107 breaks kmod

Chris Adams (cadams@ro.com)
26 Jun 1998 16:20:37 GMT


According to Linus Torvalds <torvalds@transmeta.com>:
>On Thu, 25 Jun 1998, Alan Cox wrote:
>> > But then it returns the error to kmod, and now the other thread that tried
>> > to load it thinks it failed. Boom!
>>
>> [Rude words] - yep.
>
>Note that pre-107 certainly did this wrong, and didn't allow the kind of
>recursion we _do_ want to allow. Which is why it got reverted. But we
>should be able to handle this _some_ way by doing the locking right.
>
>I'd welcome suggestions on which region to lock. It's nontrivial, but I
>bet there is some scheme that makes everybody happy..

If insmod locked the module file from the time it opened it until it
exited, you would guarantee that only one copy of the module was being
loaded at one time. What do you have insmod do on a locked module?
Wait a little and try again (how many times) or immediately exit with an
error? If it tries again until the module is not locked, then if it
returns EEXIST kmod could treat it as a success, because the module is
now loaded.

The only sticking point is how long to wait and how many retries insmod
makes.

-- 
Chris Adams - cadams@ro.com
System Administrator - Renaissance Internet Services
I don't speak for anybody but myself - that's enough trouble.

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu