Re: Help - can not rmmod a module

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

 






Hi ,

 Just a doubt on this -- what happens, when an application using the module
crashes. The application had done a MOD_INC_USE_COUNT and then it crashed,
so the module stays for ever unless the pc is rebooted . The module may be
working perfectly alright, just that it cannot eb removed.

This can prove to be a problem for say a char device.

someone opens it, MOD_INC_USE_COUNT is incremented in the open() call, then
the application that opened it crashes. so the module cannot be removed.
Now someone starts that process again, and calls the open function again,
will it work.

It will but then this shows that doing something like this -- if
(MOD_IN_USE) return -EBUSY in the char device open() function might be a
foolish thing to do, even if u assume that one and only one user level
process would be accessing your module.

regards
Amit




Jan Hudec <bulb@ucw.cz>@nl.linux.org on 06/10/2004 05:02:40 PM

Sent by:    kernelnewbies-bounce@nl.linux.org


To:    Anandraj <arm@tataelxsi.co.in>
cc:    Amit Kumar Singh/HSS@HSS, "'l x'" <whereisit28@yahoo.com>,
       kernelnewbies@nl.linux.org

Subject:    Re: Help - can not rmmod a module


On Thu, Jun 10, 2004 at 16:23:31 +0530, Anandraj wrote:
> Hi Jan and Amit,
> yep u r right guys ,
> But the doubt that arises on my mind is that
>
> what happens now whn the rmmod is called ?
>
> Now taking the senario , that 'l x' has stated ,
> u r module has been registerd, ie(insmod is done)
> the function XX_open() may or maynot be invoked ,
> since the MOD_INC_COUNT has not been incremented we
> cannot say for sure that it didnt invoke the XX_Open func,
> Possiblites are there that the module might have got struck before
> MOD_INC_COUNT
> Statement.

That's why the module use count is manipulated from outside! Some
structures, like a filesystem structure, device structure and similar
have an owner filed. This field is initialized to the module struct of
module that registered it. And when filesystem is mounted, device is
mounted, etc., the module use count is incremented before call to that
module is made. And decremented again after umount/close....

If you manage to unload a module, to which pointers exist somewhere in
kernel (like when it's device is open), the system is will crash
promptly.

> In the above senario can u guys plz tell me what  will happen if i call
> rmmod,
> and is it possible to kill the module in above state ,in - 2.6
(preemptable
> Kernel).

The preemptability of the kernel does not matter -- it's behaviour is
equivalent to a non-preemptible SMP (and SMP is much more common now
that there is hyperthreading)

-------------------------------------------------------------------------------

        Jan 'Bulb' Hudec <bulb@ucw.cz>

Attachment: signature.asc
Description: Binary data


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux