2005-01-12 08:53:50

by selvakumar nagendran

[permalink] [raw]
Subject: Removing a module even if use count is not zero

hello linux-experts,
I inserted my module into the running kernel that
intercepts read system call. I am using kernel 2.4.28.
Now, I am unable to remove it since each and every
time, the module is used by some process. How can I
remove the module even if the usecount is not zero?
Can anyone help me regarding this?

Thanks,
selva



__________________________________
Do you Yahoo!?
Take Yahoo! Mail with you! Get it on your mobile phone.
http://mobile.yahoo.com/maildemo


2005-01-12 13:48:12

by Brian Gerst

[permalink] [raw]
Subject: Re: Removing a module even if use count is not zero

selvakumar nagendran wrote:
> hello linux-experts,
> I inserted my module into the running kernel that
> intercepts read system call. I am using kernel 2.4.28.
> Now, I am unable to remove it since each and every
> time, the module is used by some process. How can I
> remove the module even if the usecount is not zero?
> Can anyone help me regarding this?
>
> Thanks,
> selva
>

Reboot. If you remove it, the system will likely crash.

--
Brian Gerst

2005-01-12 15:23:10

by Chris Friesen

[permalink] [raw]
Subject: Re: Removing a module even if use count is not zero

selvakumar nagendran wrote:
> hello linux-experts,
> I inserted my module into the running kernel that
> intercepts read system call. I am using kernel 2.4.28.
> Now, I am unable to remove it since each and every
> time, the module is used by some process. How can I
> remove the module even if the usecount is not zero?
> Can anyone help me regarding this?

As already said, you need to reboot.

To fix this in the future, export a /proc entry that when written to
causes your module to properly clean everything up and prevent anyone
from getting new accesses. This then allows you to remove the module
cleanly. Note that it may not be possible to cleanly deregister,
depending on what your module is doing.

Chris

2005-01-13 04:49:20

by selvakumar nagendran

[permalink] [raw]
Subject: exporting /proc entry for module

--- Chris Friesen <[email protected]> wrote:
> To fix this in the future, export a /proc entry that
> when written to
> causes your module to properly clean everything up
> and prevent anyone
> from getting new accesses. This then allows you to
> remove the module
> cleanly. Note that it may not be possible to
> cleanly deregister,
> depending on what your module is doing.
>
> Chris

How can I export a /proc entry for my module?

Regards,
selva



__________________________________
Do you Yahoo!?
Meet the all-new My Yahoo! - Try it today!
http://my.yahoo.com


2005-01-13 05:01:48

by Randy.Dunlap

[permalink] [raw]
Subject: Re: exporting /proc entry for module

selvakumar nagendran wrote:
> --- Chris Friesen <[email protected]> wrote:
>
>>To fix this in the future, export a /proc entry that
>>when written to
>>causes your module to properly clean everything up
>>and prevent anyone
>>from getting new accesses. This then allows you to
>>remove the module
>>cleanly. Note that it may not be possible to
>>cleanly deregister,
>>depending on what your module is doing.
>>
>
> How can I export a /proc entry for my module?

. . . . . . . . . .

You can study the valuable documents at
http://kernelnewbies.org/documents/

or google for other procfs example source code,
which should find several examples for you,
such as http://www.xenotime.net/linux/procfs_ex/

--
~Randy